Wednesday, February 11, 2015

Adding a HC-06 (JY-MCU) Bluetooth Module To an Arduino or Spark Core Project

JY-MCU Bluetooth Breakout Board
I picked up a HC-06 (Part JY-MCU, ) from Vetco Electronics today to add a Bluetooth serial port to projects I am working on. I wanted to hook this into a Spark Core and so I wired it up and tried to pair with it.

No luck. I could not see the Bluetooth module from my phone or from my Mac. Why?

A little searching and I came across Erich Styger's post (Getting Bluetooth Working With JY-MCU BT Board v1.06)trying to figure out the same thing. He is way more advanced than me but he found both a hardware solution and a software solution. Since I did not want to modify the board (and I was sitting at Starbucks hooking this up) I went with the software solution.

The sort answer was, to get the Bluetooth module to start broadcasting for pairing I had to add the following to my Sketch (code for the app):

#include "PORT_PDD.h"

PORT_PDD_SetPinPullSelect(PORTC_BASE_PTR, 3, PORT_PDD_PULL_UP);
PORT_PDD_SetPinPullEnable(PORTC_BASE_PTR, 3, PORT_PDD_PULL_ENABLE);

Erich also has a great article on Using The HC-06 Bluetooth Module which I am digging through to understand my Bluetooth module a little better.

No comments: