SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Arduino & HC-05 Bluetooth Module
Bluetooth Module
Preliminary Hardware / Software
Bluetooth Module – Arduino Uno
Connectivity
ARDUINO & HC-05 BT Module
HC – 05 Bluetooth Module
- Master or Slave Configuration
- Breakout board recommended
- Bluetooth SPP (Serial Port Protocol) module
- Serial Communication
• Hardware Components needed:
– HC-05 Bluetooth Module
– Arduino Board
– Breadboard and Jump Wires
• Circuit Schematics
– Here’s how we need to connect the module to the Arduino Board.
• Arduino Source Code
#define ledPin 7
int state = 0;
void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
Serial.begin(38400); // Default communication rate of the Bluetooth module
}
void loop() {
if(Serial.available() > 0){ // Checks whether data is coming from the serial port
state = Serial.read(); // Reads the data from the serial port
}
if (state == '0') {
digitalWrite(ledPin, LOW); // Turn LED OFF
Serial.println("LED: OFF"); // Send back, to the phone, the String "LED: ON"
state = 0;
}
else if (state == '1') {
digitalWrite(ledPin, HIGH);
Serial.println("LED: ON");
state = 0;
}
}
• Connecting the Smartphone to the HC-05 Bluetooth Module and the Arduino
• Connecting the Smartphone to the HC-05 Bluetooth Module and the Arduino
• Controlling Arduino Using a Laptop or PC via Bluetooth Communication
• Processing IDE Source Code
import processing.serial.*;
Serial myPort;
String ledStatus="LED: OFF";
void setup() {
size(450, 500);
myPort = new Serial(this, "COM5", 38400); // Starts the serial communication
myPort.bufferUntil ('n'); // Defines up to which character the data from the serial port will be read. The character
'n' or 'New Line'
}
void serialEvent (Serial myPort) { // Checks for available data in the Serial Port
ledStatus = myPort.readStringUntil('n'); //Reads the data sent from the Arduino (the String "LED: OFF/ON) and it
puts into the "ledStatus" variable
}
void draw() {
background(237, 240, 241);
fill(20, 160, 133); // Green Color
stroke(33);
strokeWeight(1);
rect(50, 100, 150, 50, 10); // Turn ON Button
rect(250, 100, 150, 50, 10); // Turn OFF Button
fill(255);
• Processing IDE Source Code - Continued
textSize(32);
text("Turn ON",60, 135);
text("Turn OFF", 255, 135);
textSize(24);
fill(33);
text("Status:", 180, 200);
textSize(30);
textSize(16);
text("Program made by (Studen Name),n CPE Program", 80, 320);
text(ledStatus, 155, 240); // Prints the string coming from the Arduino
// If the button "Turn ON" is pressed
if (mousePressed && mouseX>50 && mouseX<200 && mouseY>100 && mouseY<150){
myPort.write('1'); // Sends the character '1' and that will turn on the LED
// Highlighs the buttons in red color when pressed
stroke(255,0,0);
strokeWeight(2);
noFill();
rect(50, 100, 150, 50, 10);
}
• Processing IDE Source Code - Continued
// If the button "Turn OFF" is pressed
if(mousePressed && mouseX>250 && mouseX<400 && mouseY>100 && mouseY<150){
myPort.write('0'); // Sends the character '0' and that will turn on the LED
stroke(255,0,0);
strokeWeight(2);
noFill();
rect(250, 100, 150, 50, 10);
}
}
• Final Output

Weitere ähnliche Inhalte

Was ist angesagt?

Arduino bt mobile robot r2.0
Arduino bt mobile robot r2.0Arduino bt mobile robot r2.0
Arduino bt mobile robot r2.0Fajar Baskoro
 
Cpu224 xp eth-ethernet_interface
Cpu224 xp eth-ethernet_interfaceCpu224 xp eth-ethernet_interface
Cpu224 xp eth-ethernet_interfacearco zhang
 
Robotic Car Controlled over Bluetooth with Obstacle Avoidance
Robotic Car Controlled over Bluetooth with Obstacle AvoidanceRobotic Car Controlled over Bluetooth with Obstacle Avoidance
Robotic Car Controlled over Bluetooth with Obstacle Avoidancekiet group of institution
 
Development Of An Internet Controlled Surveillance Mobile Robot Part1
Development Of An Internet Controlled Surveillance Mobile Robot Part1Development Of An Internet Controlled Surveillance Mobile Robot Part1
Development Of An Internet Controlled Surveillance Mobile Robot Part1mimi
 
