Introduction: Correct Arduino UNO Bluetooth
This little Instructable is a spin-off from our Creative Robotix instructable project. We needed a way to conveniently communicate with an Arduino UNO/MICRO/NANO using the hardware Serial via Serial Bluetooth, but without interfering with the Arduino programming cycle, using the standard Arduino Bootloader. We also wanted to respect the Bluetooth modules signalling levels of 3.3 volts. We came up with a straightforward solution using a voltage divider to deal with the transmission voltages from the Arduino and a simple 'bus' like solution using a transistor to manage the two serial receive lines between the hardware UART on the Arduino and the Bluetooth module.
- Arduino UNO / Micro / Nano
- 2 10K resistors
- 1 20K resistor
- 1 2N222A transistor (or virtually any other NPN transistor)
- 5 patch wires
- 1 cable tie
- Basic assembly tools, and if preferred, some electrical tape for insulation
Estimated build time, 10 minutes.
Step 1: Wire-up the Voltage Divider...
The Bluetooth module we are using, the HC-05/06, operates on 3.3 volt signalling, the Arduino board we are using operates on 5 volt signaling. The 3.3 volt transmissions from the Bluetooth module to the Arduino are fine, in 5 volt logic a logic 1 is seen as a voltage greater than 2 volts, so we're all good. However, the 5 volt transmissions from the Arduino to the Bluetooth module may cause very bad things to happen to the RX input, over driving the input potentially causing damage, so we need to regulate these transmission voltages down to an acceptable level. This can easily be achieved with a 'voltage divider'. In this case we need to bring 5 volts down to 3.3 volts, so we need a 20K resistor across the modules RX input to ground and a 10K resistor from RX the input. The RX input resistor will connect to the the TX output on the Arduino Uno.
- How to 'read resistor values'
- The 20K resistor will be banded red, black, orange
- The 10K resistor will be banded brown, black, orange
Step 2: Prepare the Transistor...
We need to create a 'bus' line for the serial TX output on the Bluetooth module, this will allow us to have the Bluetooth module and the USB serial device connected together at the same time. To implement this 'one line bus' we need to use a transistor. Here we use one PNP, 2N222A, transistor and a 10K base input resistor.
Step 3: Attach the Transistor to the Bluetooth Module, Wire-up and Test.
Using the long nosed pliers connect the transistors Emitter to the Bluetooth modules TX output. Ensure there are no short circuits. Strip off a group of 5 wires from a main patch cable set and connect to the Bluetooth module. Loop back and secure the cable with a cable tie. The unconnected transistor leg connects to the RX input on the UNO and the base resistor on the transistor connects to the RX enable line on the UNO, we use Pin 12.
Test using the attached script, with Pin 12 activated you can send and receive on both the USB and Bluetooth serial without interference.
Wiring in the picture:
- Orange wire is +5 Volts
- Yellow wire is GND
- Purple wire connects to the base resistor connected to the transistor and is the activation line to Pin 12
- Blue wire connects to the RX resistor on the Bluetooth module and to the TX output, Pin 1, on the UNO
- Green wire connects transistor leg on the Bluetooth module and to the RX input, Pin 0, on the UNO