Read External Button with Arduino Analog Pins

BACKGROUND:

I'm trying to intercept the signal from a externally powered button using an Arduino Mega 2560. The button connects to an DC external device with 4 lines:

Button External Device (DC)
O------------------ Red ------------------------O
O------------------ Black ----------------------O
O------------------ Yellow ---------------------O
O------------------ Green ---------------------O

Red and black are hot and return lines that supply the button with constant power (because it has an LED inside).

I've identified that potential difference from the green (+) to yellow (-) line is

  • 1.7 volts when not pressed
  • 0 volts when pressed (ie button closes circuit)

These lines aren't grounded, so I'm trying to read the difference with analog pins A14 and A15 connected to the green and yellow line respectively, through 1M ohm resistors.

PROBLEM:

Whenever I connect the A14 pin to the yellow line, it confuses the external device and disables the button.

I don't quite understand how the analog pins read voltage. Is what I'm doing possible? And if so, how? Thanks!

What voltage is on the red and black lines?

Shouldn't you be measuring the voltage between the Yellow and black and the Green and black?

If you have a link to the datasheet for your device please post it.

In any case, tell us what the device is.

...R

Thanks for the response Robin2!

That's what I initially thought as well, but I think the red and black lines are meant to not be interfered with. Every time I connect to the black line it shorts the circuit.

I wish I could help you out with a datasheet, but it's a custom PCB. I'll get back to you if I can get.

blairallday:
Thanks for the response Robin2!

That's what I initially thought as well, but I think the red and black lines are meant to not be interfered with. Every time I connect to the black line it shorts the circuit.

I wish I could help you out with a datasheet, but it's a custom PCB. I'll get back to you if I can get.

Can you take a high resolution, well focused picture of both sides of the circuit board, as well as the connectors? Your description is confusing to me, and a visual reference might help. Sounds as if it may be malfunctioning. Connecting a ground to the ground wire should not disable the device.

blairallday:
Every time I connect to the black line it shorts the circuit.

What are you connecting to the black line? A multimeter set for measuring voltage could not cause a short circuit. Nor could an Arduino I/O pin set as INPUT.

...R

Here's a link to a gdrive with some images of the PCB.
https://drive.google.com/open?id=17m56AQSdA9G-cEwOW_kqIYQVuLzyllcP

Here are the measurements I took with a multimeter:

  • Red (+) to Black (-): 0.40V

  • Yellow (+) to Black (-): -1.60V

  • Green (+) to Black (-): 0.10V

  • Green (+) to Yellow (-): 1.8V [Button Not Pressed]

  • Green (+) to Yellow (-): 0V [Button Pressed]

When I try to measure these lines to the Arduino ground, the reading fluctuates in the mV range.