Rf controlled pick up and drop robot
Rf controlled pick up and drop robotRf controlled pick up and drop robot
Rf controlled pick up and drop robotAdityaBulbule1
 
Buy arduino locally by Robomart
Buy arduino locally by RobomartBuy arduino locally by Robomart
Buy arduino locally by RobomartRobomart India
 
Advanced motion controls dr100ee30a40nac
Advanced motion controls dr100ee30a40nacAdvanced motion controls dr100ee30a40nac
Advanced motion controls dr100ee30a40nacElectromate
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseElaf A.Saeed
 
Project(itv 205) smart restaurant menu ordering system using arduino
Project(itv 205) smart restaurant menu ordering system using arduinoProject(itv 205) smart restaurant menu ordering system using arduino
Project(itv 205) smart restaurant menu ordering system using arduinoLalitKumar1031
 
Part 11 How to use binary concept In PLC.
Part 11 How to use binary concept In PLC.Part 11 How to use binary concept In PLC.
Part 11 How to use binary concept In PLC.KuldeepMakwana6
 
Intelligent road roller
Intelligent road rollerIntelligent road roller
Intelligent road rollerManav Mittal
 
Advanced motion controls dr100ee30a40ldc
Advanced motion controls dr100ee30a40ldcAdvanced motion controls dr100ee30a40ldc
Advanced motion controls dr100ee30a40ldcElectromate
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduinoSravanthi Sinha
 
Advanced motion controls dr101ee30a40nac
Advanced motion controls dr101ee30a40nacAdvanced motion controls dr101ee30a40nac
Advanced motion controls dr101ee30a40nacElectromate
 
Advanced motion controls dr100ee30a40ndc
Advanced motion controls dr100ee30a40ndcAdvanced motion controls dr100ee30a40ndc
Advanced motion controls dr100ee30a40ndcElectromate
 
Advanced motion controls dr100ee60a40ndc
Advanced motion controls dr100ee60a40ndcAdvanced motion controls dr100ee60a40ndc
Advanced motion controls dr100ee60a40ndcElectromate
 
Lika Electronic February 2019 Newsletter in English
Lika Electronic February 2019 Newsletter in EnglishLika Electronic February 2019 Newsletter in English
Lika Electronic February 2019 Newsletter in EnglishLika Electronic
 
Advanced motion controls dr100ee15a40ldc
Advanced motion controls dr100ee15a40ldcAdvanced motion controls dr100ee15a40ldc
Advanced motion controls dr100ee15a40ldcElectromate
 

Was ist angesagt? (20)

Arduino bt mobile robot r2.0
Arduino bt mobile robot r2.0Arduino bt mobile robot r2.0
Arduino bt mobile robot r2.0
 
Cpu224 xp eth-ethernet_interface
Cpu224 xp eth-ethernet_interfaceCpu224 xp eth-ethernet_interface
Cpu224 xp eth-ethernet_interface
 
Robotic Car Controlled over Bluetooth with Obstacle Avoidance
Robotic Car Controlled over Bluetooth with Obstacle AvoidanceRobotic Car Controlled over Bluetooth with Obstacle Avoidance
Robotic Car Controlled over Bluetooth with Obstacle Avoidance
 
Development Of An Internet Controlled Surveillance Mobile Robot Part1
Development Of An Internet Controlled Surveillance Mobile Robot Part1Development Of An Internet Controlled Surveillance Mobile Robot Part1
Development Of An Internet Controlled Surveillance Mobile Robot Part1
 
Rf controlled pick up and drop robot
Rf controlled pick up and drop robotRf controlled pick up and drop robot
Rf controlled pick up and drop robot
 
Buy arduino locally by Robomart
Buy arduino locally by RobomartBuy arduino locally by Robomart
Buy arduino locally by Robomart
 
Advanced motion controls dr100ee30a40nac
Advanced motion controls dr100ee30a40nacAdvanced motion controls dr100ee30a40nac
Advanced motion controls dr100ee30a40nac
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino Course
 
Project(itv 205) smart restaurant menu ordering system using arduino
Project(itv 205) smart restaurant menu ordering system using arduinoProject(itv 205) smart restaurant menu ordering system using arduino
Project(itv 205) smart restaurant menu ordering system using arduino
 
Tm 7000 analog
Tm 7000 analogTm 7000 analog
Tm 7000 analog
 
Part 11 How to use binary concept In PLC.
Part 11 How to use binary concept In PLC.Part 11 How to use binary concept In PLC.
Part 11 How to use binary concept In PLC.
 
