Part 2 describing the Receiver is here.
The code for this project can be downloaded from my GitHub page here.
This is a version of an earlier post I made, using HC05 and HC06 Bluetooth modules to make a wireless thermometer. This project uses an OLED Display on the receiver.
This post details the construction and setting up of the transmitter. I have used an Arduino Uno, but a Mega or even Nano could be used. The HC05 can be powered from 3 to 5 volts, but the Tx and Rx lines are 3 volts only. A logic level converter, like this one from Hobbytronics, which has a 250ma 3volt regulator that can be used to power the HC05.
HC05 Master/Slave Bluetooth
Bidirectional Logic Level Shifter
The connection diagram is shown above, connect a flying lead to the KEY pin unless your breakout board has a small push button fitted. This will be used to switch the HC05 into command mode.
Once the circuit has been built upload the hc05_command_mode.ino sketch. Connect the KEY pin to 3.3 volts (or press the small push button if one is fitted) and apply power, Once the sketch is running remove the connection to the KEY pin (or release the small push button if one is fitted). The HC05 should now be in command mode, running at 38400 baud, check this by opening the Serial Monitor, (set to 9600 and NL/CR) and type in AT and click SEND, OK should be shown.
To set the HC05 up to act as a Master Unit, with it in the command mode enter the following commands into the Serial Monitor, pressing SEND each time.
AT+ORGL this resets the HC05 to factory settings
AT+ROLE =1 this sets the unit to Master
AT+INQM=1,9,48. this allows up to 9 Bluetooth units to be able to connect
AT+CMODE =1 this sets the connection mode to allow any unit to connect
AT+UART=9600,0,0 this sets the baud rate to 9600
Once these commands have been entered remove the power. Now build the receiver.