Posted on Leave a comment

ProGrow Update #5 – Bluetooth using HC-06

Progrow Side - Feb 16 2017. HC-06 visible in the top right

I’ve been severely neglecting the ProGrow the past couple of weeks. The cat grass died a while ago, but I’m planning on planting some catnip in the future. Right now, I’m going to try to focus on getting some wireless functionality into it. I have an ESP8266 module that is capable of adding Wifi to the system, but I also have an HC-06 Bluetooth module. I’m going to test out the Bluetooth for now, so that I can send commands to it from my phone or PC.

The HC-06 and HC-05

HC-06 with Breakout Module Front View
HC-06 Bluetooth chip with breakout module, Front View

The HC-06 and HC-05 are inexpensive and easy to use Bluetooth modules. The 05 and 06 are virtually the same, but the HC-06 is only capable of acting as a slave, while the HC-05 is capable of acting as a master/slave. The blue board in the picture above is a breakout board with a voltage regulator for the primary chip.

Adding the HC-06

It’s incredibly easy to wire up the HC-06. All I had to do to connect it to my Arduino UNO was:

  • VCC to 5V
  • GND to GND
  • TX to Pin 2
  • RX to Pin 3

If your module has a breakout board attached, then it will be 5V tolerant. If it is a bare module, you’ll need to make a voltage divider in order to provide 3.3V to the chip.

 

HC-06 with Breakout to Arduino UNO Schematic
HC-06 with Breakout to Arduino UNO Schematic

Connecting with the HC-06

I’m using the library SoftwareSerial to utilize my digital pins 2 and 3 as RX/TX,  instead of 0 and 1. This is because when you have something connected to pins 0 and 1, and try to upload to the board via USB, it can cause a communication issue. At least it did that for me.

All I had to do was include the SoftwareSerial library, and then initialize pins 2 and 3 using:

SoftwareSerial HC06(2,3); //RX, TX

That way I can use “HC06” for serial functions on different pins. It has to go before the setup function.

 

I’m using a Bluetooth dongle on my PC to send commands to the HC-06. I can connect to it with the Windows Bluetooth interface, using the default password of 1234. I’m using PuTTY to connect to the COM port that is associated with sending data to the HC-06, and then I send commands through the PuTTY terminal.

I can read data that is sent to the HC-06 using:

btData = HC06.read();

Then I can use a simple if statement to make decisions based on whatever value I sent to the module. For example:

if (btData=='1'){
    displayData(); //displays all sensor values on screen
}

 

What’s Bluetooth needed for?

Right now I use the Bluetooth to issue basic commands wirelessly. I can send commands to the ProGrow from my computer using Putty. I can have the system output to the display, water the plant, write to the SD card, change the automatic sample delay and force a measurement.

 

What’s next?

I want to use an HC-05 module instead, which will give me many more connectivity options.

I am going to design new cases for all of the modules. My goal is to create a single box that will house all of the primary components, instead of having them distributed across the front or side of the container. I also want to get some catnip planted.

 

 

 

 

Leave a Reply