Home > Uncategorized > Setting up Bluetooth to Bluetooth Master with HC-05 for my 16×2 LCD Office Door Sign

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.

Door sign using 16x2 LCD, MSP430, Bluetooth, 433Mhz radio

Door sign using 16×2 LCD, MSP430, Bluetooth, and 433Mhz radio

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 back of the door sign has a duplicate screen

The back of the door sign has a duplicate screen

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.

USB-to-UART dongle connected to an HC-05 device acting as a Bluetooth master.

USB-to-UART dongle connected to an HC-05 device acting as a Bluetooth master.

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:

AT+ROLE=1
AT+PSWD=1234
AT+INIT
AT+RNAME? 2013,07,122023
AT+PAIR=2013,07,122023,30
AT+BIND=2013,07,122023
AT+CMODE=0
AT+LINK=2013,07,122023

The HC-05 Bluetooth dongle, which can act as master or slave.

The HC-05 Bluetooth dongle, which can act as master or slave.

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.

Remote is used to cycle messages and jump to some directly.

Remote is used to cycle messages and jump to some directly.

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).

  1. August 12th, 2015 at 01:31 | #1

    Blog is great regarding electronics. I am a student of electronics engineering and its been great that I have project based on bluetooth devices.
    Well what is the best way that I can connect my room fan with Bluetooth that it will automatically operate with my mobile device?

  1. No trackbacks yet.