It partly depends on what you mean by "the same time every day". If you don't need accuracy ... if the time can drift a couple of minutes a day, then you may be able to use PAUSEs to create the time delay needed. If you need more accuracy than that, then you will need some kind of external real-time clock. There are examples of this in the Nuts and Volts Columns available from Parallax (click on the Resources tab on their main webpage). Keep in mind that we get tired of playing "twenty questions". The more detailed information you can supply, the better the answers and advice you will get. SparkFun sells several different real-time clock "breakout boards" that are very nice to work with and come already with a backup battery and battery holder. Most use the I2C protocol for connecting to a Stamp or whatever. The BS2 doesn't have the built-in I2C statements of some of the other Stamp models, but the Nuts and Volts Columns have sample code for handling I2C devices using a BS2.
It is a small door on a project that flips open. Like a door in a house. Does this make sense...??? I'm not sure.
That can mean a lot of different things. Small is relative. It is best to give some approximate dimensions. If you can't do that then compare the size to something that is commonly known such as - "a door the size of a pack of playing cards".
Let me just take it from the top to clarify things. My friend has a reptile and he wants me to make an automatic cricket dispenser. (Sounds odd!)
I need to build a box that has a 2 x 2 in door on it. (The door will open from the bottom of the box)
I will need it to open at a certain time of day for x amount of seconds. I don't need it to be extremely accurate. I still need to figure how long it needs to be open by trial and error.
The box itself is about a 1 foot square. 5-6 in deep.
The problem is, it needs to be powered from the wall most likely because he goes out of town for weeks at a time.
So I basically need info on making it turn a servo 45-70 degrees once a day. The arrow in the CAD is pointing to the door which will open about about 45-70 degrees. Exact angle has not been determined yet.
If this does not clarify my project, just tell me. (I'm new to this forum and not too experienced)
Thank you
I would consider a different mechanism for opening the door. It seems that it would be better to have a small hole in the wall separating the cricket chamber from the electronics rather than a slot that little crickets can get through. I would use a push rod to actuate the door. Much the same way as is used on RC airplanes to control the control surfaces.
Does it matter if the time off day gets shifted a bit each day? The Basic Stamp can keep approximate time. It will accumulate errors. For example, you might program it to actuate every 24 hours but in reality it may operate every 23 hrs and 55 minutes (gross estimate, I have no idea how much off it would be). After a few weeks it would be hours off. This may be of no consequence in this application. Also, you can tune your timing based upon observation to better match the real time.
So I could find a mechanism for RC planes on the web and just attach a servo on the outside. I would want it to open in the middle of the day so it would be opened when his lizard is awake. The push rod will work a lot better then my first plan. He wanted the crickets to drop from the top of the cage. Thanks for that info. It help alot.
So how many crickets are necessary for feeding? You could measure the weight of 10 or 15 crickets and divide by the number of crickets and find how much a normal cricket weighs. Then you could have a strain gauge attached to close the door (slowly) so you would not overfeed the reptile(s). You could also use a light activated transistor to open the door at first light with a capacitor and resistor arrangement to eliminate lightning strikes at night and a pause command to get you through the day. If the reptile(s) cannot find the crickets when they are hungry they should die of stupidness. (This dictionary does not consider stupidness a word and needs to be updated)
Look at pictures of R/C servos if you haven't already. They have either a disc mounted on the shaft or a cross-like "4-horn" adapter, either shape with holes for piano wire which becomes the "push rod". As the servo shaft turns, the piano wire can push / pull the door so it opens and closes. The "What's a Microcontroller?" tutorial and the "Robotics with the BoeBot" tutorial discuss how servos work and gives lots of examples. Both are included in the help files when you install the Stamp Editor which includes the Parallax Basic compiler. You can also download the tutorials by going to Parallax's main webpage and clicking on the Downloads button. On the downloads page, these will be under "Educational Tutorials & Translations". You can also download the "Basic Stamp Syntax and Reference Manual" under "Stamp Documentation". To wait 24 hours, you'd do:
hours var byte
minutes var byte
seconds var byte
for hours = 1 to 24
for minutes = 1 to 60
for seconds = 1 to 60
pause 1000
next
next
next
To move the servo through somewhere from 90 to maybe 120 degrees you'd do:
servo pin 1 ' or whatever I/O pin the servo is connected to
count var byte
for count = 1 to 50 ' allow 1 second for the servo to move to the open position
pulsout servo, 500 ' this number could be as low as 250 depending on the servo
pause 20 ' servos need about 20ms between pulses
next
for seconds = 1 to 15 ' whatever number of seconds the door should be opened
pause 1000
next
for count = 1 to 50 ' again, allow about 1 second for the servo to move to closed position
pulseout servo, 1000 ' this number could be as high as 1250 depending on the servo
pause 20 ' servos need a 20ms pause between successive pulses
next
Somewhere in your program's initialization, you'd need to make sure the door is closed. Have
another copy of the last 4 lines above to do this.
I have done some research and found its complicated to use a basic stamp as a long term timer due to errors. Is there a different controller that would work the best? Never mind this post.
It's not really complicated. I had an application very similar to yours except that I had to turn on a drainage pump roughly every 24 hours for one minute. I used a BS1 I had around ... worked great. The time would drift. The program was a little different and adjusted for the time the pump was on. You'd turn it on, the pump would run, then wait until 24 hours later and repeat. If the time drifted too much, all you had to do was to turn it off and on when you wanted it to start over again. Over a week, it drifted a couple of minutes.
If you haven't chosen a microcontroller yet, you ought consider the Propeller. I think it would be a better time keeper and it could easily interface with a real time clock module or even a GPS unit (a BS2 could also be used with a RTC or GPS). Plus you can buy two Propeller QuickStart boards for about the same price as one BS2. They're even less expensive than a BS1 (and way more powerful).
The middle of the day is easier to determine than "once a day". you could have your BS2 activate the door an ammount of time after sunrise, determined by a solar cell or similar sensor outside. A solar cell could also be used to charge batteries if you don't want to plug it in to the wall. I suppose it all depends on if you live in Alaska or Arizona how much sun you get each day... lol. Other inexpensive time keepers include lighting timers like you would use for turning on and off house lights while you are away.
The problem is, sometimes he need it for 1-2 weeks. I could do it for one day but even a few days is tough because it needs to be alive. There are timers that can be used. All I would need to do regulate the current and build the holding box for the crickets. What do y'all think?
The problem you'll have no matter what kind of timer you use is the need to control the motor.
Servos, are very easy to use with a microcontroller.
I don't know how precise time kept by a Propeller wouild be but it should keep it will enough it keep your friends reptile happy.
You could use QuickStart board and use its LEDs as a binary countdown to feeding time. If the time were noticeably off, you could use the touchpads to correct the time.
I used the QuickStart's touchpads as inputs to control a servo in my QuickStart servo tester. I also used its LEDs as a way to indicate the various parameters of the tester.
The mist king seconds timer is used to power a pump continuously. Not turn a motor this way then that way. How about when the timer goes off, it triggers a vacuum of some sort that pulls them into the cage. That way I would have an idea of how many crickets went in instead of assuming that they were just going to fall, which they might not.
Comments
What kind of power source do you have? Does this need to be powered by a battery?
How precise does it need to be?
BTW, Welcome to the forum.
It is a small door on a project that flips open. Like a door in a house. Does this make sense...??? I'm not sure.
That can mean a lot of different things. Small is relative. It is best to give some approximate dimensions. If you can't do that then compare the size to something that is commonly known such as - "a door the size of a pack of playing cards".
I need to build a box that has a 2 x 2 in door on it. (The door will open from the bottom of the box)
I will need it to open at a certain time of day for x amount of seconds. I don't need it to be extremely accurate. I still need to figure how long it needs to be open by trial and error.
The box itself is about a 1 foot square. 5-6 in deep.
The problem is, it needs to be powered from the wall most likely because he goes out of town for weeks at a time.
So I basically need info on making it turn a servo 45-70 degrees once a day. The arrow in the CAD is pointing to the door which will open about about 45-70 degrees. Exact angle has not been determined yet.
If this does not clarify my project, just tell me. (I'm new to this forum and not too experienced)
Thank you
Sorry for not being detailed at the start.
Powering from the wall is not a problem. This power supply would work well: http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/73/Default.aspx?txtSearch=power+supply
I would consider a different mechanism for opening the door. It seems that it would be better to have a small hole in the wall separating the cricket chamber from the electronics rather than a slot that little crickets can get through. I would use a push rod to actuate the door. Much the same way as is used on RC airplanes to control the control surfaces.
Does it matter if the time off day gets shifted a bit each day? The Basic Stamp can keep approximate time. It will accumulate errors. For example, you might program it to actuate every 24 hours but in reality it may operate every 23 hrs and 55 minutes (gross estimate, I have no idea how much off it would be). After a few weeks it would be hours off. This may be of no consequence in this application. Also, you can tune your timing based upon observation to better match the real time.
another copy of the last 4 lines above to do this.
Never mind this post.
A couple minutes drift over a week (per Mike Green) is not horrible at all in my opinion, pretty good actually.
Servos, are very easy to use with a microcontroller.
I don't know how precise time kept by a Propeller wouild be but it should keep it will enough it keep your friends reptile happy.
You could use QuickStart board and use its LEDs as a binary countdown to feeding time. If the time were noticeably off, you could use the touchpads to correct the time.
I used the QuickStart's touchpads as inputs to control a servo in my QuickStart servo tester. I also used its LEDs as a way to indicate the various parameters of the tester.