Smartwatch Journey – Part #10


The Smartwatch had lasted just for 3 days until something magical has happened. Fortunately, the battery realised that it has capacity of 100mAh and I am draining around 200uA so  it should last longer. I know that it doesn’t have capacity exact capacity as listed. I got 380 hours (~16 days) of use. That was surprise for me. I knew that LiPo batteries has to be discharged to the 0 and charged over few times, but that didn’t helped me.

  1. Notifications ✓*
  2. Custom header ✓
  3. Cheatsheet ✓
  4. 2 weeks of use ✓
  5. Better Android App ☐

* The app has some bugs, I know about them so I have to find time to fix that.

DIY Turning Lidar Part #0

Lidar is distance sensing device which outputs data describing distance. It uses light, that’s why it’s called li-dar (dar is from radar which use sound).  It fire an IR ray in the specific angle and detect strength of IR ray coming back to the receiver part. I was using Sharp IR distance measuring sensor which is not precise but It’s easy to use and cheap. Then I found VL53L0X sensor. It’s based on Class 1 IR Laser, so the ray is more like line and It can provide data via I2C interface to your MCU. This sensor can be turned 360° over and over and sensing environment around. I wanna to build such Lidar sensor. The first thing you will need is something that allows you to turn cables many times without tangling. That is called Slip Ring. You can find it on AliExpress, it’s not thing for few cents…
Slip Ring

The next is sensor, which can provide very fast measurements. Let’s say we want make a whole turn once a second and measure every 10°. That’s 36 measurements in 1000 millisecond, so ~28ms for measurement and sending data to out MCU! The fastest mode of VL53L0X takes ~20ms, so if we add some time for sending to MCU, it could be possible. I will talk about combinating more sensors to achieve speed in the next article.

Smartwatch Journey – Part #9

The target architecture

Every project will start be messy. Especially code. You add something new, remove old stuff, fix not working code… It can be hard to read your code after a month. So, I decided to clean up the code and build an architecture to be easily understandable and I can always add new stuff without worrying.

  • Reduce state variables
  • Add Screens with Screen Manager
  • Send input to Screen Manager for process

This is how the final architecture should look like. Many things are the same as in old code. But implementating Screen Manager will give me a opportunity to add another screens with menus.

The main idea is to have the Main screen with time. The short click will force to refresh the time and the long click will open Menu screen. The Menu will contain few rows – labels of another Screens that can be entered by long click and you can move a row down with short click. The last row will be exit. I imagine the first row as link to Notes, so I can see some notes saved in smartwatch. I can do this now with long click. Settings like how long to show notification on the screen or what to show on the screen or how…

Let’s see

Smartwatch Journey – Part #8

I found out that smartwatch has been stucking because of BLE and Ticker. These 2 events are interfacing with the display where the while loops and delays are used. So I added a boolean variable for drawing state. If the ticker wants to refresh time after 60 seconds it first set drawing = true then it begins to draw, so if it got BLE event, it can wait while the ticker is drawing with while(drawing); loop. This solution works also vice versa. Another problem was that I had to use custom shiftOut function instead of hardware SPI, it doesn’t work for me ?.

The next issue was the battery life. Smartwatch lasted only few hours. I found out that the sleep function in library wasn’t complete. Sending data after command was missing, so I added it. Smartwatch could survive for 1 day then. But, that wasn’t surprising. I expected one week! I have been using my smartwatch few days and discharging the battery to the 3.35V. This time, as I am writing this article the display shows 4.03V after 8 hours of use. This sounds much better. Besides that, I am running LiPo discharge logger which writes voltage of 100mAh LiPo battery to the file in SD card. It’s simple. I use 10kOhm resistor as drain. By the Ohm’s law 3.7V / 10kOhm = 370uA which is average power consumption of the smartwatch. I will write an article about How to determine battery percentage from voltage.

If You want to know about something another, please feel free and leave me a commen. I can write tutorial or anything for you which may help you.

Smartwatch Journey – Part #7

It’s finished! Somehow…

You can check some photos on my Instagram @kovacdottop.

First of all, I was using millis() function to get the current time but the millis() resets after 68 minutes. So I was looking for another option. I am using Ticker object now. I execute void every seconds which increments seconds variable storing unix time in seconds. I use another variable to count up to 60 and then I refresh time, date day name, battery voltage if changed. This is better solution than looking for overflowing millis because if you want to run BLE you have to waitForEvent in the loop void, so you can’t refresh time.

Next, I added onReceive(String msg) void for BLE. I wait for any ble event and if I receive any data I show example logo.

But there is a problem, it gets stucked sometimes when there is some ble event. The time isn’t refreshed anymore. So this is on my current queue.

How to properly use Bluetooth communication with Arduino and HC-05/06

