Brightness controlled servo
vipervick
Posts: 6
Hi all,
I am trying to use my BASIC STAMP kit to control window blinds. Sensing light with a photo-transistor, I want to control a servo to open or close window blinds.
I've done the separate activities to move the servo and sense light. But, putting them together is kicking my butt.
Any tips or suggestions would be highly appreciated, thanks!
I am trying to use my BASIC STAMP kit to control window blinds. Sensing light with a photo-transistor, I want to control a servo to open or close window blinds.
I've done the separate activities to move the servo and sense light. But, putting them together is kicking my butt.
Any tips or suggestions would be highly appreciated, thanks!
Comments
Anyone is going to ask you for more information. Could give more detail as to exactly what is doing the butt-kicking? Possibly making your code available for review? Stuff like that.
Regards
I have my Homework Board set up now with the photo-transistors Anode connected to P2 through a 0.1uF capacitor and 220 ohm resistor. And I have the servo control line connected to P13.
I'm trying to wrap my head around connecting the output of the PT to the servo control line. Will post code when I get home.
A few questions. Where is your phototransistor, inside the room (behind and affected by the blinds) or just looking out of your window, unaffected by the blinds (I'm assuming this)? Did you want them to open slowly and proportionally to try to maintain a constant light level in the room, or just snap open and shut at a certain outdoor light level (I'm assuming this)? At any rate, you want to avoid oscillation and freakish performance. Google hysteresis and damping.
Let's look at your code. Your PAUSES are too long, since servos need a constant stream of pulses at ~50 hz. Looks like you're aware that DEBUG commands take too long, although they are useful in testing to determine what your range is for variable "time" (which I changed to "light" below). You just want a small, fast loop to read your photocell (use a small capacitor to minimize read time), do whatever math is necessary to calibrate the value returned to send one calibrated servo pulsout, something like below. Note that it is format checked, but untested.
That's probably because I slipped in and deleted the post after you received the notifcation copy.
I sitll haven't had enough coffee to think it through....and the most excellent Erco has responded in great detail.
viper - I took the liberty of modifying your previous post with the "code /code" tags.
Edit the message and you'll see how they are used. It definitely helps maintain the format.