Setting up Bluetooth to Bluetooth Master with HC-05 for my 16×2 LCD Office Door Sign
For my office door I’ve made a sign using a 16×2 LCD display controlled by an MSP430 and connectable via Bluetooth. A button lets me cycle through canned messages like, “The doctor is in,” and “At lunch.” Via Bluetooth I can give it an ad hoc message that I had not pre-programmed.
So that I can see what is being displayed outside my office, I have a second screen inside. The first screen is connected using the 4-bit LiquidCrystal library that’s available from various sources (originally the Arduino community I think). For the second screen I used an I2C daughter board and finally found (after much hair-pulling) an appropriate library called LiquidCrystal_I2C. There were a few libraries with similar or identical names, and they didn’t all work, so I’m making sure this library can be downloaded here as well. Download LiquidCrystal_I2C library for MSP430 and Energia.
The setup works fine with a Bluetooth dongle plugged into my computer, but I didn’t want to leave a Bluetooth dongle on my computer, so I looked for a way to use an HC-05 Bluetooth device (a couple of bucks on eBay) as a master and connect that to a serial or USB-to-UART plug on the computer.
I was dismayed by the terrible documentation I found all over the net for the HC-05 Bluetooth chipset. Finally I found a decent document from ITead Studio that gave me some specs, and Zak’s Getting Bluetooth modules talking to each other post filled in some missing pieces for me. In fact Zak’s post pretty much gave me everything I needed in the end, except that I still couldn’t get my Bluetooth slave device to pair with the HC-05 master…until I remembered that the Bluetooth slave device I have only can be paired immediately after power-up. Problem solved.
In the end I issued a series of commands like so:
The door sign now has a half-dozen canned messages and can display an ad hoc message with a message sent via Bluetooth. My home-grown protocol includes a password check to help guard me against my prankster office mates.
I also added in a four-button 433Mhz remote control (also a cheap eBay special). Now I have three of those buttons wired up so that one button cycles the messages, one returns immediately to the “I’m in” message, and one goes immediately to the ad hoc message.
The receiver for this radio outputs 5v, and the MSP430 is a 3.3v system. I am using the MSP430G2553 chip, and I could not determine if it is 5v tolerant or not. I know that some other MSP430 chips are not 5v tolerant (officially). I tried putting in a voltage divider, and I even tried going over some diodes to drop the voltage, but in the end I connected the radio receiver pins directly to three pins on the MSP430, and it seems to be doing OK (crossing fingers).