Bluetooth Module HC-05 or HC-06 comes with Serial interface with default baudrate 9600 bits per second. It is easy to hook it up. I prefer to use hardware Serial if it’s possible. Arduino Mega 2560 has 3 spare hardware Serials, Arduino Micro or Pro Micro has one spare and regular Arduino Uno has no spare Serial. In this case You can use Software Serial library which likes to use interrup pins of Arduino Uno 2 and 3.  When You have already connected bluetooth to the Arduino it’s time to try it out.

    1. Include SoftwareSerial library
      #include <SoftwareSerial.h>
    2. Declare bluetooth object
      SoftwareSerial bluetooth(RX_PIN, TX_PIN); // usually pin 2 and 3
    3. Start serial communications
    4. Add receive and transmit functions to the void loop
      if (Serial.available() > 0) {
      if (bluetooth.available() > 0) {


You want to make something complex sometimes like saving every received byte to the string and then displaying it as text.

  1. Declare string object outside any void
    String buffer = "";
  2. Add this code to the while loop
    if (bluetooth.available() > 0) {
      char rd = char(;
      if (rd == '.') {
        buffer = "";
      } else {
        buffer += rd;


Smartwatch Journey – Part #6

After long time of problem solving I can finally run E-ink display on my RedBearLab BLE v2. I got some problems to run it with hardware SPI, so I had to use different pins and custom shiftOut function for data proper transfer. The final design doesn’t look like an Apple Watch or nice Samsung Watch but I hope it will be functional.

The every part which will be used:

  1. 3D printed case in black PLA
  2. RedBearLab Nano v2
  3. Vibrator motor
  4. Pushbutton 6×6 mm
  5. LiPo 301530 100mAh battery
  6. TP4056 LiPo charger
  7. uUSB connector (i hope there will be enough space for this)
  8. Some hot glue, wires and resistors for voltage division and measuring

Stand By mode should refresh time every 10th minute, not every 10 minutes! When I will receive some message, it will display a logo of the app, sender or title and the content. I will play with this when it will be finished hardwarely.

I expect one week of usage.

I consider to make custom pcb with all the parts soldered on the only one board, so there will be more space for battery and it will be thinner and nicer.

Cheap Arduino Car #2

I made some progress last nights while staying awake until 3-4 AM. I have tried NRF24L01 modules but without success. I have to order new ones, I have’t got any spares. They were working fine last year, I don’t know what happened. So, I decided to add Bluetooth Module (HC-06).

First of all, I was looking for Android App which will be the best for my purpose. Simple app which will be sending data to the car continuously! I didn’t find such an app for controlling car. I found some, but they were horrible, but good for testing. The app I downloaded has joystick and buttons like gamepad. The problem was in joystick. It was just like 8 buttons and the direction you moved with joystick the specific button was sent to the car ONCE. When I released the joystick some another character was sent to the car but also ONCE. That was problem. Why? Because when I lost connection between smartphone and HC-06 the car will still going in the last known direction and car easily run away and be damaged. And so it happened. It fell off the broke rear bumper. Glue, easy fix.

When the car was finished and working I started programming custom Android application. I wanted keep it simple. I added status bar with connect switch, voltage and device name and coefficients. Below the status bar were placed custom made „Analog Sticks“, one vertical, one horizontal giving me a range of -1.0 to +1.0 for better calculations. I will talk about the app itself in the part #3.

Cheap Arduino Car #1

Besides Smartwatch Journey and Quadruped Project there are several projects waiting to be finished.
I built FPV (First Person View) RC car controlled by Arduino last summer. It was easy to build but the main chassis wasn’t looking so good. So, I decided to rebuild it.

  • The main parts of the car was: chassis with steering and motor included from construction kit rc truck, 2 x 18650 old batteries, Arduino Pro Micro/Mini, nRF24L01 with attachable antena, TB6612FNG as motor driver. I added 1000TVL FPV camera and transmitter Eachine TS832 later. The controlls was just 4 buttons (FWD / REV, LEFT / RIGHT) and FPV receiver RC832 from Eachine as well. There was also some regulator which will be mentioned later. Voltage divider to measure voltage with Arduino.
  • Reasons why I wanted to rebuild it:
    • There wasn’t any space to put batteries inside chassis, the only way was to use 4xAA  batteries insertable to the bottom part, but that’s too weak and slow for me cuz 4xAA can provide olny 4.8V – 6V due to type. The batteries was placed on the top of chassis making bad behavior of the car.
    • Power management wasn’t solved very good. As I accelerated the car the FPV transmitter shuted down and didn’t have enought power. I had to use another 600mA battery but it was drained in 15 minutes.
  • What I made new or added:
    • 3D-printed chassis
    • Old steering was replaced by servo motor steering with L7806CV voltage regulator to make suitable 6 volts.
    • Front suspension is wider by 5 mm. (80 mm front and rear now)
    • New main-board including NRF24L01 with L1117 3.3V regulator, Arduino Pro Micro 5V, TB6612FNG, big 1000uF capacitor for voltage spikes, buzzer for signalization low voltage or debug, 10k/4k7 voltage regulator was the same as before.
    • burned finfer by soldering iron :/, it survived (weird smell of human meat)
  • What I will make or add later
    • FPV camera on Yaw or Pitch servo
    • Spoiler on servo. Rly? Useless…. Maybe.
    • Better controller! with display or buzzer to know battery voltage of the car or the controller itselft.
  • Any ideas? / IG: kovacdottop