mBuino program that shows how to read VCC using the blink of a LED
mBuino PowerMeter
This program shows how to read the current voltage on the 3V3 (VCC) pin of mBuino using the blink of a LED.
Since mBuino uses the VCC voltage as reference for analog reads, all readings are relative. To get an absolute reading an external reference voltage is needed. An easy way to get an external reference is by using a zener-diode with proper characteristics.
Not having such a zener around made me look for alternatives. I found some on this page: http://www.talkingelectronics.com/projects/200TrCcts/200TrCcts.html#52
Use a LED!
The most interesting method I found was to use the LEDs on mBuino! All needed to use this is an extra connection. I used a 100R resistor as connection between pin 14 and LED6. Pin 14 is the small dot right above the one of the version number. Alternatively you can also use an external LED or (zener)-diode. The picture below shows both the added resistor as well as an external LED/resistor circuit.
Serial USB
The picture above shows a USB cable connected to mBuino. When mBuino is powered via USB and nothing else is connected to VCC, power comes from the 3v3 regulator. The VCC reading will then be around its maximum. USB is used to display the readings on the USB serial console. Note that for this the USB serial driver and a terminal application such as Putty is required. When using the console the spacebar can be hit to switch between pin14+LED6 and pin15 with an external LED/resistor via pin4.
See the code comments for more information.
History
added some comments
2015-08-07, by maxint [Fri, 07 Aug 2015 08:56:06 +0000] rev 4
added some comments
small fix of incorrect call
2015-08-02, by maxint [Sun, 02 Aug 2015 18:22:37 +0000] rev 3
small fix of incorrect call
added program homepage-url to comments
2015-08-01, by maxint [Sat, 01 Aug 2015 07:55:12 +0000] rev 2
added program homepage-url to comments
Updated comments, cleanup
2015-08-01, by maxint [Sat, 01 Aug 2015 07:51:44 +0000] rev 1
Updated comments, cleanup
mBuino PowerMeter.; Measure VCC using flashing LED
2015-08-01, by maxint [Sat, 01 Aug 2015 06:58:12 +0000] rev 0
mBuino PowerMeter.; Measure VCC using flashing LED