While using AltSoftSerial D10 cannot be used for PWM. */ // AltSoftSerial uses D9 for TX and D8 for RX. * Commands should be contained within the start and end markers * There is no error checking and this sketch sends only * Send commands through a serial connection to turn a LED on and OFF on a remote Arduino The Sketch on Arduino #1, the master device connected to the HC-05, simply sends the command LEDON, waits a second, sends the commands LEDOFF waits another second and then repeats indefinitely. Arduino #2, the slave device we have the Bluetooth module and an LED (with a suitable resistor) on pin D3. When the Arduino #2 gets the commands it sets the LED accordingly.Īrduino #1, the master device, just has the Bluetooth module. Arduino #1 simply sends the commands LEDON and LEDOFF to the Arduino #2. Communication is one way only and there is no error checking. In the first example we get one Arduino to control an LED connected to a second Arduino. They are classified by the way their resistance responds to temperature changes. A simple way to do this is by using a voltage divider made from 2 resistors I generally use 1 x 1K and 1 x 2K.Īrduino TX (pin 9) to BT module RX pin via a voltage dividerīoth Arduinos have the same connections to the BT modules. How a Thermistor Works Thermistors are variable resistors that change their resistance with temperature. However, the Arduino TX pin needs to be converted to 3.3v before connecting to the BT modules RX pin. 5V Arduinos will read 3.3v as HIGH so the BT modules TX pin can be connected directly to the Arduino RX pin. Most HC-05s and HC-06s have 3.3v TX and RX pins. open software serial connection to the Bluetooth module.īTserial.begin(9600) Connecting the Bluetooth Modules This can be changed but make sure you match the baud rate used when opening the software serial connection. The AltSoftSerial library can be downloaded from and it will need to be added before you can compile the example sketches.īoth BT modules are set with a communication baud rate of 9600. To communicate with the BT modules I am using AltSoftSerial which uses pin 8 and pin 9. Having a master and slave setup makes the programming a little easier. This is the one that initiates the connection and in the first example it is the one that sends the commands. I have designated one of the Arduinos as the master device. I am using 5V Arduino Nanos but any kind of 5V AVR based Arduino can be used. The setup process for the slave mode HC-05 is the same as the HC-06 in the previous post. One in master mode the other in slave mode. Before continuing you need to have the Arduinos and BT modules set up as per the previous post. And read temperature values using Android phone. Here we look at using that connection to get Arduinos talking over Bluetooth. Hi Does anyone know any software for Android phone that is able to receive temperature values from Android sent by bluetooth module I just want to connect: temperature sensor LM35 and bluetooth module to Arduino. In the Connecting 2 Arduinos by Bluetooth using a HC-05 and a HC-06: Pair, Bind, and Link post I explained how to connect a HC-05 to a HC-06 so that when powered they automatically made a connection.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |