# Reading Digital and Analog Signal from Different Sources with Arduino

I am using an Arduino to read signals from 2 different devices. (This is an automotive project so all 3 are powered by the 12v battery of the car).

The signal from one of the devices is a digital High/Low - where Low is 0v and High is 5V (I've verified this with a meter).

The signal from the other device produces a 0v min, 8.4v max square wave. I am using a 1k and 1.5k resistor to drop the square wave to 0-5v in order to safely read the analog signal with the Arduino. I am using the FreqMeasure library to read the frequency of the square wave so since that library requires the input to be pin 8 of the Arduino, that's where the output of the voltage divider is going.

Here is the schematic for the input of the circuit:

The "RADIO_INPUT" of the schematic is the analog signal via a 3.5mm jack. The "BACKUP_INPUT" is the digital signal also via a 3.5mm jack.

When only 1 of the inputs are connected (for example: just the digital signal, or just the analog signal) everything works exactly how I expect.

But when both of the inputs are connected I get results that I wasn't expecting. I plugged in an oscilloscope to Pin 8 and Ground of the Arduino and when the digital connection was plugged in the analog signal goes to a 2-5v range instead of 0-5v. As soon as I unplug the digital signal it goes back to the 0-5v range as expected.

On the other side, when I connect the oscilloscope to the digital input I read the same analog frequency as I see from the analog signal except in the 0-2v range. Again when I unplug the analog input the digital input works exactly as expected and I just see the 0v Low, 5v High signal.

What appears to be happening is that the signals are somehow contaminating each other but I don't understand why. I assume that there's a problem connecting the grounds but I'm not sure what to do to keep the signals separated.

So my question is: is there anything I need to do to somehow isolate these 2 different signals so that they don't effect each other? Or am I missing something fundamental with reading in these 2 different kinds of signals?

Thanks!

• Your grounds look OK as drawn but I suspect that there is a power-supply problem and you haven't shown any details of it. Update the schematic showing the car battery, voltage regulator and decoupling capacitors. – Transistor Mar 9 at 21:00
• Just to be clear, does the circuit work when the oscilloscope is not connected to it? Are you certain that the "grounds" of both of your inputs are actually connected to the chassis? – Elliot Alderson Mar 9 at 21:04
• @ElliotAlderson I have pulled out one of the cigarette lighter plugs and am using that as the power source of the two devices. So I don't think they are connected to the chassis but to the battery ground. I have tried powering the Arduino through the 12v port from the same source and also from my computer usb with the same results. I get the same results with the oscilloscope disconnected. – LOP_Luke Mar 9 at 22:14
• @Transistor There is no voltage regulator or decoupling capacitors. What would the decoupling capacitors be for? – LOP_Luke Mar 9 at 22:18
• The Arduino microprocessor runs on a 5 V supply so there has to be a voltage regulator to run it from the 12 V vehicle battery. The fact that you think there is none suggests that you are using the built-in regulator. The capacitors will protect against noise and provide voltage regulation stability. Many new users treat them as a kind of optional extra so I usually ask to see them. – Transistor Mar 9 at 22:41