Friday, 12 July 2019

adc - How to read high voltages on microcontroller?


I want to read high voltages, like ~50V, using a microcontroller. I plan to put this as an input into the microcontroller's A/D line. But of course, you shouldn't have voltage that high on the input of a microcontroller or it'll fry.


How might I read high voltages? The main thing is that I need to step down the voltage before reading it. What do I need to consider when stepping down this voltage?


Thanks in advance!


Edit: I noticed in the PIC18 datasheet that it says "The maximum recommended impedance for analog sources is 2.5 kOhms." How does this affect how I step down the voltage, be it with resistive dividers, etc.?



Answer



A simple resistive voltage divider will achieve what you want.


Voltage Divider



The formula to calculate the output voltage is:


Formula


So if we assume your input voltage ranges from 0-50V, we need to divide it by 10 to achieve 0-5V. If we also assume we want to load the input voltage with 100kΩ, then the calculations would something like:


Vout / Vin = R2 / 100kΩ


0.1 = R2 / 100kΩ -> R2 = 10kΩ


R1 = 100kΩ - R2 = 90kΩ


So R1 = 90kΩ and R2 = 10kΩ


For an ADC requiring a maximum source impedance, you must make sure the voltage divider impedance is below this level. The impedance at the divider can be calculated as R1||R2.


For <2.5kΩ, the above won't meet this requirement as 10kΩ||90kΩ = 9kΩ
If we use 9kΩ and 1kΩ though, we get 1 / (1/1000 + 1/9000) = 900Ω



Bear in mind the lower the resistance the higher the wattage rating resistors you need. 50V / 1k = 50mA -> 50mA * 45V = 2.25W across the top resistor (0.25W across the bottom)
In these cases it's best to use an opamp buffer in between a high resistance divider and the ADC. Or use a 2kΩ and 18kΩ divider, which is not quite as power hungry as the 1k/9k version.


No comments:

Post a Comment

arduino - Can I use TI&#39;s cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...