The Arduino Uno paired with a Bluetooth module like the HC-05 or HC-06 allows for wireless communication with other Bluetooth-enabled devices such as smartphones, computers, or other Arduinos.
To send a message from an Arduino Uno to a smartphone via Bluetooth using the HC-06 module and a push button, and to create a custom app using MIT App Inventor to receive the message, follow these steps:
Arduino UNO :
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 sending data from Arduino UNO ro Smartphone via Bluetooth.
Push button:
The push button is a simple input device that sends a signal to the Arduino when pressed. The Arduino detects button sends message to 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.
1- Connect the HC-06 Bluetooth Module to the Arduino:
HC-06 VCC to Arduino 5V
HC-06 GND to Arduino GND
HC-06 TX to Arduino digital Pin 2
HC-06 RX to Arduino digital Pin 3
2- Connect the Push Button to the Arduino:
Connect one side of the button to Arduino analogic A0
Connect the other side of the button to GND
The following code sends a message over Bluetooth when the button is pressed:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <SoftwareSerial.h> const int btnPin = A0; // The button is connected to pin A0 of the Adruino board int btnVal = 0; SoftwareSerial hc06(2,3); void setup(){ pinMode(btnPin,INPUT_PULLUP); hc06.begin(9600); } void loop(){ btnVal=analogRead(btnPin); if(btnVal<200) // We press the push button { hc06.print("Hi my name is Arduino board "); //Send message to smartphone delay(500); } } |
1- Create the designer of mobile app with App Inventor.
- Use the available Bluetooth components to establish a connection with the Arduino.
- Add button to connect Arduino to HC-06 module Bluetooth
- Add button to disconnect Arduino from HC-06 module Bluetooth
- Add label field to display the message sended from Arduino UNO.
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 receive data from Arduino UNO via Bluetooth
Download projectDownload application
Testing :
1- Upload the Code to the Arduino. Reconnect the TX and RX pins to the HC-06 once the upload is complete.
2- Pair the HC-06 with Your Smartphone:
- Enable Bluetooth on your phone.
- Find and pair with the HC-06
3- Open Your Custom App:
- Press the “Select Bluetooth Device” button and choose the HC-06.
- Once connected, press the button on the Arduino circuit.
4- Each button press should send the message “Hi my name is Arduino board” to the app, which will display it in the Label.
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