The HC-06 defaults to AT mode when first powered on. Connect the Hc-06 module and communicate using the serial monitor Connect the HC-06 RX to the Arduino TX on pin 3 through a voltage divider. SoftwareSerial BTserial ( 2, 3 ) // RX | TX // Connect the HC-06 TX to the Arduino RX on pin 2. NL+CR should not be added to the command string // #include The default baud rate is 9600 // The Hc-06 requires all AT commands to be in uppercase. Basic Bluetooth sketch HC-06_01 // Connect the Hc-06 module and communicate using the serial monitor // // The HC-06 defaults to AT mode when first powered on. Once you have communication working you can change the baud rate to suit your needs. Other modules have a different baud rate. The HC-06s I have have a default baud rate of 9600. The Arduino is acting like a relay station between the serial monitor and the BT module. The sketch also takes whatever the HC-06 outputs and forwards it to the serial monitor. The following sketch takes whatever is entered in to the serial monitor on a host computer and relays it to the HC-06. I use software serial to talk to Bluetooth modules and use the hardware serial for debugging. We can do this by using software serial on the Arduino. HC-06 TX to Arduino pin D2 (RX) connect directlyĪfter connecting everything we need to talk to the HC-06. HC-06 RX to Arduino pin D3 (TX) via a voltage divider HC-06 Vin to 5V (can be from the +5V out from the Arduino) The Arduino will read 3.3V as a HIGH so the HC-06 TX pin can be connected directly to the Arduino. I am using a 1K ohm resistor and a 2K ohm resistor. A simple voltage divider can be created using 2 resistors. This means a voltage divider is required to connect to a 5V Arduino. The RX pin can still only accept 3.3V though. The HC-06 breakout board has a 3.3v regulator that allows a larger input voltage to be used, in the range of 3.6 to 6 volts. The Bluetooth module the ZS-040 is based on, the EGBT-046S, is a 3.3V device. After the HC-06 is connected to another device the LED stops flashing and is constant on. This is indicated by a rapidly flashing LED. The HC-06 defaults to AT mode at power on. I also have some HC-05s which share the same PCB and are also labelled as zs-040. There are several slightly different versions of the HC-06, however, all seem to use the same firmware and have the same AT commands. Once it is connected it simply relays what it receives by bluetooth to the Arduino and whatever it receives from the Arduino it sends to the connected device. The HC-06 is a slave only BT module that is fairly easy to use with the Arduino using serial communication.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |