Will the smart pin adc measure this safely?
I'm not sure how the adc smart pins measure. Do they measure to actual ground?
The reason for asking is I want to measure the voltage drop across a resistor in a circuit and the resistor will be anywhere from 12 to 25 volts to ground. There will only be less than 1 volt drop across.
Is there a way to measure this between two pins without voltage being too high and burning out the pins,
If there is already something showing this, please let me know,
Thanks for any help.
Comments
Have you considered an external helper chip like the INA219? It's designed to measure across a resistor and will give you voltage and current (via I2C to the P2).
The P2 has a ground reference, but even that has to be calibrated to use the ADC.
Hi, the smart pins cannot measure in this range. The use GND and the 3V3 supply voltage with all it's noise.
You could use a voltage divider to ground but be aware of the relative low input impedance (300k as far as I remember).
Also you could use external cap and resistors similar to the methods used with P1.
Be also aware, that in reality the precision (ENOB) of the smart pin adc is <11bit, so some calibration might be necessary.
Each ADC can measure down to maybe -0.5 volts. Limited by clamping diodes. The x1 gain has roughly a 5.0 Volt span with numerical 50% centred on VIO / 2, 1.67 Volts. The x1 gain input impedance is something like 500 kOhms to the VIO / 2. Offset drifts around quite a bit so they're not great at instrumentation. Rapid recalibration helps.
Yeh I though it probably would not work without external chips. But worth a try.
Thanks for verifing.
Oh, you have large common mode, and variable?, voltage offset! Cripes, I'd want to use an isolated measurement for that. You're inviting faults otherwise.
If you want to measure the current of a PWM power stage, for example of a motor driver, you can use capacitive coupling and one of the higher gain modes (p_adc_10x for 0.33V input range). You then need to take two samples, one during the on and one during the off state and subtract the results. I've sucessfully used this trick in a stepper motor driver. This allows current measurement with only one external capacitor.
However, if you need to measure DC current and voltage you need an external IC, either an OPAMP configured as differential amplifier or a special chip especially designed for high-side shunt resistors.
In my solar power setup I use https://www.winson.com.tw/uploads/images/WCS1700.pdf hall sensors. Very easy to use and very easy to interface.