ESP12e + OLED display – a try to make a smartwatch
Recently I bought two ESP12e, wanted to see how those IoT things work. One thing I know for sure, they don’t tolerate 12V 1A 😉 yep fired one by accident …
I left with one working, trying to figure out what should I build with it. In the meantime was wondering should I by a smartwatch, do I really need one? What would I use it for etc… then start googling about it, check some stores at net, overall research. At the end I thought, I don’t really need one, but wait … maybe I’ll build my own “smartwatch”, took ESP12e out from my drawer.
I does not have any fancy features like mp3 player, accelerometer, gps .., it’s an oled display connected to ESP12e with charging circuit and FT232R for PC communication. It has two buttons, one bright red led connected to ESP12e used for urgent notify, also two for TP4056 charger circuit (red and green).
Esp12e is configured as an access point with WPA2.
Current software functionality
ESP12e is flashed with nodeMCU precompilled image (changed uart speed to 115200), also 107 byte of esp_init_data_default.bin was changed, so I could get ADC value from ADC pin, not from Vin.
Device has two buttons on the bottom (left/right).
Button on the right is connected to GPIO0, so when hold during boot it will enter boot mode and new firmware (e.g. nodeMCU) could be flashed.
Left button switch display into two modes: status screen (picture above) and user screen.
Status screen has:
– ip address of the access point
– ssid of AP network
– battery pack level in ADC value: (620 dead, 760 fully charged) / uptime in seconds
– heap usage
– ip of connected wireless client
– mac address of connected wireless client
IP and mac of connected client is missing on picture above, because AP was idle that time.
After connecting to the ESP12e, we’re getting IP as usual, and we can connect to port 80 of ESP12e. From now we can run any command on the nodeMCU, thanks to node.input(“command”) method. Result could be seen on serial port.
I thought about some low-level logic here, to send packed struct, unpack and display, but node.intput() is the simplest way to do this and very universal from other point of view e.g. I could change/put new files onto the 4MB ESP12e flash by wifi!
– line 0
– line 1
– line 2
– line 3
– line 4
– line 5
All lines are described as l0..5 global variable defined in one of the files loaded to nodeMCU. So when want to update e.g line 3, we should do something like this: