Arduino Bluetooth on Mavericks (Mac)

As part of my Fashion Arsenal project/game controller for my Intermedia class, I wanted to implement the use of a bluetooth serial module into my piece so that it could be wireless while reporting serial data to processing. This last week I’ve been researching how to do this. Initially I ordered two HC-06 bluetooth modules, but these were harder to find operational manuals for, and I couldn’t find a way to reverse engineer them using tutorials. I went back to Spark Fun and ordered their Bluetooth Mate silver and 6 pin female header to slide right onto my Lilypad 328.

I followed along with these three guides: I believe this is the “original” tutorial, by Jonathan Warren, people were using, and this gives a good break down for how to set up the bluetooth, but it is for a PC. Rio Akasaka then put together this really good tutorial for how to adapt the original tutorial to work on a Mac. This is how the process would have worked prior to Mavericks. I also used this guide by Spark Fun to figure out how their bluetooth device works.

The first sketch I used I got from the first two tutorials. Some of the other tutorials I researched said that I should download the software serial library in order to change my TX and RX pins to alternate pins on my arduino. That ended up being unnecessary for the Lilypad (it may still be necessary depending on how you hook yours up). Also the library comes as part of the main library in newer versions of the arduino software anyways, so you shouldn’t have to download it even if you want to use it. I used the sketch in this tutorial by simon72post for the second part of my testing process.

While this sketch is aimed at working with a PC, the sketch still works, and the hook up can be done the same as with the earlier tutorials. The LED I used in my test was the LED on the Lilypad board, and I just used my computer’s terminal program without downloading an alternative client like many other tutorials were suggesting.

If you read through the Spark Fun guide you can see that there are a lot of AT commands, these can be given to the Bluetooth once the connection has been made. I was able to type in SN,WhineyB to rename my bluetooth, and type in other codes to bring up information on the settings like the modem and baud rate. The default baud rate is already at its highest, so there wasn’t really anything I needed to change in the settings aside from personalizing the name. I may go back into this later to see what or why I might want to change the settings.

Arduino Bluetooth on Mavericks (Mac)

This is a link to a video demonstrating how I was able to hook up with my bluetooth device using the arduino software and terminal to send commands. The connection is still a bit unreliable if there is nothing to detect. I should also say that I have no prior background to working with bluetooth or the mac terminal, so while I was able to hook this up, I don’t necessarily understand if it is the best or only way to do so with Mavericks. I found that this was reliable, and I was able to repeat the experiment with both arduino and both bluetooth devices. I will probably go back at a later date and do the same experiment with the HC-06 modules I bought earlier.

The biggest thing that threw me off was assuming I had to link up with the bluetooth first before trying to send it commands. This worked counter intuitively. Also it seems as if the sketch needs to be uploaded through the FTDI cable, but then “re-uploaded” through the bluetooth serial. I can’t say that this is really uploading, it actually seems like that’s what triggers the connection to start rather than writing a sketch. From there you can write commands to the bluetooth in the serial monitor of the arduino software (unreliable) or more likely in the terminal client for mac (or alternative).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s