Please help me isolate my Pin Inputs

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.

Thanks.

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.

Use S3 as an example to wire your switches.

No, pull-up resistors as explained. As "S3" above, but generally you can use the internal pull-up which is equivalent to about 45k.

Shouldn't. How are you determining this outcome?

Diodes should b]not be needed.

I agree that pulling up, and switch wired to ground is more usual, where did you "read it's better to use pull down resisters"?

a7

First, can't thank you enough

for all the help. This community is great.

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.


These are the converters I am using:

Yes, S3 is expecting dry contacts.

Your last circuit would suggest using: an Opto Isolator, a transistor switch or a relay that then supplies a dry contact to the Arduino.

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.

Select a chip that has CTR >= 100, a 4N35 is a reasonable selection.

If you rectify the AC, then the output of the circuit will be LOW/HIGH rather than 50/60 (100/120) Hz pulses.


Hi,

To facilitate our help, using the appropriate </> tags, post your code.

Since you didn't post any code, I'll infer that you didn't set these pins as "Input."

better way to use switches .

use too pinMode(xxxx, INPUT_PULLUP);

I added the optocoupler and the circuit works great, just as I hoped it would. Thanks again for everyone's help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.