#### 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
19,118
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
9,284
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,411
What voltage range is the analogue signal? If it lies outside the micro's logic rails it will need conditioning.

#### 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

#### 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
9,284
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,411
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,265
Just a point, the color of the wire’s insulation doesn’t matter.

#### Ya’akov

Joined Jan 27, 2019
9,265
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?

#### 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

• 1.5 MB Views: 17

#### patelankur2603

Joined Jun 6, 2022
40
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?
simple way to toggle high and low state using a wire when connected to ground

#### Alec_t

Joined Sep 17, 2013
14,411
What is providing the 12V on the brown wire?

#### patelankur2603

Joined Jun 6, 2022
40
What is providing the 12V on the brown wire?
i can use 3.3v to wire and change states using transistor, but not clearly dont know how i would connect it to mcu unit.

#### Alec_t

Joined Sep 17, 2013
14,411

#### BobTPH

Joined Jun 5, 2013
9,284
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.

#### patelankur2603

Joined Jun 6, 2022
40
What is providing 3.3V to the wire?
3.3v should be active when brown is connected to the ground. if not grounded, normally it should be 0v.

#### BobTPH

Joined Jun 5, 2013
9,284
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,246
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
9,284
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.