PDA

View Full Version : Help getting started.



Cheech
02-25-2005, 11:59 AM
Hello, this will be my first post and I hope I am not breaking any rules by doing so.· So here is my situation:· I have a bedroom window that need to be cracked open no matter how cold it is outside, my PC is a space heater, but it is never the same and I keep having to get up and readjust my window.· Well I had an idea, I have a low gear 12v motor that can power the window up and down, I can do the mechanics my self, but the electronics is a different story.· I have had some stamp experience before, I played with a chip and made a buzzer buzz if it detected light, it was amusing :)· So this might be a little harder but nothing impossible I don't think, here is what I want it to do:
- Have a temp probe that monitors my room temp.
- have two 7 segment displays to show the goal temp (one for each digit)*
- have·a duel color led, one color for on, other for standby
- have a ir receiver to remotely change temp*
- Monitor temp every x amount of minuets and spin motor +/- for·x amount of time accordingly
- Have safety absolute end switches

*Could do without if it is going to be too hard.

Summary:· So every lets say 5 min I want it to take a temp reading, compare it to the goal, and if it is above the temp then open window in preset increments (could possibly add a few for drastic changes) and same for under temp.· I want it to have a threshold of like 3 degrees so it doesn't have to move if its really close.· I want to be able to adjust·on/off and goal temp via ir remote.· And to make sure its not ramming my window into my ceiling I want to put a switch that when it hits it it will stop (It should check that before it attempts to move motor)

So thats my idea, any problems or advice?· I need to know what to buy, right now I have nothing stamp related, this will be my first adventure into the world of stamp, sorry for the long post!

Robert Schwartz
02-25-2005, 12:27 PM
Welcome, Cheech! Let me make sure I know what you want to do. You want to have a Basic Stamp control how much you open a window cool down your PC, right? If you don't mind me suggesting another idea, here it is. Add a few fans to your PC and have a basic stamp control the speed of the fans through digital potentiometers. That way, your entire room won't need to cool down to keep the PC at reasonable temps.

Post Edited (Robert Schwartz) : 2/25/2005 5:30:08 AM GMT

Cheech
02-25-2005, 12:36 PM
Well not quite, I just mentioned my PC as the main source of heat, but I want my whole room to be monitored because, well I don't sit inside the PC :P· And I don't want it to monitor how much I open a window, I want it to monitor it self and open its own windows!· So If its hot it opens, cold it closes in small increments every 5 min.

Robert Schwartz
02-25-2005, 12:48 PM
This could be done a few ways. You could add a worm gear to the windo frame(the part attached to the wall), and a matching gear onto the window itself(the part that moves). Attach the worm gear to a stepper motor and have the stepper move the windo up and down.
the general algorithm would be this (I am wayyyy to tired to right actual code right now, Ill get back to you tomarrow on that :))

Start:
Declare a good temperature as TempControl
Monitor Temperature and store as TempCurrent
If TempCurrent > TempControl Then
If ceiling switch is not hit
move the window up 1/2 inch
else if TempCurrent < TempControl Then
If bottom switch is not hit
move the window down 1/2 inch
pause 300000 (5 minutes)
goto Start

bishop
02-25-2005, 02:41 PM
yeah and wouldnt it be great if its 90 degrees in the room, the puter opens your window for you and then it storms.

Cheech
02-25-2005, 07:52 PM
Well I have a few feet of roof over my window and it doesent really storm much it being winter and all... Thanks for the help robert, now how about the actual parts? I was thinking of getting stamp II starter kit, what else would I need?

Robert Schwartz
02-25-2005, 11:48 PM
Alsright, Im awake now. Are you planning on just measuring the temp, in your computer, or you also (or just) measing you room temperature. You may want to get a thermometer outside to check the outside temperatures. That way, if it is 80 degrees outside, but 78 degrees inside, you stamp wont try to cool down the inside with warmer air. How heavy is you window (approx.) and how far does it travel?

Post Edited (Robert Schwartz) : 2/25/2005 4:51:22 PM GMT

