Can i wire a toggle switch 15 meter away from my arduino pin

hello there , i am doing an alerting system in the factory . there is 40 production lines aliened in a shed and these production lines are lied in 90 meter area. what i want to design is there will be a two push buttons in each line which can be pressed to alert a maintenance team and quality team which will be far 120 meter away . I was thinking using an Arduino for receiving the input from each lines and displaying them .
now my doubt is I will have to connect some of the push buttons 15 meter apart from the Arduino board . and I am not sure if that is possible to do without issues like voltage drop and noises .
any help would be appreciated

I do not know your skills and abilities. I can wire a switch 1000's of meters away from what ever but would I do it? No.

If large distances are involved like what is described, I'd consider using WiFi enabled MCU's and have them transmit their signals over WiFi to a central unit that receives and process those signals. No wires.

Basically, I'd setup a MQTT Broker as my central computer. I'd run Node-Red on the central computer to access the MQTT info and I'd use ESP32's as my MCU's

For a pushbutton you should be fine in most cases (don't route the wiring close to large motors, fluorescent lights, anything switching high voltage etc). A solid 100 ohm pullup to +5 and a 0.1uF capacitor across the digital input with the button wired between input & GND and you should be OK.

So, electrically you'll be OK. However, that will be a lot of wiring, so what Idahowalker suggests might end up being a better solution. Properly installing cable can be a lot more expensive than it seems at first glance and the 15m distance can become 100m once you get the wiring routed properly.

yes dear , i also implemented similar way for one production line i used a esp8266 for the production line transmitter and a raspberry pi server connecting using a local area wifi . these method worked successfully , but when i propose the automation for full 40 production lines management didn't agree because of the price . i am based from Ethiopia where systems like the amazon dont work and a single Arduino board costs ETB 2,600 which more than $50 because its not readily available in the market. so yes there are better ways but the resource and price is what is driving me this way.

thanks for the confirmation, each line will be with two buttons one for maintenance ad one quality alert , i will have to connect 7 lines to one Arduino board that is 14 switches connected to the Arduino 15 meters apart. i am hoping there wont be issues with current and resistance of the wires

Current and resistance will not be a problem over 15m, interference might be.

Make sure you use twisted pair cable, for example cat 5 or telephone cable. Make sure each switch is on its own pair, do not spilt a pair up.

1 Like

I worked in the School of EE Research back in the mid-70's. We did a project similar in conjunction with a textile company. The host was not a uC but a dedicated brewed-logic board.

  • Expect lots of noise in the cable runs
  • Expect issues with (legally) running wires on a manufacturer's machine due to warranty & support concerns
  • Expect to be required to pay a licensed electrical installer to run low-voltage cable to comply with liability insurance and local licensing laws.

The best approach is likely optical-isolation... essentially a LED with a phototransistor in a single housing. By setting a digital pin with internal pullup, the phototransistor easily pulls the "high" pin "low". The LED section of the isolator is also very forgiving of electrically introduced wiring noise.

1 Like

And then if everything is done, hope that there won't be any lightning.

1 Like

Electrical code would require the machine frame to be properly grounded and twisted pair Plenum cable run on/around machine should be no concern. Local electrical code may require conduit.

Yes. Assuming that these guidelines will in fact be adhered to...

Yes.
Even in the U.S. local and State laws differ from the National rules.

My biggest concern is ensuring that a licensed and insured professional is involved as commercial projects may negate safety and liability (insurance) claims. Homebrew additions can run into all manner of obstacles in a commercial setting. Even worst in a Union shop as additions to procedures can run afoul of labor agreements.

I get the feeling that Ethiopia may not have all those problems.

That doesn't really solve anything. There's no real isolation, since they're already using a common ground and in post #3 I told OP to use a 100ohm pullup on the input.

Legal and license won't be an issue and as far as safety is concerned the company has a problem installed earthing so all the machines are properly grounded.

Thanks, I did researching on this method. But material is also another concern in Ethiopia
I found only this opto isolator "pc817" . I am thinking if I use a 12v 5A power supply running through the switches and the turning on the Optocoupler which in turn signals the Arduino.
And I was looking on the data sheet for the Optocoupler and its say input current maximum of 60ma any idea on choosing the right value of resistor so that I won't fry the Optocoupler

Correct

Any idea on how to use pc817 Optocoupler with a 12v5A power supply in the led side

Ohm's Law: E = I * R

one little twist, E is the supply voltage - LED voltage drop
(remember, calculate a current under max)

Vd of LEDs is color dependent, but I use red for optocouplers unless you have a detailed spec sheet... about 2 Volts.

[