Help getting started.
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 [noparse]:)[/noparse]· 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!
- 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!
Comments
Post Edited (Robert Schwartz) : 2/25/2005 5:30:08 AM GMT
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 [noparse]:)[/noparse])
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
Post Edited (Robert Schwartz) : 2/25/2005 4:51:22 PM GMT
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·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. 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. To make it easy, get the 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.·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
- 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·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·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. 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.
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
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?
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·[noparse][[/noparse]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.