BLE Smart Notification for Riding

by MusaW in Circuits > Arduino

2264 Views, 17 Favorites, 0 Comments

BLE Smart Notification for Riding

Screenshot 2022-05-08 124910.jpg
Screenshot 2022-05-08 125109.jpg
Screenshot 2022-05-08 125524.jpg
Screenshot 2022-05-08 125453.jpg
Screenshot 2022-05-08 125402.jpg
Screenshot 2022-05-08 125311.jpg

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

ST7798 075448.png
Hfa8cffc3fdce408b9a77571664255473x.jpg
regulator.png

what you need is as follows :

  1. 1 x 1,3-inch SPI TFT display ST7798
  2. 1 x Wemos ESP32 Mini
  3. Some cables as needed
  4. Case for mounting on the motorbike
  5. 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

Screenshot 2022-05-06 111521.png
Screenshot 2022-05-06 112156.png
Screenshot 2022-05-06 112515.png
  1. Install Wemos D1 Mini ESP32 Board from the board manager or download it from here
  2. Install ESP32 BLE Arduino from the Library manager or download it from here
  3. Install TFT_eSPI from the Library manager or download it from here

Preparing Your TFT_eSPI Library

Screenshot 2022-05-06 145510.png

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

ST7798 BLE.png
92308628-57cb4800-ef9f-11ea-81fa-64d722c4df24.png
Screenshot 2022-05-06 155230.png
Screenshot 2022-05-08 125218.jpg
Screenshot 2022-05-08 125148.jpg
  • 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

Screenshot 2022-05-06 161050.png

Programing Android Server

Screenshot 2022-05-06 162002.png
  • 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

  1. Turn on the ESP BLE client
  2. Run the Android Apps
  3. For the first time, Allow all the permission
  4. Click Listen service button and allow access to the Notification for Notification_BLE
  5. 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

Screenshot 2022-05-06 164627.png
Screenshot 2022-05-06 164903.png
Screenshot 2022-05-06 164941.png

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.

  1. create an image 240p x 240p 72DPI
  2. Open the image using LCD-image-converter
  3. click Options --> Conversion...
  4. Choose Color R5G6B5 from the Preset dropdown menu
  5. Click the Image tab and choose 16 bit from Block size dropdown menu
  6. 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...