Arduino BiJin ToKei
![IMG_9511.jpg](/proxy/?url=https://content.instructables.com/FJ4/SL8L/K06ZC17J/FJ4SL8LK06ZC17J.jpg&filename=IMG_9511.jpg)
![IMG_9509.jpg](/proxy/?url=https://content.instructables.com/FFU/O10P/K06ZC17G/FFUO10PK06ZC17G.jpg&filename=IMG_9509.jpg)
This instructables show how to use Arduino IDE, ESP32 dev board and ILI9341 LCD to built a photo clock.
What Is BiJin ToKei?
![IMG_9510.jpg](/proxy/?url=https://content.instructables.com/FR8/QI71/K06ZC17I/FR8QI71K06ZC17I.jpg&filename=IMG_9510.jpg)
Recap from my previous intructables, ESP32 Photo Clock:
BiJin ToKei(美人時計)start from 2009, they find various beauty hold a time board report time every minute. BiJin ToKei provide web application and mobile app version. After these years, you can find many variant on the web now.
Ref.:
https://ja.wikipedia.org/wiki/BIJIN%26Co.
Arduino Version
![IMG_9508.jpg](/proxy/?url=https://content.instructables.com/FLS/WKK5/K06ZC17E/FLSWKK5K06ZC17E.jpg&filename=IMG_9508.jpg)
My previous intructables, ESP32 Photo Clock, works fine. However, the program is built on ESP-IDF. This is a big barrier for the beginner. Since Aruino-esp32 framework is very maturer now, implement a photo clock on Arduino IDE become much easier.
Preparation
![IMG_9506.jpg](/proxy/?url=https://content.instructables.com/FFZ/WXWM/K06Z5331/FFZWXWMK06Z5331.jpg&filename=IMG_9506.jpg)
![IMG_9500.jpg](/proxy/?url=https://content.instructables.com/FTL/3JSJ/K06Z52GQ/FTL3JSJK06Z52GQ.jpg&filename=IMG_9500.jpg)
![IMG_9505.jpg](/proxy/?url=https://content.instructables.com/FHI/E1KJ/K06Z5301/FHIE1KJK06Z5301.jpg&filename=IMG_9505.jpg)
![IMG_9507.jpg](/proxy/?url=https://content.instructables.com/FIR/O711/K06Z535U/FIRO711K06Z535U.jpg&filename=IMG_9507.jpg)
![IMG_9499.jpg](/proxy/?url=https://content.instructables.com/FBT/APAT/K06Z52DZ/FBTAPATK06Z52DZ.jpg&filename=IMG_9499.jpg)
ESP32 Dev Board
Any ESP32 dev board should be ok.
Stacking Header
A 8-pins stacking female header. Bending the long header wire can help to adjust the viewing angle of the LCD.
Breadboard
A 400 tie points breadboard.
Breadboard Wire
Some breadboard jump wire.
LCD Display
This time I am using a 2.8 inches ILI9341 LCD. This program using Arduino_GFX library, so most common SPI LCD Display should be ok.
Arduino_GFX currently support:
- HX8352C 240x400
- HX8357B 320x480
- ILI9225 176x220
- ILI9341 240x320
- ILI9341 M5Stack 320x240
- ILI9486 320x480 (18 bit color)
- SEPS525 160x128
- SSD1331 96x64
- SSD1351 128x128
- SSD1351 128x96
- ST7735 128x128 (various tabs)
- ST7735 128x160 (various tabs)
- ST7735 80x160
- ST7789 240x135
- ST7789 240x240
- ST7789 TTGO T-Watch 240x240
- ST7789 240x320
Plug ESP32 Dev Board on Breadboard
![IMG_9504.jpg](/proxy/?url=https://content.instructables.com/FMN/VG2C/K06Z52UK/FMNVG2CK06Z52UK.jpg&filename=IMG_9504.jpg)
Bend Stacking Header & Plug on LCD
![IMG_9503.jpg](/proxy/?url=https://content.instructables.com/FF9/X5Y6/K06Z52RR/FF9X5Y6K06Z52RR.jpg&filename=IMG_9503.jpg)
Plug LCD on Breadboard
![IMG_9502.jpg](/proxy/?url=https://content.instructables.com/FDE/C37L/K06Z52P0/FDEC37LK06Z52P0.jpg&filename=IMG_9502.jpg)
Connection
![IMG_9501.jpg](/proxy/?url=https://content.instructables.com/FLF/HVPW/K06Z52M7/FLFHVPWK06Z52M7.jpg&filename=IMG_9501.jpg)
Use Breadboard jump wire connect LCD and ESP32 dev board together.
Here are the connection summary:
LCD -> ESP32 === ===== Vcc -> 5V pin (or 3.3V pin depends on your LCD display) GND -> GND CS -> GPIO 5 RESET -> GPIO 17 D/C -> GPIO 16 MOSI -> GPIO 23 SCK -> GPIO 18 LED -> GPIO 22 (Optional, some LCD require direct plug LED pin to 3.3V pin to make it brighter)
Software Preparation
Arduino IDE
Download and install Arduino IDE if not yet: https://www.arduino.cc/en/Main/Software
Arduino ESP32 Support
Please follow Installation Instructions at GitHub: https://www.arduino.cc/en/Main/Software
Arduino GFX library
Add Arduino_GFX library to Arduino IDE: https://github.com/moononournation/Arduino_GFX.gi...
If you are not familiar add library from GitHub, simply press the green "Clone or download" button and then "Download ZIP". And then in Arduino IDE, select Sketch menu -> Include Library -> Add .ZIP Library... -> select downloaded ZIP file.
Arduino BiJin ToKei Source Code
Download the source code from GitHub: https://github.com/moononournation/ArduinoBiJinTo...
How It Works?
Here are the program workflow:
Setup
- Initial LCD, you may change the pins and driver to fit for your display
Arduino_HWSPI *bus = new Arduino_HWSPI(16 /* DC */, 5 /* CS */, 18 /* SCK */, 23 /* MOSI */, -1 /* MISO */); Arduino_ILI9341 *tft = new Arduino_ILI9341(bus, 17 /* RST */, TFT_ROTATION);
- Connect WiFi, remember fill your WiFi AP settings
#define SSID_NAME "YourAP" #define SSID_PASSWORD "YourPassword"
- Connect NTP server to get the current time, you may change your local NTP server and timezone settings
const char* ntpServer = "pool.ntp.org"; #define GMT_OFFSET_SEC 28800L // Timezone +0800 #define DAYLIGHT_OFFSET_SEC 0L // no daylight saving
Loop
- If minute changed, make a HTTP request to a predefined URL in URL.h. There are many URL in the ToKei list, please read the comments in URL.h for more details.
#define JPG_SCALE JPG_SCALE_NONE #define TFT_ROTATION 0 // portrait #define URL "http://www.bijint.com/assets/pict/shizuoka/bp/%02d%02d.jpg"
- Get the HTTP response JPEG stream and feed to the esp_jpg_decode
-
esp_jpg_decode feed the decoded image block to LCD draw function
Program
Open ArduinoBiJinToKei.ino in Arduino IDE, compile and upload the program to ESP32 dev board.
Happy Time!
![IMG_9512.jpg](/proxy/?url=https://content.instructables.com/F50/7B2Y/K06ZC17K/F507B2YK06ZC17K.jpg&filename=IMG_9512.jpg)
It's time to put the Arduino BiJin ToKei on your desktop and show off what you have done. Enjoy!