Electronic – arduino – Low power serial bluetooth module with Arduino

arduinologic-levelresistorsvoltage divider

I plan to use the HC-06 serial bluetooth module with an Arduino Leonardo. To my knowledge, the Arduino's serial pins output at 5V with 40mA of current. The HC-06's datasheet says it will accept input at 3V – 4.2V with 20mA – 40mA of current. I'm more of a programmer than an electrical engineer, but this tells me I will need a resistor between the Arduino's TX pin and the HC-06's RX pin. From my calculations I will need a resistor with 82.5 Ohms of resistance:

$$r = \frac{V}{I} = \frac{3.3V}{0.04A} = 82.5 \Omega$$

Is this the correct way to solve the problem? Online I've seen people solve the exact same issue using a voltage divider with a 10kOhm resistor leading from the Arduino's TX pin to the HC-06's RX pin and a 20kOhm resistor leading from the HC-06's RX pin to ground. So, what's the correct way to solve this problem? If a voltage divider is the solution, why and how does it work? Or why does simply putting in a 82.5 Ohm resistor not work?

EDIT: For simplicity sake, let me reiterate my question from a more general perspective. The HC-06 module requires a power supply voltage of 3.3V (which can come from the Arduino's 3.3V pin) and will also only accept logic inputs at 3.3V. So, what is an easy way to achieve this voltage reduction for the serial wire?

Best Answer

There are two main sets of characteristics quoted for pins, absolute maximum ratings and typical ratings.

The HC-06's datasheet says it will accept input at 3V - 4.2V with 20mA - 40mA

Those are absolute ratings. The pin is rated to handle 3V to 4.2V and 20mA - 40mA current. In a normal circuit, digital input pins will draw very little current, as they are CMOS logic gates. There might be a pull-up resistor, that connects the pin internally to Vcc, or a pull-down resistor, that connects the pin internally to GND, which will increase the current draw.

Without the pull-up or pull-down resistor enabled, the pin has very high input impedance. Your proposed one resistor circuit looks like this:

schematic

simulate this circuit – Schematic created using CircuitLab

You effectively have a voltage divider with the other resistance being the input impedance of the HC-06 input pin.

So the voltage on the RX pin with 5V on the Arduino TX pin would be:

$$ V_{RX} = 5V \frac{R_{really\,really\,big}}{R_{line} + R_{really\,really\,big}} \approx 5V$$

This is outside the maximum voltage rating.

Solution

The solution is to use some kind of level shifter. The resistors in the divider should be high enough not to violate the Arduino maximum current output and much less than the input impedance of the input pin. They also must be low enough that the input capacitance of the pin doesn't 'smear' the signal too much (slew rate). You can think of the capacitance as resisting the change in voltage, so sharp inputs start to get rounded off: (image taken from http://www.johnloomis.org)

enter image description here

For you quoted figures we would then have:

$$ V_{RX} = 5V \frac{\left(\frac{1}{20K} + \frac{1}{ R_{really\,really\,big}}\right)^{-1}}{10K + \left(\frac{1}{20K} + \frac{1}{ R_{really\,really\,big}}\right)^{-1}} \approx 5V \frac{20K}{10K + 20K} \approx 3.3V$$

In Arduino land, people would by a logic level shifter board for this purpose. One common one has a voltage divider for 5V TX to 3.3V RX, and a transistor for 3.3V TX to 5V RX. Others have transistors both ways, so that the voltages can be different from 5V and 3.3V as using a voltage divider the ratio is fixed, and to effectively have a very low output impedance on the TX pins and thus avoid slew rate problems.

enter image description here

Related Topic