Hi,
Noob here. I have the circuit below. When I close switch A, both Pin 7 and Pin 8 go high. Same result with switch B. I am using the pins as digital. I read it's better to use pull down resisters, but I can't figure how to wire the circuit that way.
I am using 100K pull down resisters and added the diodes thinking voltage was flowing back through the circuit. Those did not help.
Why don't you wire one side of the switches to ground and the other side to inputs and enable the internal pullups. They will read HIGH when not open and LOW when closed.
alto777 and Paul_B, my apologies. I meant 'pull-up'. That was a typo.
The project monitors an error light on 2 commercial boilers for a building and sends an email when the boiler enters an error. Email A for pin 7 and Email B for pin 8. I'm getting two sent emails when either switch is closed. That's how I determining this.
I think my confusion is that I don't have dry contacts for switching, unless I introduce relays. Doesn't LarryD's example use on-board power and dry contact switches?
Full Diagram is below (without pull-downs). I just want to make sure the inputs don't float high randomly. Is there a better way to trigger the Arduino from an external power source? All help is greatly appreciated.
Use an optocoupler, it can be directly driven by 24V AC, and although the input would likely be pulsing at 60Hz (or 120Hz), that would still be good enough to detect the presence/absence of the 24VAC.
The original circuit you posted does not appear to have any particular problems, more likely a coding error.
You guys are the best! I always wanted to know what an optocoupler was and what it was used for. Learned something new today. Gonna add an optocoupler (and remove the A/C-D/C converter) and let you know how it goes.
Thanks again.