Author Topic: El-cheapo Volt / Current reference  (Read 2132 times)

0 Members and 1 Guest are viewing this topic.

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
El-cheapo Volt / Current reference
« on: February 06, 2014, 12:28:21 pm »
In a separate thread, I suggested that it is possible to construct an inexpensive reference current source around mcus. I put one together on paper and it worked reasonably well but stability is a big issue.

Here is the schematic of one implementation: the mcu outputs a pwm pulse train on R1/C1, with its output driving the mosfet. On the mosfet's source, a measurement resistor Rm1 is used to sample the current. R3 is the wire resistance. The mcu then adc's the voltage across Rm1 and use that to adjust the pwm duty cycle.

So once a target is set, the output (current) will track to the target gradually, as shown by the traces.
================================
https://dannyelectronics.wordpress.com/
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4700
  • Country: au
  • Question Everything... Except This Statement
Re: El-cheapo Volt / Current reference
« Reply #1 on: February 06, 2014, 12:36:17 pm »
a micro-controller ADC is not the most accurate thing in the world, and you generally want an order of magnitude better specs to calibrate something,

also your control algorithm on that looks quite bad (massive overshoot), instead try integrating only your readings and a proportional only control scheme as the capacitance is so large it dithering between 2 values should help you out,
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: El-cheapo Volt / Current reference
« Reply #2 on: February 06, 2014, 12:44:55 pm »
While working on the stability, I came to the realization that this thing can be used as a voltage reference too: the voltage across Rm1 is maintained by the mcu.

Here is an examle: R1/C1 is the lp filter, Q1 is the buffer, and RM1 is the measurement resistor. ROUT1, optional, isolates the high-impedance load from RM1.

J2 outputs a voltage reference, and J1 (when not shorted) outputs a current reference.

I have gotten the control algorihm stable across the full voltage band: 0-1.1v. The output current is determined by RM1 (in this case, 0 - 1.1ma).

In the particular case, Iout is set to 40ua, and fluctuates from 39.9ua to 40.1ua (20x adc gain used here).

Potential Improvements:
1) make it dual channel: since the mcu has two pwm channels, we can replicate R1/C1/Q1/RM1/ROUT1 and we have another channel. One can be dedicated to volt and other current; or they have different ranges.
2) improve resolution: the pwm duty cycle is being dithered to provide finer resolution. This creates fluctuation on the output. Another way is to utilize the unused tmr0 pwm channels OC0A and OC0B and add 8-bit resolution to the meter. Adding two resistors will do that.
3) use external adc: the biggest draw back here is the onboard adc. A better adc could help.
....

The meter has a range of 0 - 1.1v (limited by the reference voltage). It has a current output of 1.1ma full-scale (RM1 = 1K), and current resolution of 0.05ua and voltage resolution of 0.05mv (RM1 = 1K and 20x adc gain).

The meter has no UI and no calibration capability so it is entirely conceptual at this point. But it does suggest that something like this is doable.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf