Analog input connected to micro. Need digital circuit

Thread Starter

patelankur2603

Joined Jun 6, 2022
40
I am trying to connect a brown wire to micro. but as it is analog and need some circuit which will convert to digital values and then this can go as a input to micro pic33 input pin. If brown wire is connected to 0v or gnd , then micro state will change like low to high or high to low.
 

ericgibbs

Joined Jan 29, 2010
18,766
hi 2603,
If the micro pic33 has an analogue input, you could use that to detect the ADC level as a logic '0' or '1'.
It is a method I use.
E
 

BobTPH

Joined Jun 5, 2013
8,807
Or use a comparator to get a digital output from an analog signal. Some microcontrollers have comparators built in.
 

Alec_t

Joined Sep 17, 2013
14,280
What voltage range is the analogue signal? If it lies outside the micro's logic rails it will need conditioning.
 

Thread Starter

patelankur2603

Joined Jun 6, 2022
40
hi 2603,
If the micro pic33 has an analogue input, you could use that to detect the ADC level as a logic '0' or '1'.
It is a method I use.
E
Yes it has 3 ADC inputs, but only thing i need to understand is when i connect brown wire to ground how does it change the state , for that i need to use a switch or transistor as a relay so when it connects to ground micro recognizes the change
 

Thread Starter

patelankur2603

Joined Jun 6, 2022
40
What voltage range is the analogue signal? If it lies outside the micro's logic rails it will need conditioning.
12v dc voltage. given to wire. when it connects to ground means it should go short and then micro should recognize the chnage accordingly
 

BobTPH

Joined Jun 5, 2013
8,807
I am having trouble understanding what you want. You say the brown wire has 12V on it and you want to short it to ground? That’s s not generally a great idea.

Where is this brown wire coming from?
 

Alec_t

Joined Sep 17, 2013
14,280
Use a two-resistor potential divider to drop the mystery brown wire's 12V down to just below the supply voltage of your micro (5V or 3.3V or whatever).
 

Ya’akov

Joined Jan 27, 2019
9,069
Some questions:

What are you making?
What problem is it intended to solve? (Why are you making it?)
What is on the other end of the brown wire?

Is this schoolwork?
 

Thread Starter

patelankur2603

Joined Jun 6, 2022
40
I am having trouble understanding what you want. You say the brown wire has 12V on it and you want to short it to ground? That’s s not generally a great idea.

Where is this brown wire coming from?
i have attached the picture what i am thinking. A basic idea. I need to change state or trigger micro input which should be digital when a wire is shorted. Or given to 0 v
 

Attachments

BobTPH

Joined Jun 5, 2013
8,807
I think you are now saying that the brown wire is either at 12V or 0V and you want to detect which it is with a micro input. That contradicts your original post, which says it is an analog signal. An analog signal can take on any voltage in a range, A signal that can have only two values is a digital signal.

Simple. Use a voltage divider.

Assuming you micro us running at 3.3V:

brown goes to 26K goes to 10K goes to ground.

Now the junction if the two resistors is 3.3V when the brown wire is 12 and 0 when it is 0, This can be fed directly into the micro.

If the micro is running at 5V, the resistors could be 14K and 10K.
 

BobTPH

Joined Jun 5, 2013
8,807
You do realize that the micro can respond to either high or low signal, right? There is no need to invert the signal in hardware.
 

DickCappels

Joined Aug 21, 2008
10,153
Not following the golden thread of thought. From your description so far it sounds like you want an inverter.
would you please answer the rest of Ya’akov’s questions in post #10?
 

BobTPH

Joined Jun 5, 2013
8,807
Each post seems to give us a different idea of what he is trying to do. I now think he has a signal that is either 12V or 0V and want an inverted 3.3V signal as an input to a micro.

Of course it is silly to invert the signal before using it an input since the inversion can be done for nothing in software.
 
Top