Switch wiring

I am from IT background so I don't have much knowledge on electrical. This is maybe a very simple question. I want to connect a switch to act as a master "on/off" to the IND.IO. If the switch is off, the program in loop will not be executed. According to arduino samples, I should use pull down resistor to get rid of the "floating" state in the digital input pin. Is it the same in IND.IO-1286? The switch has two NO ports and both ports will be connected when the switch is on. I am thinking to connect +V from power supply to first NO port and second NO port to one of the IND.IO digital pin as INPUT. Will it work? I want it to send signal HIGH (24Vdc from psu) to the input pin when the switch is on but worry I would damage the IND.IO if I wire it wrongly. The same power supply is used to power up the IND.IO. Please kindly advise. Thank you =)

Albert Tobing
Albert Tobing
12
| 0 0 0
Asked on 10/9/16, 5:39 AM
0
vote
479 Views

Hi Albert, the wiring you describe is correct, you can connect the 24V of your PSU to a digital I/O channel of the IND.I/O via your switch. As far as i know, the best way would be to first declare the channel as digital output, write LOW to it, then change it to digital input, e.g. in the setup of your sketch.

Tom
on 10/9/16, 11:17 AM

Hi Tom. So there is no need to connect any resistor in between the psu and digital input? I can connect V+ from psu straight to digital input when switch is on?

Albert Tobing
on 10/9/16, 4:43 PM

Hi Albert, that's right, you don't need a resistor between PSU and digital I/O. But as Stefano mentions, it's probably a good idea to use GND for your switch instead of 24V; define the channel as digital output, write HIGH (to enable the pull-up resistor), change the channel to digital input and read LOW when the switch is on.

Tom
on 10/11/16, 1:04 AM

Hello Albert,

I usually do the opposite for the very reason you state.

I write HIGH on the input to enable pull-up resistor and then connect the switch between the I/O and GND.

This way I feel more safe against mistakes.

But either way is just fine.

Stefano Giuseppe Bonvini
Stefano Giuseppe Bonvini
567
| 0 0 0
Answered on 10/9/16, 4:31 PM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

30 follower(s)

Stats

Asked: 10/9/16, 5:39 AM
Seen: 479 times
Last updated: 10/11/16, 1:04 AM