Adding a battery meter to Wio Terminal

Today I’d like to talk about one of the first mods I did to my Wio Terminal (Actually, to my Wio Terminal Battery Chassis). As you probably already know, the chassis doesn’t have an easy way to measure its battery voltage. Because of that, I wasn’t able to check if my battery was charged or not.

The idea is simple, if we check the 40-pin header and the grove connectors from the chassis, we’ll be able to see if any analog pin is not used:

After checking it, I was able to find out that pin A7 wasn’t used, so, this could be our battery sensing input. It’s good that we don’t choose an analog pin that has a grove connector attached to it, so we don’t disrupt the original functionality of the unit.

Another issue is that a common LiPo battery has a voltage range of up to 4.2 volts. This way, we wouldn’t be able to just connect it to A7, as it surpasses the maximum 3.3 volts of the Wio Terminal.
For solving that, we need to create a voltage divider. A voltage divider is a circuit made of two resistors, that make us able to decrease the voltage input by an X factor. This obey the following formula:

As so, choosing two resistors with the same value, we can divide the input voltage by a factor of two. This way, the maximum voltage we would be able to read is 6.6v, making it safe to connect to our battery.

Another thing to consider is the resistor value. High values may decrease accuracy and bandwidth, while the latter shouldn’t be a problem for our case cenario, bad accuracy can be an issue. In the other way, low values will increase the current consumption, which will decrease the capability of holding charge while not being used. I, myself, choose 10k resistors, as these were the ones I had available, but, I would recommend something between 100k and 1M. For me, a lower resistance isn’t that big of an issue, as I’ll be adding an on/off switch.

Here is how I did it:

  1. Planned circuit change:

  1. Disassemble the chassis:

  1. Find where the pins are:

  1. Solder the resistor (here I used some SMD resistors, you can also use through hole models).

  1. Attach an wire between our resistor and the VBAT terminal:

  1. Check if there is any short and if the wire isn’t loose, after that assemble everything and check if it works:

For checking the battery, use pin 7. You should remember to map the value to the correct voltage. Here is a sample code:

uint16_t val = map(analogRead(7), 0, 1023, 0, 6600);
SerialUSB.print(val);
SerialUSB.println(" mV");
2 Likes

Well done! 10 kohm on 3.6V gives a current of 0.36 mA.

EDIT 2 x 10 kohm on 3.6V gives a current of 0.18 mA.

This nicely answers two other threads, Wio Terminal Chassis Battery monitoring and How do I get the battery voltage?.

Let’s hope Seeed will include it into the coming revision of the Wio Terminal battery extension.

1 Like

Thank you reivilo!

As the discharge occurs between vcc and gnd, with two 10k resistors, we have a 20k Ohm path to ground. This would lead to 180uA at 3.6v. It isn’t much, but, I would recommend 100k ohm resistors, as they don’t offer any major disadvantage and would decrease the current to 18uA.

1 Like

Nice one :ok_hand:, Thanks for sharing . and you can share whole post here if you want to, no problem with images, you can upload, drag and drop or link the image here.

1 Like

thank you! I’m a new user, because of that I can’t post more than 1 image per post

Oh, , That actually to prevent spam posts, can you check now. :slightly_smiling_face:

You are right, 2 x 10 kohm on 3.6V gives a current of 0.18 mA.

Thank you @salman! I updated the post.