Cheech
02-26-2005, 05:56 AM
The computer has nothing to do with this, the probe will be measuring my room temp. Don't worry about the mechanics part, I can do all that by my self so all the software is concerned about is supplying power for how ever long of time to move my window a good distance, which I can adjust so no problem there. So if I get a stamp II starter kit what else would I need (non mechanical), where would I find a compatible temp probe and 7-segment displays?

Ken Gracey
02-26-2005, 06:37 AM
Cheech,

I think you can do all of this, except it could be a challenge to manage the motor at the same time as receiving infrared. With any project, particularly this one, you will need to take it in very small increments. Make the small pieces work indivdually and then add the next most important feature.

Here is the order in which I would pursue the project and the resources available to you to make it easier:

- Have a temp probe that monitors my room temp.
Okay, for ease of use I'd simply recommend the DS1620 or LM34. The DS1620 is here:
http://www.parallax.com/detail.asp?product_id=604-00002 (http://www.parallax.com/detail.asp?product_id=604-00002)·but I recommend that you skip the code listed on that page and pull it from our Applied Sensors book http://www.parallax.com/html_pages/downloads/siccurriculum/documentation_sic_curriculum.asp (http://www.parallax.com/html_pages/downloads/siccurriculum/documentation_sic_curriculum.asp). This sensor is pre-calibrated. If you want to use a "temperature probe" then try the LM34 http://www.parallax.com/detail.asp?product_id=800-00027 (http://www.parallax.com/detail.asp?product_id=800-00027). To make it easy, get the ADC0831 http://www.parallax.com/detail.asp?product_id=ADC0831 (http://www.parallax.com/detail.asp?product_id=ADC0831)·(or its two-channel brother).·Code examples for this part are in our Industrial Control text http://www.parallax.com/html_pages/downloads/siccurriculum/documentation_sic_curriculum.asp (http://www.parallax.com/html_pages/downloads/siccurriculum/documentation_sic_curriculum.asp).·I suggest you obtain two temperatures first and display them on the·Stamp editor's DEBUG screen just to draw this part of the project·to a conclusion.·

- Monitor temp every x amount of minuets
Does it have to be "minutes"? The problem here is that the Stamp has no built-in clock, though you could use the pause command as a delay. I'd leave this requirement out for the time being until your entire program is written, because it could be that your program execution and a loop counter would be enough, or you might decide that you only want to move the motors if the temperature has changed a significant amount (vs. a fixed amount of time passing). If you monitor the change in temperature and use it as your indicator then you could avoid relying on checking every "two minutes".

- have two 7 segment displays to show the goal temp (one for each digit)*
Okay, but it would be easier if you used a serial LCD. Then you would only need a couple of lines of code. If you want to display the setpoint, plus the two other temperatures, then it seems you're going to need a load of seven-segment displays (unless you want to use the IR receiver to cycle through the modes used on the seven-segment displays). Could you use a serial LCD here instead? Chances are you will want to add some features and the seven-segment displays could become restrictive. Anyway, if it is seven segment displays, some really good example code is available in What's a Microcontroller? http://www.parallax.com/html_pages/downloads/siccurriculum/documentation_sic_curriculum.asp (http://www.parallax.com/html_pages/downloads/siccurriculum/documentation_sic_curriculum.asp)

- have·a duel color led, one color for on, other for standby
Also in What's a Microcontroller.

- have a ir receiver to remotely change temp*
Now it will get progressively difficult, but it can still be done though the DS1620s and display devices could be under Stamp control while you need to receive infrared signals, not to mention the motor you are about to add to the system. I think I'd start by using three pushbuttons (select, up·and down). Examples of pushbutton control is in the Basic Analog and Digital Text, StampWorks·and What's a Microcontroller. But if it is infared you want, take a look at the Infrared Remote Control for the Boe-Bot text here:http://www.parallax.com/detail.asp?product_id=70016 (http://www.parallax.com/detail.asp?product_id=70016)·which is also a free download. You will need an infrared receiver and transmitter (Wal Mart).

