Display on SSD1306 screen a message transmitted to ESP32 via Bluetooth

Bluetooth 07-03-24
274 0

Tutorial plan

1- How to display on SSD1306 display screen a message transmitted to ESP32 via Bluetooth ?

2- The necessary components to use the SSD1306 display by the ESP32 card

3- ESP32 board wiring diagram with SSD1306 display

4- Program the ESP32 card to receive and display a message from the Smartphone

5- Develop a mobile application to send a message to the ESP32 board

 

 

How to display on SSD1306 display a message transmitted to ESP32 via Bluetooth ?

The ESP32 board is a versatile microcontroller with built-in Wi-Fi and Bluetooth capabilities, while Bluetooth is a wireless communication standard that facilitates short-range communication between electronic devices.

To display a message on SSD1306 display connected to an ESP32, which receives the message via Bluetooth from an App Inventor app

1. Hardware Setup:

Make sure your ESP32 board has Bluetooth capability (most ESP32 boards do). Connect the ESP32 to your computer or power source.

Connect the ESP32 to the SSD1306 display. This generally involves connecting the SDA (data) and SCL (clock) pins of the LCD to the corresponding  pins on the ESP32.

2. Install MicroPython on the ESP32: Flash the MicroPython firmware onto your ESP32. You can use tools like esptool or a graphical tool like Thonny for this. Follow the instructions provided by the MicroPython documentation for your specific ESP32 board.

3. Install necessary libraries:

You'll need the bluetooth library in MicroPython to work with Bluetooth.

Utilize a library that manages the communication between the ESP32 and the SSD1306 display.

4. Write MicroPython Code:

Write a MicroPython script to configure Bluetooth, handle incoming messages and display it on the I2C screen.

5. App Inventor Setup: Create a simple App Inventor app to send messages to the ESP32 via Bluetooth. Use the BluetoothClient component to connect to the ESP32 device and send messages.

6. Pair Devices: Pair your smartphone with the ESP32 through the Bluetooth settings on your smartphone.

7. Test: Deploy your MicroPython script to the ESP32 and install your App Inventor app on your smartphone. Test the communication by pressing the button on the app and observing the ESP32's response.

The necessary components to use the SSD1306 display by the ESP32 card

To use a SSD1306 display with the ESP32 board, you'll need the following components:

ESP32 Board:

ESP32 card

The ESP32 is a powerful microcontroller developed by Espressif Systems. It's renowned for its integrated Wi-Fi and Bluetooth capabilities, making it a popular choice for various IoT (Internet of Things) applications.

SSD1306 display:

The SSD1306 display is a type of OLED (Organic Light-Emitting Diode) display that uses the SSD1306 driver chip.

Jumper Wires:

Jumper wires

To make the physical connections between the components.

Breadboard:

Test plate

A breadboard is a useful tool for creating temporary electronic circuits. It allows you to connect components without soldering .

ESP32 board wiring diagram with SSD1306 display

ESP32 board wiring diagram with SSD1306 displayESP32 board wiring diagram with SSD1306 display

Connect the SSD1306 Display to your ESP32 as follows:

1- Connect the SDA (data line) of the SSD1306 display to GPIO 21 of the ESP32 board.

2- Connect the SCL (clock line) of the SSD1306 display to GPIO 22 of the ESP32 board.

3- Connect the VCC pin of the SSD1306 display to the 3.3V pin of the ESP32 board.

4- Connect the GND pin of the SSD1306 display to GND pin of the ESP32 board.

Program the ESP32 card to receive and display a message from the Smartphone

1- Flash your ESP32 with MicroPython using this file esp32-20210902-v1.17.bin.

2- import this two libraries : ble_uart_peripheral.py and ble_advertising.py

3- Use the ssd1306.py Library for SSD1306 screen

Here's an example of MicroPython code :

Develop a mobile application to send a message to the ESP32 board

1- Create the designer of mobile app with App Inventor.

- Use the available Bluetooth components to establish a connection with the ESP32.

- Add text fields to write a message.

- Add button to sen the message to ESP32 board

Here is the Designer part of the application with App Inventor :

2. Programming the application with App Inventor:

a- Use the available blocks in App Inventor to establish a Bluetooth connection with the ESP32.

- Starting with Android 12, Bluetooth permissions have been enhanced to improve security and user data protection. This is why we must declare the authorizations that your application needs in the AndroidManifest.xml file. For Bluetooth, you'll need to include ACCESS_FINE_LOCATION, BLUETOOTH_SCAN, and possibly BLUETOOTH_CONNECT permissions, depending on the features you're using.

- Use these programming blocks to connect the smartphone to the ESP32 board via Bluetooth:

b- Use these programming blocks to send message from Smartphone to ESP32 board via Bluetooth

Download project Download application

 

Testing :

1- Upload the MicroPython code to your ESP32.

2- Install and launch the app created with App Inventor on your smartphone.

3- Connect to the ESP32 from the mobile application.

4- Verify that the message is sent to the ESP32 board and displayed in the SSD1306 screen.

 

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info