Two 12V input detect on one analog input

My problem is that I want to detect the appearance of two 12V voltages that appear independently in my car. Specifically: 1) 12V of antenna amplifier when radio is turned on and 2) 12V of reversing lamp when switching back. I want to detect these two signals somehow. Of course, it is possible for both signals to appear at the same time. At first I thought I was going to connect one of them to 1,2V for the 100kOhm resistor and the other for the 3.3 zener diodes. The problem is that I cannot detect the appearance of the two signals together, but only the signal connected to the larger music. Is there any good solution for this? Hardwer and software solutions are also of interest.

I think you're in the wrong part of the forum, but whatever....

Why the limitation to read them on the same input? And why an analog input?

option 1: get an optoisolator, AKA optocoupler
option 2: get 2 5k pots, or make voltage dividers

@Geek Emeritus

I would request you change your tag please.

neiklot:
I think you're in the wrong part of the forum, but whatever....

Why the limitation to read them on the same input? And why an analog input?

Analog input can add more values, so I could decide which signal appeared on the input based on the connected voltage. I just need to know if the +12 V stands for that output.

lzh6k4:
I could decide which signal appeared on the input based on the connected voltage

You said they're both 12V, which you can't use anyway on an Arduino, so if you used a divider or an opto you'll still see 5V for either, and you said that they can be simultaneous, so I'm not understanding.

Why not just stick each one on a digital pin through an opto as suggested, and read both pins.

Kind of a DAC could help. In the simplest case it's a combination of 2 voltage dividers, with a common resistor to Gnd and different individual resistors to each input. E.g. 10k to Gnd, 33k to input 1 and 47k to input 2.

Hi,
You have two inputs, what do you want to have happen when;

1); INPUT ANTENNA is 0V and INPUT REVERSE is 0V

2); INPUT ANTENNA is 0V and INPUT REVERSE is 12V

3); INPUT ANTENNA is 12V and INPUT REVERSE is 0V

4); INPUT ANTENNA is 12V and INPUT REVERSE is 12V

What is the OUTPUT.

You do realise you can make circuits with 2 independent INPUTs?

Thanks..Tom.. :slight_smile:

A voltage divider like this might work, with 12V on inputA, output would be about 3V, on B,about 1.77V and both, 4.05.
ADC values, about 620, 362 and 829.

void loop()
{
  bool inA = false, inB = false;
  
  int val = analogRead(A0);
  if(val > 721)
    inA = inB = true;
  else if(val > 488)
    inA = true;
  else if(val > 181)
    inB = true;
}

div1.png

The diodes simplify calculations but are not really required for level shifting. See R2R ladder in a DAC.

Diodes are for anti backfeed, JIC (that's "Just-In-Case", not Joint Industry Convention). :slight_smile:

what that is, is a discrete component OR gate

Logic gates usually provide a logical output signal, nothing analogue.

Why not take two minutes, build the circuit, load the sketch and see if it does what the OP wanted?

Hi,
I think until @Izh6k4 replies to anymore questions, any solutions are rather pointless.

Tom.... :slight_smile:

A rather universal observation. :grinning:

But now we have started, my concern is that so far, suggestions (other than the optocouplers, which is probably the best idea) do not take variations in battery voltage into account. I was going to bite my tongue, but - here goes!
Selection_004.png
D1 and D2 clamp the voltages to Vcc - 5 V - which is ARef so that analog readings are ratiometric and durable thresholds can be set. They also provide protection. Of course, the procedure is to assemble the circuit and use a test program which outputs the analog values to the serial monitor as the various (four, actually) input combinations are exercised. You these set thresholds halfway between the measured values.

Selection_004.png

neiklot:
You said they're both 12V, which you can't use anyway on an Arduino, so if you used a divider or an opto you'll still see 5V for either, and you said that they can be simultaneous, so I'm not understanding.

Why not just stick each one on a digital pin through an opto as suggested, and read both pins.

I have only one free analog input.

Hi,
You have two inputs, what do you want to have happen when;

1); INPUT ANTENNA is 0V and INPUT REVERSE is 0V

2); INPUT ANTENNA is 0V and INPUT REVERSE is 12V

3); INPUT ANTENNA is 12V and INPUT REVERSE is 0V

4); INPUT ANTENNA is 12V and INPUT REVERSE is 12V

What is the OUTPUT.

You do realize you can make circuits with 2 independent INPUTS?

I have only one free analog input.

Do you realize if you are only looking for ON and OFF 12V signals you can use DIGITAL INPUTS?

Thanks..Tom.. :)