View Full Version : ADC problem
showtime
- 27th November 2007, 23:29
I would like to measure a voltage between VCC and Mosfet's drain. How can i succeed with a PIC? I couldn't know where i put the deviders and how i write the codes. I can use adc functions well.
showtime
- 27th November 2007, 23:41
This circuit can help.
Charles Linquis
- 28th November 2007, 01:10
I see two problems here -
First, you can't measure voltages that have a reference more than about .5 V above or below GND. To solve that problem you can either:
A. Build a one or two op-amp level shifter or
B. If the 20 V is stable, then just measure the drain voltage with a GND referenced PIC
and the voltage across the load will be (20V - Vdrain).
The second problem is that you appear to be using PWM to drive the gate. The voltage
across the load will be something like a square wave with a near 0 to 20V swing.
Your A/D will need some heavy filtering to give a meaningful result. And of course, the input of the A/D will need some sort of voltage divider to make sure that it doesn't see a voltage higher than Vref.
showtime
- 28th November 2007, 08:50
I couldn't understand that opamp level shifter circuit. Please give me an example
Charles Linquis
- 28th November 2007, 17:22
You need to set up the op-amps as a differential amplifier, and I don't have time to go into the full design right now. If you aren't already familiar with differential amplifiers, I think that my suggestion of measuring the drain voltage and subtracting it from 20 is the easiest approach for you. If the 20V isn't stable, you could even use a second channel of the A/D to measure that voltage exactly. Four resistors (for two voltage dividers), two capacitors (for filtering) and a little code and your are done. Everything would be ground-referenced.
showtime
- 28th November 2007, 23:21
Thank you very much Charles Linquis. I will try to do this.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.