Bluetooth module
So I ordered and received a bluetooth module. It is the famous HC06 module. This module is capable of connecting your Arduino to an Android phone-tablet or whatever !! Home automation gets in reach. If you order one make sure it is the HC06 that is put on a base plate.
The green PCB is the actual HC06. The blue PCB beneath it is the baseplate.
The module being on a baseplate has some distinct advantages. First there are breadboard headers mounted which makes it easy for experimenting. Second the HC06 is actually intended to work on 3.3 volts. The version on the baseplate heowever also works on 5 volts. That makes my life a lot easier.
Lets have a look at the backside:
As you can see the module on the baseplate is suitable for a voltage level of 3.3V to 6 Volts. Ideal for working with my standard Arduino and Attiny85.
Wait a minute. Yes I intentionally mentioned that this will work with an Attiny85.
In the Arduino software you will need to include the SoftwareSerial library which is standard supplied with the Arduino IDE. For an Arduino Uno and an Arduino Nano you just have to attach the HC06 TX pin to the RX pin of the Arduino and the RX pin to the TX pin of the arduino. These are normally pin 0 and 1. Makes sense doesn't it. The processor is transmitting so the HC06 has to receive and then other way round.
When using this module with an Attiny85 SoftwareSerial allows you to use any pin of this micro for the communiaction. It is set with the following commands:
#include <SoftwareSerial.h> //Software Serial Port
#define TxD 0 //pin 5 from Attiny85 to pin RXD of the bluetooth module
#define RxD 1 //pin 6 from Attiny85 to pin TXD of the bluetooth module
SoftwareSerial blueToothSerial(RxD,TxD);
As you can see we normally use the same pins for the communication as on the larger Arduino versions to make life easy
On the front side of the HC06 there is a red led which will blink as long as there is no connection between the HC06 and another bluetooth device. As soon as there is a connection the led will be on. As soon as connection is lost it will blink again.
When pairing with another bluetooth device the HC06 will be the slave unit. So your Android phone or tablet will be the masterunit. When they first make contact the HC06 will ask you to enter its password. That way you can be sure communication will only be allowed between these two units. The standard password for the HC06 is 1234.
If you follow this blog maybe you want to order one of these. They are fun to play with and I have several small and large projects coming up using this module. First step is to control a relay with an Attiny85. Next step is to do that with your Android Phone.
Till then have fun.
Luc