HC-06 and Arduino (includes simple project!)

I have been given HC-06 Bluetooth module and a stepper motor from the lecturer to explore. Both of them are extremely interesting and fun to play with, but I decided to write about HC-06 since this module allows me to make much more interactive projects. Now let me explain briefly what it is.

HC-06 is a very popular and inexpensive module that uses serial communication via Bluetooth. It allows us to wirelessly communicate between Arduino and any Bluetooth device, such as laptop, Android or iOS device. HC-06 can receive and send data to the device that is paired and connected. However, HC-06 can only accept a connection from outside, it cannot initiate one. It means it can only work as a SLAVE.


The device that is able to initiate the connection is called MASTER. There are Bluetooth modules that can be both MASTER and SLAVE, for example HC-05. Those properties the given by the manufacturer and they cannot be changed via AT commands.

AT mode

AT command mode allows you to interrogate the Bluetooth module and to change some of the settings:

  • the name
  • the baud rate
  • operation in slave mode or master mode. (HC-05 ONLY)
  • etc.

It is not needed now, but is you want to read more about AT mode and the commands, see further reading section at the bottom of the site.


HC-06 can be supplied by a range of 3.6 – 6V. That means it can be connected straight to the Arduino. However, the input (RXD) and output (TXD) pins operate on 3.3V. For the output it is fine to connect it straight to the Arduino since the microcontroller will recognize 3.3V as HIGH signal. But Arduino outputs the signal of 5V, therefore it is essential to put a voltage regulator or a 1kΩ resistor to ensure that HC-06 will not be damaged.

Project! (simple)

I decided to share with you this simple project of wirelessly controlled LED lamp. It uses HC-06 to receive data from the Android device, serving as a wireless ON/OFF switch. let’s see the scheme of the circuit and let me explain it briefly:


It is a very simple setup. D13 goes to the LED with 500Ω resistor, it will be our lamp. D11 goes into the RXD (the input of the HC-06) not that I used a 1kΩ and a 2kΩ resistor to lower the voltage. D10 goes into the TXD (output), GND to GND, and 5V to power up the HC-06.

Even though physical serial ports of the Arduino are on the D0 and D1 pin, I decided to use a SoftwareSerial library to create a digital serial port for my HC-06. Otherwise, when using the original ports, I would not be able to upload my code via USB, as HC-06 would “steal” my serial connection.

Code is here: https://create.arduino.cc/editor/BecNoir/c025de4d-1a0b-4e1d-8f55-c96d97f5df8f/preview?embed

As you can see, I set up the device to read the input from my Android phone. How do I do that? I just simply need any serial monitor app from the Goggle Play. You can find the one I’m using here. In order to use the app, I need first to pair my phone with the HC-06, I should be able to find it in the list of Bluetooth devices. The password to pair is commonly 1234. After that I just need to select my device in the serial monitor app.

A video of working circuit is here:

Next time I will try to combine HC-06, sound sensor and a servo in a group project with Thomas!

References and further reading:

Happy creating!



First mini project – Dice simulator

Hi! I am back from playing with the Arduino for a couple of days. As I mentioned in previous post I wanted to do something with the LEDs. Since I am more ambitious than making a simple blinking light (which I made obviously as my very first circuit and coding), I looked for some inspiration. What interactive can I make out of LEDs?

When looking at the tabletop board games I just got an idea of what can be made. A LED dice simulator!


A single D6 has got 6 outcomes: from one to six. Quite obvious. and they look like in the photo below.


If I want to create an LED version of all possible faces of a dice, I need 7 LEDs in total:

  • 3 LEDs on the right and left side, vertically in line, total of 6
  • 1 LED in the middle

At a first glance it looked like I need 7 digital pins to connect each LED to Arduino separately! Well, that’s a lot for such a simple project. Therefore I thought about a way to reduce amount of pins needed.

As I took a closer look at each face of the dice, there are patterns that are easy to reproduce using a series of 2 LEDs. This simple drawing of a circuit below should explain it.

A quick draft of a LED series. I used 560 Ω resistors.

I created 4 groups of LEDs. 3 of them (G1, G2, G4) consists of 2 LEDs in series that will light up simultaneously when powered up. One group (G3) is a single LED in the middle. With those groups you can still create every face of a dice using only 4 digital pins. Let me show you all the sequences:

  • result = powered group(s)
  • one = G3
  • two = G1 or G4
  • three = G3 and (G1 or G4)
  • four = G1 and G4
  • five = G1 and G3 and G4
  • six = G1 and G2 and G4

I also wanted to have a button that would serve as a rolling button. So whenever you press the button, the LEDs will light up in one of those sequences.

I built a circuit that looks like this:


That’s a lot of jumper wires, one would say. But after brief testing every LED group works as intended.

As you can see, groups of LEDs are connected to the D10 – D13, and the button input is connected to D2. Make sure to use a high resistor at the output of the button to avoid random activation of the LEDs (I used a 10kΩ resistor).

Now, coding time! Code for the dice simulator is very simple, it just consists of many if statements.

https://create.arduino.cc/editor/BecNoir/d0f922fa-719c-4cf6-a8d3-3bf3b5b1b149/preview?embed < click to access code!

Mini FAQ:

Q: Why random(5); instead of random(6);?

A: In programming, logically, zero is the first number not one. So when you random(5); you are actually randomizing 6 numbers between 0 and 5.

Video of working dice simulator:

If you want to read more about relevant functions used:

My next mini project will probably involve a module or a motor! Stay tuned for the next post!

Happy Creating!


The beginning of an Arduino journey

Hi! Welcome to my first blog entry! My name is Lukasz Staszewski, but I will be posting under my alias: BecquerelNoir. This blog will be themed around the popular microcontroller Arduino and any my problems, solutions and other encounters while working with it.

I got my Arduino experimentation kit from the university. It features all the basic equipment that I need to start playing with it – bunch of jumper cables, range of resistors, LEDs, a DC motor, a basic servo, potentiometers, buttons etc. I would not say that is a lot of stuff, but that is more than enough to start from scratch.


Just from looking at the kit I am more and more excited to try it out! Since I have some previous knowledge about coding (C# in simple Unity games), it should be easy for me to settle into the Arduino integrated development environment (IDE). I am already thinking about creating something nice with some of the LEDs I got. I need to watch a couple of simple projects to get inspired to make it!

I highly encourage you to visit those sites to get more information about Arduino:

See you soon!