- and spin motor +/- for·x amount of time accordingly
Will require some motor driving circuitry. Read column 23 on this page: http://www.parallax.com/html_pages/downloads/nvcolumns/Nuts_Volts_Download_V1.asp (http://www.parallax.com/html_pages/downloads/nvcolumns/Nuts_Volts_Download_V1.asp)·to get started. You might prefer to opt for an off-the-shelf Solutions Cubed Motor Mind or Icon controller depending on the size/rating of the motor. That hardware is here: http://www.parallax.com/html_pages/products/motorcontrol/motor_control.asp (http://www.parallax.com/html_pages/products/motorcontrol/motor_control.asp). At this point you'll either be using the PWM command or SEROUT from the BASIC Stamp, depending on the type of circuit you choose. You might also need feedback, such as reed switches/magnets, distance detection (ultrasonic?), hall-effect sensors/magnets, etc. to know the open/close location of the window.

- Have safety absolute end switches
Yes, also important. See above for some ideas.

There are alternative approaches which could be better, such as making the motor interface first, then determining how the rest of the design will work. Sometimes you can figure out a better approach just by resolving the mechanical interface first. It might alter what type of control you use for the project. For example, setting a setpoint might only need to be done once or twice during PC programming of the Stamp. But whatever you do, I wanted to give you some resources to consider while you think about the project.

Ken Gracey
Parallax, Inc.

Robert Schwartz
02-26-2005, 06:42 AM
OK. You will need a stepper motor controller. Which one dependingn on the power your stepper requires. If you have a stepper that requires less than .5A, the ULN2803A will work. If your stepper requires more, look into the Little Step-U Motor Controller. Both can be found at Parallax website. As far as temperature sensing goes, DS1620 will do, and its under $7. FOr the 7 segment display, there are quite a few here (http://www.goldmine-elec-products.com/products.asp?dept=1040), at goldmine elec. The DS1620 measures in steps of .5degrees C so you may want to use one that has 3 spaces.

EDIT:Man, he beat me to it. As far as timing goes, execution of the entire code and adjusting the window will probably not take that long, so you could just add a PAUSE 240000 and it will run about every 4.5 ~ 5 minutes. Timing isn't really critical here.

Post Edited (Robert Schwartz) : 2/25/2005 11:46:21 PM GMT

Cheech
02-28-2005, 09:38 AM
Is there anything that I need a stamp II chip on this for? I just found out my neighbor has a Stamp I he will let me have which will cut my cost greatly. Thanks again Ken ;)

Cheech
03-01-2005, 12:41 PM
After looking at prices of electric actuators I decided to call off the window moving plan and implement a simple but effective plan. I am going to have a string of computer fans span the whole distance of my window and have the stamp control the speed of them. Much less of a headache and should be fun to make. I do still want an LCD screen and this is what I have in my shopping cart so far:

BASIC Stamp Discovery Kit (USB): http://www.parallax.com/detail.asp?product_id=27807
9 Volt adapter: http://www.parallax.com/detail.asp?product_id=750-00008
Temp sensor: http://www.parallax.com/detail.asp?product_id=750-00008
2 x 16 Serial LCD - Backlit: http://www.parallax.com/detail.asp?product_id=27923
Serial Cable: http://www.parallax.com/detail.asp?product_id=27946

I think that is a good start right? It should do everythign I need it to do and much more. And final comments before I order?

Ken Gracey
03-01-2005, 12:53 PM
Hey Cheech,

It's well worth anybody's time to ask questions about their project. Hopefully I didn't discourage you. I provided my outlook, which was that it would be fairly difficult, but there are some Stamp programmers who seem to be able to make anything work in a BS2 (or a BS1!).

As far as the shopping cart is concerned, remove the serial cable. It is in the BASIC Stamp Discovery Kit already. Also, about the Discovery Kit. . .it looks like it is still on sale at $30 off http://www.parallax.com/detail.asp?product_id=27807·but only because our webmaster overlooked removing the sale price this afternoon. She'll be back in the morning at 9:15 AM PT, so you can still get it on sale for about 12 hours. It's an excellent value and my highest recommendation.

Otherwise, your shopping cart looks just right.

You will need some solid state relays to modulate the fan speed. You can buy these at Digi-Key when you are ready, or Parallax has·the StampCI board·[really functional but a bit expensive for your project]. There are many types available and it can easily be the subject of its own thread when you are ready. First, get those LEDs blinkin' and·them try the PWM command on them. After that, ask this forum about relays and switching 110VAC.

Have fun with the new hardware!

Ken Gracey
Parallax, Inc.