When I attach an analog pin to one of these lines, it confuses the PCB (lights go off, button doesn't work).

Since the yellow to black voltage is negative, I think the green and yellow lines form a loop that's independent from the red and black lines.

Thanks for the help!

You have the board, you have a multimeter. Start measuring what is connected to what and draw a schematic. Once you have the schematic, it will probably be clear how you can intercept the signals.

PS (after Robins new reply below)
Can you identify the 16 pin chip net to the coloured connectors?

What is the board intended for?

What is normally connected to it?

What does the print on the board mean - for example "P001"

How was the board powered when you were measuring the voltages?

...R

Thanks for the pictures. That board is like an Arduino with a bunch of connectors - there is an onboard ATMega328p, and a 16 MHz crystal. Reverse engineering it will be non-trivial. You need to search for documentation.

Thank you all for the help!

I think it's going to be tough figuring out whats going on in the PCB in respect to both the hardware and software.

I was doing some research and stumbled upon the ADS1115 Differential Voltmeter, which measures differential voltage without needing to reference Arduino ground potential.

Have any of you used it? And do you think that will measure the voltage across the green and yellow lines without affecting the circuit?

Cheers,
B

blairallday:
Here's a link to a gdrive with some images of the PCB.
https://drive.google.com/open?id=17m56AQSdA9G-cEwOW_kqIYQVuLzyllcP

Here are the measurements I took with a multimeter:

  • Red (+) to Black (-): 0.40V

  • Yellow (+) to Black (-): -1.60V

  • Green (+) to Black (-): 0.10V

  • Green (+) to Yellow (-): 1.8V [Button Not Pressed]

  • Green (+) to Yellow (-): 0V [Button Pressed]

When I try to measure these lines to the Arduino ground, the reading fluctuates in the mV range.

When I attach an analog pin to one of these lines, it confuses the PCB (lights go off, button doesn't work).

Since the yellow to black voltage is negative, I think the green and yellow lines form a loop that's independent from the red and black lines.

Thanks for the help!

All voltages are relative to ground. If Arduino ground is not the same as the ground of what you would test then who knows what the either end sees?

GoForSmoke:
All voltages are relative to ground. If Arduino ground is not the same as the ground of what you would test then who knows what the either end sees?

Not true.

Many of the Atmega chips such as the 2560 (but not the 328) can measure differential voltages - the voltage between two of the analog pins. Many of the chips also have amplifiers so that they can measure very low voltages. Neither of the pins needs to be referenced to the Arduino GND. IIRC the only constraint is that the voltage between the two pins must not exceed 5v. RTFM.

Of course I am assuming that the differential voltage is quite separate from the Arduino GND - for example powering it with one battery and measuring a circuit powered by a different battery and with no common connection between the circuits.

...R

blairallday:
I think it's going to be tough figuring out whats going on in the PCB in respect to both the hardware and software.

That software part is new. From your opening post, you wanted to intercept the signal; and that can easily be done once you have an understanding of the board. The board has 5 similar groups of connectors (POD1 .. POD5); once you have figured out one, the others will with high probability be similar.

Next determine the type of the 16 pin chip; I suspect that it's a multiplexer.

Is you yellow connector the only one connected to the board? Or do white, blue and red also have connections to your external device(s)?

The 2560 can treat one analog pin as ground and measure another relative to that?

You can use a low Vref to measure small voltages on any AVR. Suppose I fed one input to Vref and the other to the analog pin?
LOL, I suggested that to get the difference between light detector reads just days ago.

RTFM? For what voltage is, my manual is a physics book. Depending on the device and environment, device ground may change relative to earth ground or other device grounds wildly.

GoForSmoke:
The 2560 can treat one analog pin as ground and measure another relative to that?

I would not use the word "ground". Ground has a special meaning related to the Atmega's power supply.

In my earlier post I just said that it can measure the voltage difference between two analog pins.

If you don't believe me read the datasheet and try it. Connect a low voltage battery between the appropriate analog pins without making ANY connection between that battery and the Arduino GND. I learned about it from this Youtube video and I have tried it.

...R

Robin2:
I would not use the word "ground". Ground has a special meaning related to the Atmega's power supply.

In my earlier post I just said that it can measure the voltage difference between two analog pins.

If you don't believe me read the datasheet and try it. Connect a low voltage battery between the appropriate analog pins without making ANY connection between that battery and the Arduino GND. I learned about it from this Youtube video and I have tried it.

...R

I believe you. The appropriate analog pins let you measure electrical potential between them.

That's not the same as feeding power to one analog pin without connecting ground between the board and the power source.

GoForSmoke:
I believe you. The appropriate analog pins let you measure electrical potential between them.

That's not the same as feeding power to one analog pin without connecting ground between the board and the power source.

I find your use of language a bit confusing. Your second paragraph conjures up one-hand clapping. But I think you just mean the more usual mode in which a single analogue pin is used to measure a voltage by reference to Arduino GND.

...R

Robin2:
I find your use of language a bit confusing. Your second paragraph conjures up one-hand clapping. But I think you just mean the more usual mode in which a single analogue pin is used to measure a voltage by reference to Arduino GND.

...R

The second one is what the OP's earlier schematic showed which is why I tried to explain why to connect the grounds, so the volts will be on the same scale, all relative to the same ground.

GoForSmoke:
The second one is what the OP's earlier schematic showed which is why I tried to explain why to connect the grounds, so the volts will be on the same scale, all relative to the same ground.

I'm not sure where the schematic is but I have just been trying to point out that for measuring very small voltage differences there is the option of using the differential voltage facility and the associated amplifier within a suitable Atmega MCU.

...R

What kind of output do you get?

If I know that one line will be higher potential, I'd put in on the Vref pin and get 10 bits of the other on an analog pin on any Uno.