Post by retrobits on Mar 22, 2008 21:25:28 GMT -5
Hi there,
My son and I are having some fun designing an intrusion alarm for his room. We're using a PICAXE 08M microcontroller and a NC magnetic reed switch from Radio Shack. But there is a bug or two in my design, and I would be thankful for some thoughts...
The reed switch is normally closed when the door is closed. The input line to the PICAXE is then typically 5V, which goes away when the door is opened. Leaving the input line "floating" when the door is opened didn't work, so I needed to use a pull-down resistor (to ground) to settle the input at 0 state when the door is opened. This part works. As with other pullup/pulldown resistors that I've seen, I used a 10K value.
When the door is opened, the PICAXE pauses 10 seconds, then starts beeping a piezo speaker (and that's working, too). But when the door is closed again, the PICAXE resets. It's not programmed to do that in my uC program. I'm thinking it's because the sudden flood of current from 5V through the pull-down resistor to ground is depressing the V+ to the point where the PICAXE gives up. Is that possible? I have a couple of small electrolytic caps on the power bus to try to keep it stable.
Also, if I'm doing my calculations right, 5V through a 10K resistor will burn about .5 milliamps of current whenever the door is closed. Is that right? It's currently just powered by a 9V battery (through a 5V regulator) - wonder how long that's gonna last.
I could try to find a normally-open magnetic switch; however, I'd still have the power surge problem (if that's what it is) whenever the circuit was closed.
I feel like I'm missing something really dumb here, since I'm essentially a newbie on this uC stuff, and my general electronics knowledge is beginning level also.
Circuit can be seen above (crudely drawn and with non-relevant details omitted)
Help? :-)
- Earl
My son and I are having some fun designing an intrusion alarm for his room. We're using a PICAXE 08M microcontroller and a NC magnetic reed switch from Radio Shack. But there is a bug or two in my design, and I would be thankful for some thoughts...
The reed switch is normally closed when the door is closed. The input line to the PICAXE is then typically 5V, which goes away when the door is opened. Leaving the input line "floating" when the door is opened didn't work, so I needed to use a pull-down resistor (to ground) to settle the input at 0 state when the door is opened. This part works. As with other pullup/pulldown resistors that I've seen, I used a 10K value.
When the door is opened, the PICAXE pauses 10 seconds, then starts beeping a piezo speaker (and that's working, too). But when the door is closed again, the PICAXE resets. It's not programmed to do that in my uC program. I'm thinking it's because the sudden flood of current from 5V through the pull-down resistor to ground is depressing the V+ to the point where the PICAXE gives up. Is that possible? I have a couple of small electrolytic caps on the power bus to try to keep it stable.
Also, if I'm doing my calculations right, 5V through a 10K resistor will burn about .5 milliamps of current whenever the door is closed. Is that right? It's currently just powered by a 9V battery (through a 5V regulator) - wonder how long that's gonna last.
I could try to find a normally-open magnetic switch; however, I'd still have the power surge problem (if that's what it is) whenever the circuit was closed.
I feel like I'm missing something really dumb here, since I'm essentially a newbie on this uC stuff, and my general electronics knowledge is beginning level also.
Circuit can be seen above (crudely drawn and with non-relevant details omitted)
Help? :-)
- Earl