Until now, my PineTime development setup was quite simple :
I also use the NRF52-DK to test specific functionalities, connect a logic analyzer,…
I’ve been working on this setup since I’m working on PineTime and InfiniTime, in October 2019!
This setup has some limitations :
In this article I explain how I, a software engineer with very little knowledge in electronics, built a new dev setup that overcome these limitations!
Before going deeper into details on how I built this new setup, here is a picture of the result:
On the left, you can see the power supply that provides 5 volts to the charging pads of the PineTime.
The little board on the right is the INA219 board. This board can measure the current that flows between its Vin and Vout pins. It’s connected to a M5Stack Fire module via an I²C bus. I wrote a simple Arduino app that acquires the values from the ina219 and draws them on the display.
Then, on the bottom is the STLinkV2 I use to flash/debug the PineTime.
This setup is well packed, easily movable and less fragile dans the previous one.
Soldering a connector to the SWD pins and adding a connector on the battery wires might seem a very simple task to anyone with electronics, soldering and hardware skills… But to me, it was a very stressful job. Here are the steps I followed.
Here is the devkit before any manipulation:
You can see the PCB, the battery and the heart rate sensor on the top. The BLE antenna is also visible on the right of the battery. The SWD pads are hidden under the antenna.
First, I disconnected the connectors and unmounted the PCB so that I can easily solder a connector on the SWD pads:
Now, the SWD pads are more visible.
For the next step, I recommend you use a soldering iron with a very small tip. I use the Pinecil, the soldering iron from Pine64. On the next picture, you can see I slightly bent the antenna to place the connector on the SWD pad.
Carefully solder the connector on the back of the PCB. While you’re at it, add a connector on the battery wires (take care not to short the battery during this step!) : unsolder the battery, solder a connector on the battery wire and the corresponding connector on the PCB.
You can now remount everything, apply power and hope you won’t see any magic smoke :)
You can now add the power measurement tool on the setup.
Here is the result after a bit of cleaning :
To measure the current that flows between the battery and the PineTime, I use a INA219 board. This chip is a voltage and current measurement IC that connects to an I²C bus. It’s probably not the most accurate way to measure the current, but it’s really cheap and easy to use.
The INA219 Vin+ and Vin- must be connected in between the battery and the PineTime, on the red (+) wire.
I wanted to build a standlone tool that I can easily connect to any of my projects. That’s why I decided to use the M5Stack Fire module to build my own DIY power monitoring tool. The M5Fire module is based on the ESP32 MCU and provides many devices like a RGB LED, a speaker and and nice LCD display.
The project is a PlatformIO project, based on the Arduino framework and uses the following libraries:
Using these libraries, the code is quite simple : in the
loop() function, acquire the current measured and draw the values in a graph on the LCD.
I pushed my whole code on my GitHub profile. The implementation is very quick’n’dirty, but it’s good enough to be actually usable and do some first power measurements on the PineTime running InfiniTime!