Display on LCD screen a message transmitted to ESP32 via Bluetooth

Bluetooth 06-03-24
116 0

Tutorial plan

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

2- The necessary components to use the LCD I2C 1602 display by the ESP32 card

3- ESP32 board wiring diagram with LCD I2C 1602 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 LCD I2C screen 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 an I2C LCD screen 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 LCD I2C 1602 display. This generally involves connecting the SDA (data) and SCL (clock) pins of the LCD to the corresponding I2C 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 LCD.

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 LCD I2C 1602 display by the ESP32 card

To use a LCD I2C 1602 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.

LCD I2C 1602 Display:

The LCD I2C 1602 display is a type of liquid crystal display (LCD) that utilizes the I2C (Inter-Integrated Circuit) communication protocol to interface with microcontrollers or other devices.

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 LCD I2C 1602 display

ESP32 board wiring diagram with LCD I2C 1602 displayESP32 board wiring diagram with LCD I2C 1602 display

Connect the LCD I2C 1602 Display to your ESP32 as follows:

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

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

3- Connect the VCC pin of the LCD I2C 1602 display to the 5V pin of the ESP32 board.

4- Connect the GND pin of the LCD I2C 1602 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 i2c_lcd and lcd_api Libraries for I2C LCD 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 LCD 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