Intelligent road roller
Intelligent road rollerIntelligent road roller
Intelligent road roller
 
Advanced motion controls dr100ee30a40ldc
Advanced motion controls dr100ee30a40ldcAdvanced motion controls dr100ee30a40ldc
Advanced motion controls dr100ee30a40ldc
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduino
 
Advanced motion controls dr101ee30a40nac
Advanced motion controls dr101ee30a40nacAdvanced motion controls dr101ee30a40nac
Advanced motion controls dr101ee30a40nac
 
Advanced motion controls dr100ee30a40ndc
Advanced motion controls dr100ee30a40ndcAdvanced motion controls dr100ee30a40ndc
Advanced motion controls dr100ee30a40ndc
 
Advanced motion controls dr100ee60a40ndc
Advanced motion controls dr100ee60a40ndcAdvanced motion controls dr100ee60a40ndc
Advanced motion controls dr100ee60a40ndc
 
Lika Electronic February 2019 Newsletter in English
Lika Electronic February 2019 Newsletter in EnglishLika Electronic February 2019 Newsletter in English
Lika Electronic February 2019 Newsletter in English
 
Advanced motion controls dr100ee15a40ldc
Advanced motion controls dr100ee15a40ldcAdvanced motion controls dr100ee15a40ldc
Advanced motion controls dr100ee15a40ldc
 
Bluetooth controlled robot
Bluetooth controlled robotBluetooth controlled robot
Bluetooth controlled robot
 

Ähnlich wie Bluetooth

What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
 
44CON 2013 - Controlling a PC using Arduino
44CON 2013 - Controlling a PC using Arduino44CON 2013 - Controlling a PC using Arduino
44CON 2013 - Controlling a PC using ArduinoMichael Boman
 
Arduino final ppt
Arduino final pptArduino final ppt
Arduino final pptIndu Mathi
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3Jeni Shah
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdfJayanthi Kannan MK
 
Development of a Low Cost, Reliable & Scalable Home Automation System.
Development of a Low Cost, Reliable & Scalable Home Automation System.Development of a Low Cost, Reliable & Scalable Home Automation System.
Development of a Low Cost, Reliable & Scalable Home Automation System.imtiyazEEE
 
ARUDINO UNO and RasberryPi with Python
 ARUDINO UNO and RasberryPi with Python ARUDINO UNO and RasberryPi with Python
ARUDINO UNO and RasberryPi with PythonJayanthi Kannan MK
 
Webshield internet of things
Webshield internet of thingsWebshield internet of things
Webshield internet of thingsRaghav Shetty
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Svet Ivantchev
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5Syed Mustafa
 
Arduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaArduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaIulius Bors
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerMujahid Hussain
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and CircuitsJason Griffey
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote controlVilayatAli5
 

Ähnlich wie Bluetooth (20)

What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
Arduino Programming
Arduino ProgrammingArduino Programming
Arduino Programming
 
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
 
44CON 2013 - Controlling a PC using Arduino
44CON 2013 - Controlling a PC using Arduino44CON 2013 - Controlling a PC using Arduino
44CON 2013 - Controlling a PC using Arduino
 
Arduino final ppt
Arduino final pptArduino final ppt
Arduino final ppt
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
 
Development of a Low Cost, Reliable & Scalable Home Automation System.
Development of a Low Cost, Reliable & Scalable Home Automation System.Development of a Low Cost, Reliable & Scalable Home Automation System.
Development of a Low Cost, Reliable & Scalable Home Automation System.
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
ARUDINO UNO and RasberryPi with Python
 ARUDINO UNO and RasberryPi with Python ARUDINO UNO and RasberryPi with Python
ARUDINO UNO and RasberryPi with Python
 
Webshield internet of things
Webshield internet of thingsWebshield internet of things
Webshield internet of things
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
 
Arduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaArduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuinta
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and Circuits
 
Soc
SocSoc
Soc
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote control
 

Mehr von Dwight Sabio

Human Rights Observatory Description
Human Rights Observatory DescriptionHuman Rights Observatory Description
Human Rights Observatory DescriptionDwight Sabio
 
RIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITOR
RIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITORRIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITOR
RIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITORDwight Sabio
 
Report on Girl Children: A Rapid Assessment of their Situation
Report on Girl Children: A Rapid Assessment of their SituationReport on Girl Children: A Rapid Assessment of their Situation
Report on Girl Children: A Rapid Assessment of their SituationDwight Sabio
 
