0% found this document useful (0 votes)
84 views27 pages

Bluetooth HC05

The document discusses serial communication using Arduino. It describes how serial communication provides an easy way for an Arduino board to interact with a computer and other devices. It explains some key serial functions like begin(), print(), println() and discusses protocols like SPI, I2C and their specifications. It also talks about interfacing a Bluetooth module HC-05 with Arduino and using AT commands to control it in command or data mode.

Uploaded by

D4D DREDD yt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views27 pages

Bluetooth HC05

The document discusses serial communication using Arduino. It describes how serial communication provides an easy way for an Arduino board to interact with a computer and other devices. It explains some key serial functions like begin(), print(), println() and discusses protocols like SPI, I2C and their specifications. It also talks about interfacing a Bluetooth module HC-05 with Arduino and using AT commands to control it in command or data mode.

Uploaded by

D4D DREDD yt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Intro to the Arduino

Topics:
The Arduino
Digital IO
Analog IO
Serial Communication
Programs
SERIAL COMMUNICATION USING ARDUINO
• Serial communications provide an easy and flexible way for your Arduino
board to interact with your computer and other devices.

• You can also send data from the Serial Monitor to Arduino by entering text in
the text box to the left of the Send button.

• Baud rate is selected using the drop-down box on the bottom right.

• Your Arduino sketch can use the serial port to indirectly access (usually via a
proxy program written in a language like Processing) all the resources
(memory, screen, keyboard, mouse, network connectivity, etc.) that your
computer has.
• Your computer can also use the serial link to interact with sensors or other
devices connected to Arduino.
Serial Functions
• if(Serial)
– Indicates if the specified Serial port is ready.
• available()
– Get the number of bytes (characters) available for reading from the
serial port.
• availableForWrite()
– Get the number of bytes (characters) available for writing in the
serial buffer without blocking the write operation.
• begin()
• end()
– Disables serial communication,
• find()
Serial Functions
• flush()
• print()
• println()
• read()
• setTimeout()
• write()
What is the output of the following program?
• void setup() • A) display The number
• {

is 0 to 32767
Serial.begin(9600);
• } • B) display The number
• int number = 0; is -32768 to 32767
• void loop()
• C) display The number is
• {
• Serial.print("The number is "); 0
• Serial.println(number); • D) display The number
delay(500);
is 0 to 65535
• number++;
• }
SPI
• SPI (Serial Peripheral Interface) is an interface bus
commonly used for communication with flash memory,
sensors, real-time clocks (RTCs), analog-to-digital
converters, and more. The Serial Peripheral Interface
(SPI) bus was developed by Motorola to provide full-
duplex synchronous serial communication between
master and slave devices.
• 3.8 Khz to 250 Mhz frequency range
SPI protocol
I2C
• With I2C, you can connect multiple slaves to a
single master (like SPI) and you can have
multiple masters controlling single, or multiple
slaves. This is really useful when you want to
have more than one microcontroller logging
data to a single memory card or displaying text
to a single LCD.
• 100KHz frequency range
I2C specification
I2C Protocol
I2C data frame protocol
Which protocol is said to be four
wire protocol?
• A) SPI
• B) I2C
• C) USART
• D) UART
ATmega328-Arduino Pin Mapping
Bluetooth Module HC-05
• It is IEEE 802.15.1 standardized protocol, through which one
can build wireless Personal Area Network (PAN).
• It uses frequency-hopping spread spectrum (FHSS) radio
technology to send data over air.
• It uses serial communication to communicate with devices.
• It communicates with microcontroller using serial port
(USART).
• It has range up to <100m which depends upon transmitter
and receiver, atmosphere, geographic & urban conditions.
• Its operating frequency is 2.4 GHz ISM Band
HC-05
HC-05 Bluetooth Module
• HC-05 Bluetooth Module is a low-cost, easy-to-operate &
small-sized module used for wireless communication in the
Bluetooth spectrum.
• It supports Serial Port Protocol (SPP), which helps in
sending/receiving data to/from a microcontroller (i.e. Arduino
UNO).
• Its default baud rate is 9600 for data communication and
38400 for command mode communication.
• HC05 can operate in master/slave mode and thus multiple
slave nodes can be controlled using a single master node
(called mesh networking).
• HC-05 supports “AT commands”, controlled by TX
(transmission) and RX (receiver) pinouts.
HC05 interface with UNO
(Command mode)
BT commands
Bluetooth interface
• void setup(){
• Serial.begin(9600);
• pinMode(13,OUTPUT);
• }
• void loop() {
• while(Serial.available()>0){
• inputByte= Serial.read();
• if (inputByte=='Z'){
• digitalWrite(13,HIGH);
• }
• if (inputByte=='z'){
• digitalWrite(13,LOW);
• } }}
what will be the output of the
following program?
• void setup() • A) will print 78 once
• {Serial.begin(9600); • B) will print 78 in decimal
• } form
• Void loop(){ • C) will print 78 after every
• Serial.print(78, DEC); 500 msec delay
• delay(500) • D) error
• }
What will be the output of the
following program?
• void setup(){ A) the value is : 98
• Serial.begin(9600); B) the value is :
• int v=98} 98
• void loop(){ C) The value is :98
• Serial.print(“the value is :”); will display after every 500
• Serial.print(v); msec
• delay(500): D) error
• }
How to put your BT in command
mode?
• A) By pressing Key pin
• B) By pressing Key pin and disconnecting and again
connecting the VCC supply
• C) Status pin
• D) none of above
ATMEGA 328P pins dedicated for
I2C protocol?
• A) pin 27 and 28
• B) Pin 1 and 2
• C) Pin 18 and 19
• D) Pin 4 and 5
Interface of relay
RESET pin is mapped with which
pin on Arduino UNO board?
• A) pin 2 of ATMEGA328P
• B) pin 1 of ATMEGA328P
• C) Pin 0 of ATMEGA328P
• D) Pin 19 of ATMEGA328P

You might also like