To display a message onSSD1306 screen connected to an Arduino Uno that is receiving messages via Bluetooth, you'll need to follow a few steps. Here's a general guide to help you achieve this:
Hardware Setup:
1- Connect your SSD1306 screen to the Arduino Uno. Typically, this involves connecting the SDA and SCL pins on the SSD1306 to the corresponding pins on the Arduino Uno, as well as providing power and ground.
2- Connect the Bluetooth module (e.g., HC-05) to the Arduino Uno. Connect the RX pin of the Bluetooth module to the TX pin of the Arduino Uno and vice versa. Also, connect the VCC and GND pins appropriately.
Software Setup:
1- Make sure you have the required libraries installed. You may need to install the "LiquidCrystal_I2C" library for the SSD1306 screen and the "SoftwareSerial" library for Bluetooth communication. You can install these libraries through the Arduino IDE Library Manager.
2- Write the Arduino code.
App Inventor:
1- Open App Inventor (https://appinventor.mit.edu/).
2- Create a new project.
3- Drag and drop the following components onto the designer screen:
4- In the Blocks editor, use the following blocks to connect and send a message to Arduino UNO
Arduino UNO Board
The Arduino Uno board is a microcontroller board based on the ATmega328P microcontroller. It's one of the most popular and widely used boards in the Arduino family due to its simplicity and versatility.
It is the central control unit for your project.
HC-06 module bluetooth
The HC-06 Bluetooth module is a commonly used serial communication module that enables Bluetooth connectivity for various projects, including Arduino-based systems. It acts as a serial port Bluetooth module, allowing wireless communication between devices.
This module is used for receiving data from smartphone via Bluetooth.
SSD1306 screen
The SSD1306 is a popular display controller used in OLED (Organic Light-Emitting Diode) screens. It's commonly employed in various electronics projects to showcase information on small screens. The SSD1306 controller is compatible with different screen sizes and is often integrated with microcontrollers like Arduino UNO board to display text, graphics, and images.
This screen is used for displaying the message sende by Smartphone.
Jumper Wires:
For making temporary connections and wiring between components.
Breadboard:
A breadboard is a useful tool for creating temporary electronic circuits. It allows you to connect components without soldering.
Connect the SSD1306 screen to Arduino:
1- Connect the SDA (data line) of SSD1306 screen to A4 pin of Arduino.
2- Connect the SCL (clock line) of SSD1306 screen to A5 pin of Arduino.
3- Connect the VCC pin of SSD1306 screen to the 5V pin of Arduino.
4- Connect the GND pin of SSD1306 screen to GND pin of Arduino.
Connect the HC-06 Bluetooth Module to Arduino:
1- VCC pin of HC-06 module to 5V pin of Arduino
2- GND pin of HC-06 module to GND pin of Arduino
3- TXD pin of HC-06 module to pin 6 of Arduino
4- RXD pin of HC-06 to pin 7 of Arduino
To program the Arduino board, you'll need to follow these steps.
1- import this library : Adafruit_SSD1306 for SSD1306 display
2- Create a new Arduino script to read data from HC-06 module and display it on SSD1306 screen :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
#include <SoftwareSerial.h> #include <Adafruit_SSD1306.h> // Configure the SSD1306 display #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); SoftwareSerial hc06(6,7); String message=""; void setup(){ //Initialize Bluetooth Serial Port hc06.begin(9600); //Serial.begin(9600); //For OLED I2C if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 Serial.println(F("SSD1306 allocation failed")); for(;;); } display.display(); //Display logo delay(1000); display.clearDisplay(); } void loop(){ //Read data from HC06 Bluetooth module while(hc06.available()>0){ message+=(char)hc06.read(); } if(message!=""){ display.clearDisplay(); display.display(); //Serial.print("message received= "); //Serial.println(message); display.setTextSize(2); display.setTextColor(WHITE); display.setCursor(0, 28); // Display message sende by Smartphone on SSD1306 screen display.print(message); display.display(); message=""; //reset message } delay(100); } |
1- Create the designer of mobile app with App Inventor.
- Use the available Bluetooth components to establish a connection with the Arduino.
- Add text fields to write a message.
- Add button to sen the message to Arduino
Here is the Designer part of the application with App Inventor :
2. Programming the application with App Inventor:
1- 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.
2- Add the the necessary blocks to connect the smartphone to the HC-06 Bluetooth module
3- Use these programming blocks to send message from Smartphone to Arduino via Bluetooth
Download projectDownload application
Testing :
1- Upload the MicroPython code to Arduino.
2- Install and launch the app created with App Inventor on your smartphone.
3- Connect to Arduino from the mobile app.
4- Check that the message is sent to the Arduino
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.
Zaouiet Kontech-Jemmel-Monastir-Tunisia
+216 92 886 231
medaliprof@gmail.com
Robotic site created by MedAli-Teacher info