|Page :||[ 1 ]||[ 2 ]|
Quite some time ago I wanted to look at how to control things from my phone via Bluetooth. After some reading BLE seemed the way to go. Searching around I found Red Bear Lab and bought one of their "BLE Mini" boards. They are based on the Texas Instruments Texas Instruments (TI) CC2540I. I think I paid around $25 for it. They are very easy to work with and those guys also provide a nice library and sample software for iOS (Android too) which was VERY useful.
Since then I bought soem different modules based on the same chip. These are a particular variety called HM11 from a company called JNHuaMao Technoloy Company (at least that's what it said on the datasheet I happened to use for it). They look like this:
The good news is the software Red Bear provides works with the HM11. I'm going to discuss that here and what you need to get it talking to an iOS app. Also I'm going to discuss making a wrapper class so you don't have to modify any of Red Bears code.
They also provide as part of the download some code for using an Arduino to communicate with the BLE module. These devices offer a UART connection to communicate with so you need something like an Arduino to use them. The TI CC2540I chips are actually a SoC so if you were motivated you could write your own firmware for them and use it's i/o to do useful things and thus eliminate the need for another microcontroller. I'll be using an Arduino or an ESP8266 or something similar :)
Since these modules aren't easy to handle in respect to getting them wired up for testing it's a good idea to make a breakout for it or procure one from somewhere. I've also seen people solder wires directly to the sides of the board which would work also but to me ssems like a fragile solution.
Here's one I made. It's a bit bigger than I should have made it but it works! Still has flux on it in this pic :(
The first thing you'll need to do is hook the HM11 up to an arduino. RX, TX, 3.3V and GND. You'll probably need to make a breakout for these as they arent exactly breadboard friendly nor do they have any pins. Also be careful and make sure you supply the 3.3V it wants.
Load up something like the SoftwareSerial example Arduino sketch onto your Arduino. The HM11 defaults to 9600 Baud so be sure to set up your sketch with that. For the hardware serial I used 19200. Then in the Serial Monitor I selected "No Line Ending" for sending data.
You should be able to send AT and the module should respond with OK. Perhaps you'll need to fiddle around with the settings a bit before you see an OK response. Once you get that OK you're good to go.
In the Datasheet/Manual youll see all kinds of "AT" commands for configuring and using this thing.
Here's a few handy ones. The first line is the command and the second line is a sample response:
AT OK AT+NAME? OK+NAME:HMSoft AT+NAMEMyNewName OK+Set:MyNewName AT+TEMP? OK+Get:025.016 AT+UUID? OK+Get:0xFFE0
For now I'll assume its set to factory default and use those settings.
The RedBear software is located on the link I mentioned earlier on their product page for the BLE Mini. Download it and open it up.
Next page I talk about the iOS library from Red Bear..
|(Page 1 of 2)|