Bluetooth HC-05 Mac Programmer App
After spending time writing a sketch for the Arduino so I could program the HC-05 Bluetooth modules, I had a mind tweak that the same should be able to be done with the Mac here. And since I’m a Macintosh programmer by nature, why not.
That’s right, there’s now an App for that.
I tried a couple of different USB to Serial (TTL) adapters and the one that worked the best and most reliable was the CP2102 from Silicon Labs. The 2102 is a USB to UART bridge chip. You can find these littered on FleaBay for a couple of bucks.
I used some Dupont jumpers to connect the HC-05 to the adapter:
Wiring wise it’s this:
- CP2102 —> HC05
- 5V ——-> 5V
- GND ——> GND
- TX ——-> TX
- RX ——-> RX
- 3.3V —–> KEY
There are no connections on the CP2102 RST or the HC05 STATE lines.
Notice the TX–>TX and RX–>RX. If you’re thinking that’s not quite right, in the real world it’s probably not. In the fantasy world where the Bluetooth modules are made, the labels indicate where the signal is SUPPOSED to go. So the TX pin silk screen on the HC-05 means it’s supposed to GO to the TX on the UART adapter. Apparently some not so terribly bright engineer thought this might be a simpler concept for the unwashed masses to grasp. News flash for them, if your IQ is higher than an Alaskan winter temperature, this is dumb labelling.
Thus, be aware that if you use different Bluetooth modules, you MAY find the labelling is different. Just saying…
A close up of the connections:
If you’re wondering why the KEY connection has 3.3V going in it, it’s because in order to get the HC-05 in command AT mode, you need to make the KEY line HIGH when the HC05 powers up. Since there’s a 3.3V output on the USB to Serial adapter, it’s easy to do that.
The Macintosh program to program the HC-05 can be downloaded from THIS link. Unzip the file, put it in your Applications folder, wire up the modules, plug in the USB to serial adapter to the Mac (install the SLAB drivers if you haven’t already) and then run iBT.
Note, when you plug in the USB to Serial adapter and the HC05 powers up in the AT mode, the LED indicator will blink, slow. Very slow. About every two seconds, on, then off.
In the Preferences tab, just match your settings to these, and then click the Bluetooth ON button.
Switch to the Bluetooth panel and the information should fill in for you. If it doesn’t, “sum ting wong”. Recheck the wiring. Once properly wired you’ll see the window values change, as the carnival barker used to say, “Before your very eyes!”.
Change what you want and click the SET button beside that option to update the HC05. iBT will write JUST that data to the HC05 for you. If you get an error, iBT will report it.
The UART setting is the Bluetooth wireless connection speed NOT the programming speed via USB. With USB these modules are always 38400,N,1.
A lot of these modules come with a passcode of ‘1234’, but the Mac’s normal default is ‘0000’, so you might want to change that.
The Set Default button will reset the HC-05 to this:
- Device Type: 0 (Class)
- Inquire Code: 0x009e8b33
- Mode: Slave
- Serial (wireless): 38400,1,N
- Passcode: 1234
- Name: H-C-2010-06-01
So there you have it. HC-05 programming from your Mac made simple. iBT written by Mel Patrick is NOT public domain, but freeware. It may be used by anyone but may not be sold or hosted on any other site.