Gender ombud report 2016 final
Gender ombud report 2016 finalGender ombud report 2016 final
Gender ombud report 2016 finalDwight Sabio
 
Strengthening legal referral mechanisms on cases of gender
Strengthening legal referral mechanisms on cases of genderStrengthening legal referral mechanisms on cases of gender
Strengthening legal referral mechanisms on cases of genderDwight Sabio
 
CPU scheduling ppt file
CPU scheduling ppt fileCPU scheduling ppt file
CPU scheduling ppt fileDwight Sabio
 
OperatingSystemChp3
OperatingSystemChp3OperatingSystemChp3
OperatingSystemChp3Dwight Sabio
 
Programming Problem 3
Programming Problem 3Programming Problem 3
Programming Problem 3Dwight Sabio
 
Programming Problem 2
Programming Problem 2Programming Problem 2
Programming Problem 2Dwight Sabio
 
Midterm Project Specification
Midterm Project Specification Midterm Project Specification
Midterm Project Specification Dwight Sabio
 
Game Design Document
Game Design DocumentGame Design Document
Game Design DocumentDwight Sabio
 
ProgrammingProblem
ProgrammingProblemProgrammingProblem
ProgrammingProblemDwight Sabio
 

Mehr von Dwight Sabio (20)

Human Rights Observatory Description
Human Rights Observatory DescriptionHuman Rights Observatory Description
Human Rights Observatory Description
 
RIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITOR
RIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITORRIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITOR
RIGHTS-BASED SUSTAINABLE DEVELOPMENT GOALS MONITOR
 
Report on Girl Children: A Rapid Assessment of their Situation
Report on Girl Children: A Rapid Assessment of their SituationReport on Girl Children: A Rapid Assessment of their Situation
Report on Girl Children: A Rapid Assessment of their Situation
 
Gender ombud report 2016 final
Gender ombud report 2016 finalGender ombud report 2016 final
Gender ombud report 2016 final
 
Strengthening legal referral mechanisms on cases of gender
Strengthening legal referral mechanisms on cases of genderStrengthening legal referral mechanisms on cases of gender
Strengthening legal referral mechanisms on cases of gender
 
IP Report
IP ReportIP Report
IP Report
 
CPU scheduling ppt file
CPU scheduling ppt fileCPU scheduling ppt file
CPU scheduling ppt file
 
Ch3OperSys
Ch3OperSysCh3OperSys
Ch3OperSys
 
OperatingSystemChp3
OperatingSystemChp3OperatingSystemChp3
OperatingSystemChp3
 
ABC Supermarket
ABC SupermarketABC Supermarket
ABC Supermarket
 
Programming Problem 3
Programming Problem 3Programming Problem 3
Programming Problem 3
 
Lab Activity
Lab ActivityLab Activity
Lab Activity
 
Programming Problem 2
Programming Problem 2Programming Problem 2
Programming Problem 2
 
Arduino e-book
Arduino e-bookArduino e-book
Arduino e-book
 
Midterm Project Specification
Midterm Project Specification Midterm Project Specification
Midterm Project Specification
 
Game Design Document
Game Design DocumentGame Design Document
Game Design Document
 
Class diagram
Class diagramClass diagram
Class diagram
 
Midterm Project
Midterm Project Midterm Project
Midterm Project
 
ProgrammingProblem
ProgrammingProblemProgrammingProblem
ProgrammingProblem
 
Class Diagram
Class DiagramClass Diagram
Class Diagram
 

Kürzlich hochgeladen

Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 

Kürzlich hochgeladen (20)

Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 

