0
\$\begingroup\$

I have a main PCB and 3 button boards. You can see the connection at bottom from my ugly paint sketch. Each button board has 2 push buttons and a power LED. One of the buttons is switching GND and other one is switching 24V. Power and button signals goes together with a CAT6 cable.

Ugly paint schematic

The main PCB includes a PIC microcontroller.

Main PCB input circuit for buttons here:

enter image description here

TS for GND switching buttons, ST for 24V switching buttons. To the right side is a ULN2003 connected to the microcontroller with pull-ups.

Buttons

I tested the circuit with a short cable and it worked. When I tried with longer cables, it fails sometimes.

The main PCB reads a button pressed without the button being pressed.

I also tried to add pull-down resistors on the input side of the main PCB of 24V switching buttons. It is increased accuracy but sometimes still fails.

I can change the main PCB very little (like adding pull-up, pull-down resistors) but not much. I am free to makr changes on buttons.

It may be a basic problem but I could not figure it out. I am open to any solution for proper working buttons.

Edit: I know there is little information but I can not find the cause of the problem.

\$\endgroup\$
7
  • 3
    \$\begingroup\$ "it fails sometimes" is not a sufficient report in an engineering context \$\endgroup\$ – Chris Stratton Sep 2 '20 at 13:29
  • \$\begingroup\$ Not much we can suggest with that description. It could be a poor connection on the cable at either end or a faulty switch. You could monitor the voltage during a button press to see if anything funky happens when the button press fails, this could suggest a potential issue somewhere else. \$\endgroup\$ – Jack Soldano Sep 2 '20 at 13:38
  • 1
    \$\begingroup\$ Take oscillograms of button presses, see if you can identify a pattern with the ones that don't work. Add that to this question and we'll be able to help more. \$\endgroup\$ – Hearth Sep 2 '20 at 13:46
  • 1
    \$\begingroup\$ Your problem may be a software issue. Like other's have said, you'll need to use a scope and monitor each buttons output where it enters the micro-controller. If that looks good then you can rule out a hardware issue. Then you'll need to examine the code. \$\endgroup\$ – David Sep 2 '20 at 14:15
  • \$\begingroup\$ Think about what happens at \$t_0\$ between C1 and C21-26 when any button is pressed - these capacitors get shorted together, and a huge current flows through the cable for a very short amount of time, likely inducing voltages into other wires and being read as false keypresses. I'd move C21-26 to after R20-26 and greatly reduce their value. \$\endgroup\$ – rdtsc Sep 2 '20 at 14:27
2
\$\begingroup\$

You need pull down resistors on your ST lines.

Your buttons switch between open and 24V.

The ULN2003 is made of Darlington transistor pairs. It takes very little current to make them switch. Any stray current induced on the ST lines when the buttons are open will cause the ULN2003 to switch its output to high.

I'd try 10k resistors on the ST lines, preferably on the main PCB.

Once you fix that, you may want to look into software debouncing for all of your inputs.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.