BLE Smart Notification for Riding
by MusaW in Circuits > Arduino
2677 Views, 17 Favorites, 0 Comments
BLE Smart Notification for Riding
When we ride a motorbike, sometimes we are disturbed by some notifications, or when we listen to directions from Google maps we forget the directions, or maybe when a call comes in, we hesitate to pick it up or leave it because we don't know who is calling us.
The core idea of this device is actually forwarding all notifications that appear on your Android to a 1.3-inch color TFT screen, using Bluetooth wireless communication (BLE).
Supplies
what you need is as follows :
- 1 x 1,3-inch SPI TFT display ST7798
- 1 x Wemos ESP32 Mini
- Some cables as needed
- Case for mounting on the motorbike
- DC Step-down Buck Converter 3A
- I use ST7798 because it's easy and it has a fast refresh rate
- Wemos ESP32 Mini has a small size, so it will fit in my case
- use a small cable so it fits in the case
- I use, a used motorcycle TPMS case for it because it's waterproof and strong enough
- Voltage regulator from 12v/24v to 5v for powering your ESP32 and Display
Preparing Your Arduino IDE
Preparing Your TFT_eSPI Library
why did I choose ST7798 and TFT_eSPI library?
this is purely due to the excellent speed that can be provided from this combination, other than that this display is easy to obtain in the market.
indeed the configuration of the TFT_eSPI library is more complicated than usual, but it will not be a problem when we get extraordinary results
How to set up TFT_eSPI Library?
- Locate the library folder (Windows would be Documents\Arduino\libraries\TFT_eSPI) and go to the library subfolder User_Setups
- Create a copy of Setup24_ST7789.h and rename it to Setup24_ST7789_ESP32.h
- and edit it like this
// ST7789 240 x 240 display with no chip select line #define ST7789_DRIVER // Configure all registers #define TFT_WIDTH 240 #define TFT_HEIGHT 240 // Generic ESP32 setup #define TFT_MISO -1 #define TFT_MOSI 23 #define TFT_SCLK 18 #define TFT_CS -1 // Not connected #define TFT_DC 2 #define TFT_RST 4 // Connect reset to ensure display initialises #define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH #define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters #define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters #define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm #define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:. #define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. #define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts #define SMOOTH_FONT #define SPI_FREQUENCY 27000000 #define SPI_READ_FREQUENCY 20000000
- back to the TFT_eSPI library folder and look for a file named User_Setup_Select.h, Open it and Remark this text #include <User_Setup.h> // Default setup is root library folder
- add this text below it #include <User_Setups/Setup24_ST7789_ESP32.h>
//#include <User_Setup.h> // Default setup is root library folder #include <User_Setups/Setup24_ST7789_ESP32.h>
- After that your TFT_eSPI is ready to use
Assembling the Electronic Parts
- After we set up our TFT_eSPI library as in step 2, we will get the configuration above.
- connect the TFT Display to the ESP32 board as follow and power it using a 5V 3A regulator from the 12V motorcycle ACCU.
Programing Esp32 Client
- Flash the Wemos ESP32 Mini with this code BLE_ST7798.ino
Programing Android Server
- Import this project to the MIT App Inventor and built the APK to run on the Android or you can direct install this APK
Ready to Use
- Turn on the ESP BLE client
- Run the Android Apps
- For the first time, Allow all the permission
- Click Listen service button and allow access to the Notification for Notification_BLE
- back to the apps and you can click Connect and start using it, all notifications from your Android will appear in the display
Bonus Step - Change the Image
In this project I use 240p x 240p 72DPI image for all icons, if you want to change it can use LCD-Image-converter to replace the code.
- create an image 240p x 240p 72DPI
- Open the image using LCD-image-converter
- click Options --> Conversion...
- Choose Color R5G6B5 from the Preset dropdown menu
- Click the Image tab and choose 16 bit from Block size dropdown menu
- Click Show Preview and you can copy that code and paste it on the image file library.
Perfecting
maybe there are still many shortcomings in this project, please provide input or suggestion so that together we can improve it...