Bluetooth

  • 1. Arduino & HC-05 Bluetooth Module
  • 2. Bluetooth Module Preliminary Hardware / Software Bluetooth Module – Arduino Uno Connectivity
  • 3. ARDUINO & HC-05 BT Module HC – 05 Bluetooth Module - Master or Slave Configuration - Breakout board recommended - Bluetooth SPP (Serial Port Protocol) module - Serial Communication
  • 4. • Hardware Components needed: – HC-05 Bluetooth Module – Arduino Board – Breadboard and Jump Wires • Circuit Schematics – Here’s how we need to connect the module to the Arduino Board.
  • 5. • Arduino Source Code #define ledPin 7 int state = 0; void setup() { pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); Serial.begin(38400); // Default communication rate of the Bluetooth module } void loop() { if(Serial.available() > 0){ // Checks whether data is coming from the serial port state = Serial.read(); // Reads the data from the serial port } if (state == '0') { digitalWrite(ledPin, LOW); // Turn LED OFF Serial.println("LED: OFF"); // Send back, to the phone, the String "LED: ON" state = 0; } else if (state == '1') { digitalWrite(ledPin, HIGH); Serial.println("LED: ON"); state = 0; } }
  • 6. • Connecting the Smartphone to the HC-05 Bluetooth Module and the Arduino
  • 7. • Connecting the Smartphone to the HC-05 Bluetooth Module and the Arduino
  • 8. • Controlling Arduino Using a Laptop or PC via Bluetooth Communication
  • 9. • Processing IDE Source Code import processing.serial.*; Serial myPort; String ledStatus="LED: OFF"; void setup() { size(450, 500); myPort = new Serial(this, "COM5", 38400); // Starts the serial communication myPort.bufferUntil ('n'); // Defines up to which character the data from the serial port will be read. The character 'n' or 'New Line' } void serialEvent (Serial myPort) { // Checks for available data in the Serial Port ledStatus = myPort.readStringUntil('n'); //Reads the data sent from the Arduino (the String "LED: OFF/ON) and it puts into the "ledStatus" variable } void draw() { background(237, 240, 241); fill(20, 160, 133); // Green Color stroke(33); strokeWeight(1); rect(50, 100, 150, 50, 10); // Turn ON Button rect(250, 100, 150, 50, 10); // Turn OFF Button fill(255);
  • 10. • Processing IDE Source Code - Continued textSize(32); text("Turn ON",60, 135); text("Turn OFF", 255, 135); textSize(24); fill(33); text("Status:", 180, 200); textSize(30); textSize(16); text("Program made by (Studen Name),n CPE Program", 80, 320); text(ledStatus, 155, 240); // Prints the string coming from the Arduino // If the button "Turn ON" is pressed if (mousePressed && mouseX>50 && mouseX<200 && mouseY>100 && mouseY<150){ myPort.write('1'); // Sends the character '1' and that will turn on the LED // Highlighs the buttons in red color when pressed stroke(255,0,0); strokeWeight(2); noFill(); rect(50, 100, 150, 50, 10); }
  • 11. • Processing IDE Source Code - Continued // If the button "Turn OFF" is pressed if(mousePressed && mouseX>250 && mouseX<400 && mouseY>100 && mouseY<150){ myPort.write('0'); // Sends the character '0' and that will turn on the LED stroke(255,0,0); strokeWeight(2); noFill(); rect(250, 100, 150, 50, 10); } }

Hinweis der Redaktion

  1. Android developers often need to use Bluetooth in their projects. This application note details a method to utilize Bluetooth in order to communicate with a microcontroller. This method includes verifying Bluetooth support and status, pairing and connecting to the microcontroller’s Bluetooth module, and sending and receiving data serially. Bluetooth is a popular method of communication between devices. Many smartphones today have the capability to communicate using Bluetooth. This is useful to mobile application developers whose apps require a wireless communication protocol. However, utilizing the Bluetooth API can be difficult for first-time users.
  2. Controlling the Arduino using a smartphone and controlling the Arduino using a laptop or a PC. We will learn how we can configure the HC-05 Bluetooth module and make a Bluetooth communication between two separate Arduino Boards as master and slave devices. Before we start with the first example, controlling an Arduino using a smartphone, let’s take a closer look at the HC-05 Bluetooth module. Comparing it to the HC-06 module, which can only be set as a Slave, the HC-05 can be set as Master as well which enables making a communication between two separate Arduino Boards. There are several different versions of this this module but I recommend the one that comes on a breakout board because in that way it’s much easier to be connected. The HC-05 module is a Bluetooth SPP (Serial Port Protocol) module, which means it communicates with the Arduino via the Serial Communication.
  3. The particular module that I have can be powered from 3.6 to 6 volts, because it comes on breakout board which contains a voltage regulator. However, the logic voltage level of the data pins is 3.3V. So, the line between the Arduino TX (Transmit Pin, which has 5V output) and the Bluetooth module RX (Receive Pin, which supports only 3.3V) needs to be connected through a voltage divider in order not to burn the module. On the other hand, the line between the Bluetooth module TX pin and the Arduino RX pin can be connected directly because the 3.3V signal from the Bluetooth module is enough to be accepted as a high logic at the Arduino Board.
  4. So, now we are ready to make the Arduino code for enabling the communication between the Arduino board and the smartphone. We will make a simple example, just turning on and off an LED but it will be good enough for understanding the communication. Description: First we need to define the pin to which our LED will be connected and a variable in which we will store the data coming from the smartphone. In the setup section we need to define the LED pin as output and set it low right away. As mention previously, we will use the serial communication so we need to begin the serial communication at 38400 baud rate, which is the default baud rate of the Bluetooth module. In the loop section with the Serial.available() function we will check whether there is available data in the serial port to be read. This means that when we will send data to the Bluetooth module this statement will be true so then using the Serial.read() function we will read that data and put it into the “state” variable. So if the Arduino receive the character ‘0’ it will turn the LED off and using the Serial.println() function it will send back to the smartphone, via the serial port, the String “LED: OFF”. Additionally we will reset the “state” variable to 0 so that the two above lines will be executed only once. Note here that the “state” variable is integer, so when we receive the character ‘0’ that comes from smartphone, the actual value of the integer “state” variable is 48, which corresponds to character ‘0’, according to the ASCII table.. That’s why in the “if” statement we are comparing the “state” variable to a character ‘0’. On the other hand, if the received character is ‘1’, the LED will light up and the String “LED: ON” will be sent back. Now the code is ready to be uploaded but in order to do that we need to unplug the TX and RX lines because when uploading the Arduino uses the serial communication so the pins RX (digital pin 0) and TX (digital pin1) are busy. We can avoid this step if we use the other TX and RX pins of the Arduino Board, but in that case we will have to use the SoftwareSerial.h library for the serial communication.
  5. Now we are ready to connect the smartphone to the Bluetooth module and the Arduino. What we need to do here is to activate the Bluetooth and the smartphone will find the HC-05 Bluetooth module. Then we need to pair the devices and the default password of the HC-05 module is 1234. After we have paired the devices we need an application for controlling the Arduino. There are many application in the Play Store for this purpose which will work with the Arduino code that we wrote. This is a great and easy to use application for building Android application and in my next tutorial you can find a detailed step by step guide how to build your own custom Android application for your Arduino Project.
  6. Here’s the application. With the connect button we will connect the smartphone to the Bluetooth module and the status text below the button will tell us whether we have successfully connected. Now using the “Turn ON” and “Turn OFF” buttons we can turn on and off the LED. The text above the buttons is the one that the Arduino is sending back to the smartphone when a particular button is pressed.
  7. Let’s see how we can control the Arduino via Bluetooth using a Laptop or a PC. So, first we need to pair our laptop to the HC-05 Bluetooth module and we can do that from the Laptop Bluetooth Settings. The laptop will discover the HC-05 module and using the ‘1234’ password we will pair the devices. ------ Once we will pair the devices in the Laptop Device Manager, under Ports (COM & LPT), two new entities will appear named “Standard Serial over Bluetooth link”. From here we can see the COM Port number of the serial port through which the devices will communicate. ------ We will stick with the same example as previously, turning on and off a LED and sending back a string to the laptop, so we will use the same Arduino code as previously described.
  8. Description: We need to include the Serial library and create a serial object in order to enable the serial communication, as well as, define a String variable for the led status. In the setup section we need to set the window size of the program and start the serial communication. As for the COM Port Number here we need to try one of the two COM Port numbers we previously noticed in the device manager. The next line defines the buffering of the serial port and in our case that’s until there is a new line and actually there is a new line each time the Arduino sends the String “LED: OFF” or “LED ON” because of the println() function. Next, using the serialEvent() function we check whether there is available data in the serial port to be read. If so, using the readStringUntil() function we will read that data from the serial port which has been sent from the Arduino and in our case that’s the String “LED: OFF” or “LED: ON”.
  9. In the main draw() function, which constantly repeats, we make all the graphics and functions of the program. So first we need set the background color, the fill color, the stroke size and color and using the rect() function we draw the two buttons. Using the text() function we print all the text, including the ledStatus string that’s coming from the Arduino. What’s left now is to make the buttons functional. So using the first “if” statement we confine the area of the “Turn ON” button, so when the button is pressed the character ‘1’ will be sent over the serial port to the Arduino and that will turn on the LED. The next for lines are used to highlight the button when it’s pressed. The same procedure goes for the “Turn OFF” button. ------ Now the program is ready, so when we will click the run button, the program will automatically activate the Bluetooth communication between the laptop and the Arduino. The HC-05 Bluetooth module will start to flash every two seconds, which indicates that the module is connect and we will be able to control the LED using our Laptop.