Originally posted 2015: information may be out of date, as this tech moves so fast! These 'Maker Modules' were a series of mini 'recipes' for extending components which can in turn be combined into something cool.
This design pattern uses a voltage divider, registering via an analog input pin, in order to enable an Arduino to monitor its own power supply voltage. This is particularly useful if you have a requirement to trigger shutoff when battery charge gets low (e.g. when using a LiPo battery), or else report battery voltage visually on screen in some application.
Let’s say you have an Arduino UNO, and wish to use 6 AA batteries to power it. At a nominal 1.25V apiece, this makes a total supply voltage of 9V. The Arduino will happily consume this via its onboard regulator, to create an onboard logic voltage ~5V.
Let’s assume that we’ll use the default (5V) analogue reference voltage on the Arduino. In this case, a voltage of 5V (or higher) on an analog pin will be read using analogRead() as integer value 1024. Equivalently, half this input voltage will report the value 512, and 0V will report the value 0.
In order to get sensible pin readings from our supply voltage, we need to map the input range (in this case 9V to 0V) into that required for logic input (in the case of our chosen reference voltage, 5V to 0V)…
Let’s select a suitable resistor pair to create this ratio. Using a voltage divider calculator, plug in the input (peak supply voltage at 9V), desired output (reference voltage at 5V), and 1Ω for R1. Note the value that the calculator returns for R2. The ratio between R1 and R2 is key to the correct voltage reduction: by inputting 1Ω for R1, R2 is reported (ignoring the unit) as the other half of the key ratio.
In our example case, the perfect ratio for R1:R2 is 1:1.25. Any resistor pair with the same ratio difference as that calculated here, will scale the maximum supply voltage perfectly to the input reference. Resistor values aren’t ranked in a full continuum however, so it can be tricky getting as close to the desired ratio as possible. Armed with a vague sense that ‘low’ resistor values are a source of current wastage, yet high resistances can create ‘noisy’ input, I found a close mapping (9V to 4.9V) where R1:R2 = 1:1.2, by choosing R1=1000Ω and R2=1200Ω.
Wire the circuit, including the divider as in the following diagram. The analogue pin on the Arduino takes its voltage reading in between R1 and R2:
You can use an alternative reference voltage, so long as the resistance ratio maps the supply to an appropriate input voltage. In my smartwatch for example, I’m using 1.1V reference voltage on a 3.3V Arduino Pro Mini, mapping from a LiPo 4.2V peak supply to just a little over the reference voltage (1.125V), using R1=3270Ω and R2=1196Ω. As the input voltage drops below 1.1V, I start to see the ‘real’ battery voltage reported on the tiny screen, and I can make sure that I power down for a recharge as the battery approaches 3.7V.
More projects
SpidertownDigital Art
Toon Cup 2022 updatesHTML5 Game
Dodger: WantedHTML5 Game
The HuntsmanDigital Art
The Little MermaidDigital Art
Snow WhiteDigital Art
RapunzelDigital Art
Red Riding HoodDigital Art
Global Game Jam 2020: REPAIRHTML5 Game
LabuntinaIn-app HTML5 Game
Tee and Mo: Little WorldHTML5 Game
Word TrainHTML5 Game
Flip and MatchHTML5 Game
Hydra3D Art
Blue Bird3D Art
RainbowSpill3D Art
Vanity3D Art
Gumball Guy3D Art
Helmet Guy3D Art
Wired Eyed3D Art
Cauldron Guy3D Art
Jelly Crab3D Art
Kraft3DHobby business
Papercraft fishMake
Paperfishion3D Art
BAFTA KidsVideo Appearance
The Next StepGame Character
GyaradosGame Character
Gastly3D Render
Iron Man Poster3D Render
Art Station ChallengeGame Character
Construction Site Lamp3D Render
LileepGame Character
Stareoke StagefrightFlash Game
Richard Hammond's Blast LabFlash Game
Blue Peter: Turkish BizarreFlash Game
The Right MixFlash Game
Big and SmallFlash Game
Tate AirbrushFlash Game
Tee and Mo Face PaintingHTML5 Game
Tee and Mo WebsiteWordpress Website
Zingzillas: The Great Coconut AdventureFlash Game
Tree Fu TomFlash Games
Let's PlayUnity3D/Flash Game
Elmo Loves 123sAIR App: iOS and Android
All Star RacingHTML5 Game
Crabtree PlusWordpress Website, HTML5 games
TwirlywoosHTML5 Games
The OctonautsHTML5 Website, Flash games
Elmo's Art MakerHTML5 Game
Pop and SpellHTML5 Game
Paw Patrol Air PatrollerHTML5 / HAXE Game
Tee and Mo Playtime (iOS, Android)AIR App: iOS and Android
Operation Ouch: Snot ApocalypseHTML5 Game
MegamanGame Character
Operation Ouch: Clone WardsHTML5 Game
SupernormalsDigital Art
The Lion KingDigital Art