Forgot your password?
No account? Register one!
June 20, 2009
Product SEN-08630 |
about 5 years ago
This is normal : you’re supposed to use a “pull-up” resistor, meaning that it should be connected to the positive +5v and not to the ground as you did.
When the alarm is OFF, the sensor’s Alarm pin will behave as an open circuit (i.e it will behave as if it’s not there) and so your microcontroller analog input pin will end up connected to +5v through the resistor. If you read the analog value of your analog pin at that time, it will probably show up as 1023 if you’ve got a 10bit analog-to-digital sampler for instance.
When the alarm goes ON, the sensor will “pull the pin to the ground”, meaning that inside itself it will connect the alarm pin to the ground. This is where the resistor part comes in : current will always flow through the path of least resistance, so instead of going to the +5v as before (because the resistor is in the way), the microcontroller pin also ends up being connected to the ground.
On your analog-to-digital conversion, you will then see a low value and you can test against that in your code to make the alarm ring (or something).
No public wish lists :(