ADC measure negative voltage??
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
ADC measure negative voltage??
Hi, I'm trying to use pyboard measure negative voltage. Is it a way to do so? I can add circuit if needed it.
please help..
please help..
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
Re: ADC measure negative voltage??
never mind, looks like just need add two resistors for voltage divider.
Re: ADC measure negative voltage??
A voltage divider can only be used to scale a voltage down. i.e. you cannot change its polarity.
Negative voltages (i.e. below your microcontroller's ground) could damage the microcontroller.
Can you describe what you're doing in more detail and we can give you some hints.
Negative voltages (i.e. below your microcontroller's ground) could damage the microcontroller.
Can you describe what you're doing in more detail and we can give you some hints.
Re: ADC measure negative voltage??
Depending on the range of the negative voltage and it's impedance, a voltage divider may work, just between Vdd-ADC_Input-Sensing_Input instead of GND-ADC_Input-Sensing_Input. Don't forget to add a protective Diode to the input, so it cuts off negative voltages.
Re: ADC measure negative voltage??
I have used the method suggested by @roberthh. Here's how it works. Say you want to measure down to -12V.
Make a 5:1 voltage divider, eg 10k and 40k. Connect 10k between Aref (3V3) and ADC input. Connect 40k from ADC input to negative voltage.
When Vin = 0V ADCin = 3.3 - (3.3 + 0)/5 = 2.44V.
When Vin = -12V ADCin = 3.3 - (3.3 + 12)/5 = 0.24V.
Make a 5:1 voltage divider, eg 10k and 40k. Connect 10k between Aref (3V3) and ADC input. Connect 40k from ADC input to negative voltage.
When Vin = 0V ADCin = 3.3 - (3.3 + 0)/5 = 2.44V.
When Vin = -12V ADCin = 3.3 - (3.3 + 12)/5 = 0.24V.
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
Re: ADC measure negative voltage??
I have two 100k resistors.
r1.pin1 connect to 6v.
r1.pin2 connecto to r2.pin1 - adc read at this point.
r2.pin2 connect to somewhere close to -3v(voltage going to measure).
so negative voltage = r1.pin2 v - (6v - r1.pin2 v)
r1.pin1 connect to 6v.
r1.pin2 connecto to r2.pin1 - adc read at this point.
r2.pin2 connect to somewhere close to -3v(voltage going to measure).
so negative voltage = r1.pin2 v - (6v - r1.pin2 v)
Re: ADC measure negative voltage??
Intuitively, with two 100k resistors, your ADC pin will be at the midpoint (i.e. the mean) between 6V and the voltage you're measuring.
So when the voltage is -3V, then you have 9V across the divider and so 4.5V across each resistor. So now your ADC is at 4.5V below 6V.
But yeah, don't forget the clamping diodes if you think that the input can go below -6V (or above 4V).
This is all assuming your negative voltage is referenced to the same ground etc.
Re: ADC measure negative voltage??
I think there is a typo in your formula. With 100k resistors you will need a small cap on the ADC input as switched cap ADCs will draw transient current spikes from the inputs.
You don't say what MCU you are using but some STM32 ADC pins are completely intolerant of voltages outside supply and GND so use a Schottky diode pair like BAT54S to clamp to Vss and CDs.
You don't say what MCU you are using but some STM32 ADC pins are completely intolerant of voltages outside supply and GND so use a Schottky diode pair like BAT54S to clamp to Vss and CDs.
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
Re: ADC measure negative voltage??
thanks for advice, is good idea to add diodes.
currently works well, is very accurate, just wondering is it any bandgap reference pin on pyboard?
currently works well, is very accurate, just wondering is it any bandgap reference pin on pyboard?
Re: ADC measure negative voltage??
The A3V3 can be used as 3.3 V reference.