Vibration Circuit To Turn On Led, When Circuit Is Open.
Tony11
Posts: 41
Hi
I need some help on programming the BS2 to use the (ZD02) vibration switch sensor and one led with resistor. When it is done, vibrating it will turn on the led for 3millsec. So what I am trying to do is. Set the BS2 and the vibration circuit and the led on A running motor. When the motor is turned off,(witch means the vibration switch is not moving) the led will turn on for 3millsec. Then the BS2 will reset, (So the motor is on and vibrating, the BS2 reads this using the vibration Switch, when the motor is stopped and not running the vibration switch will be off, the led will come on for 3millsec, then the BS2 will reset till, the motor is turned on running and then off.)
Can this be done with the BS2 ?
=: The http, that I have at the bottom of the page is the vibration switch sensor, that I would like to use.
http://www.aliexpress.com/product-fm/500825000-wholesale-ZD02-vibration-switch-sensor-module-for-smart-car-free-shipping-wholesalers.html
I need some help on programming the BS2 to use the (ZD02) vibration switch sensor and one led with resistor. When it is done, vibrating it will turn on the led for 3millsec. So what I am trying to do is. Set the BS2 and the vibration circuit and the led on A running motor. When the motor is turned off,(witch means the vibration switch is not moving) the led will turn on for 3millsec. Then the BS2 will reset, (So the motor is on and vibrating, the BS2 reads this using the vibration Switch, when the motor is stopped and not running the vibration switch will be off, the led will come on for 3millsec, then the BS2 will reset till, the motor is turned on running and then off.)
Can this be done with the BS2 ?
=: The http, that I have at the bottom of the page is the vibration switch sensor, that I would like to use.
http://www.aliexpress.com/product-fm/500825000-wholesale-ZD02-vibration-switch-sensor-module-for-smart-car-free-shipping-wholesalers.html
Comments
So the answer to your question would be yes, it can be done with the BS2.
Setting the sensor's sensitivity to the vibration of your motor would be the only tedious part. Might need a scope for that.
BTW - the BS2 doesn't have to be set on the motor. In fact, it might be better to position it off the motor in case the motor outputs a lot of heat. And that raises the question: what type of motor are you using?
Regards...
What kind of motor do I want to put the sensor on. I have A Maytag Dryer, that I want to know when it stops running. So the vibration switch sensor and the BS2 will set on the Dryer. When the vibration switch sensor knows when the dry is done, then the BS2 will turn the led on for 3millsec. then off.
Pins one BS2
(Vibration Switch = Pin1)
(Led = Pin5)
' SimpleDryerSensor.bs2
'{$STAMP BS2}
'{$PBASIC 2.5}
x VAR Word
DO
PULSIN 1, 1, x
DEBUG CLS, ? x
PAUSE 100
ELSEIF (x < 300 ) THEN
PAUSE 50
LOOP UNTIL (x = 0)
HIGH 5
PAUSE 30
LOW 5
ELSE
PAUSE 50
LOOP
So this is what I am shooting for is =
When the dryer is off and BS2 and vibration switch sensor are on and setting on top of the dryer.
(Led is off)
When the dryer is on and running.
(Led is off)
When the dryer is on and running and then it stops.
(Led is on for only 3millsec. then turns off)
Thank You
IIRC, the vibration senso outputs a "1" or "0", not a pulse train. So setting Pin 1 to be an input, and then checking it to see if it's LOW would be sufficient.
I'm not sure what you intended with the ELSEIF and LOOPING until x is zero.
Also, if you're depending on actually seeing the LED light up with 3 milli-seconds of on-time, you're gonna miss it. Unless you're going to use that signal to drive something else.
What I want to do is, when the dryer is off the Vibration Circuit is off. When the dryer is running the Vibration Circuit, it's output is 1. But the output, goes to 1 then 0 then 1 then 0. It flip flop's between 1 and 0. That is why I thought to use A pulse train, So it would have to start at 300 pulse's when the dryer is on and then sit there till the dryer goes off. wait untill 100 pulse's. Then the led would blink.
All I am looking to do is, watch for the dryer to turn on in the program and watch for it to turn off, then blink A led. It sound easy, but it's not.
Looking again at the schematic, at adding some capacitance (experiment with the values) across the 104 cap may help in providing a static level.
Do you have an oscilloscope to view the output of the sensor board?
is moving A little bit, it will turn power on, and sitting still it is off.
Maybe a Forum Wizard can chime in and make a suggestion.
Forum's.
You're welcome Tony...although I regret that we weren't able to resolve this.