Go Down

Topic: Arduino Pro mini DIgital pins voltage tolerance question (Read 3673 times) previous topic - next topic

Netoperz

Hello,

I'm working on project where i need to connect some stuff to the arduino.
For example bluetooth module HC-06
The modules are 5v powered, but they have Serial lines 3,3v

My question is:

If the arduino board is 5V 16mgz version is it safe to connect the serial interface from my modules to the digital pins of arduino ?

Everywhere where I was looking for answer, there was no clear answer if the digital pins are "safe" for 3.3 v serial modules ?

the documentation is telling that arduino 5v is 5v tolerant, but what is actual "High" signal ? is it 5v or is it less than 5V and is safe for modules that are using 3,3 v tel serial interface ?



Koepel

It's in the datasheet. The Pro Mini uses the ATmega328P.
http://www.atmel.com/devices/atmega328p.aspx
Complete datasheet, Page 313, for 5V the Vih Min. is 0.6 Vcc
That means that any voltage above 3.0 V is recognized as a high.

However, I had serial modules that gave a signal of around 3.0V and didn't work.

Netoperz

Thank you, i was checking the voltage on ATmega328P 16mhz 5v when pin was set to high, and it was oscillating between 3.7 and 4.1 V

It should be safe for 3,3v tolerant output/input modules connected to the atmega, but i cannot be sure, that's why i'm asking.

In Atmel world things are more complicated sometimes for someone like me working with Microchip till today :)


So can I assume, that connecting directly for example pin 14, or pin 2 of arduino pro mini to be used as TX with Softwareserial library  (version ATmega328P 16mhz 5v)  to the RX input of my bluetooth module HC06 (that is 3,3v level input)  should not burn the module :) ?

outsider

If your HC06 module is 5 volt tolerant, OK.
If your HC06 module is not 5 volt tolerant, not OK.

http://www.mcu-turkey.com/wp-content/uploads/2013/01/HC-Serial-Bluetooth-Products-201104.pdf

Page 9.

Netoperz

Most designs on the internet looks like this:

http://www.bitstoc.com/image/data/Products/arduino_bluetooth_serial%20-%20Copy.jpg



And that is why i was asking, because in my opinion it should at least look like this:

http://cdn.instructables.com/FSK/AI30/HMMFE6UO/FSKAI30HMMFE6UO.LARGE.jpg


Right ?

Netoperz

In case if someone would be looking for the same question, here is an answer:

http://fritzing.org/projects/voltage-divider

 The 1.2K Ohms & 2.2K Ohms resistors can be used as voltage dividers to drop the Arduino's 5V to about 3.3V. Also if you have 10K Ohms & 20K Ohms resistors they will do the work.

Exact equation for calculating the dividers is on the frizzing website for example, and well explained.

I know that BT modules do work connected straight on RX(module) <==> TX(Arduino) but it rather depends on luck than physics :)

So better just add two resistors and be safe.

Hope that will help others.

dlloyd

Here, it says:

"Warning: the Bluetooth chip is rated for 3.1V to 4.2V - connecting VCC to 5V is only ok if you are using a bluetooth module on a board like the JY-MCU Board which includes a voltage regulation circuit to limit the voltage, otherwise you will fry the Bluetooth chip on your module and be very sad."

Choose voltage divider method, but TxD-1K-2K-GND (in my opinion) would limit the maximum baudrate that can be used.

Here, they use TxD-680Ω-1K-GND. This would provide a stronger signal and have higher baudrate capability.

Note that when loading a 5V Arduino pin with 20mA, its voltage drops to 4.2V.
Here, I've used 4.6V in the calculation to get TxD-270Ω-680Ω-GND for even better baudrate performance.

Paul__B

There is an important trick to be learned from the Adafruit Huzzah ESP8266 breakout.

The level converter is a single diode.  That's it!


Clearly, the ESP8266 contains an internal pull-up, so you might need to add a pull-up to the HC-06.  You are driving it with an Arduino, so pick your value - 1k, 3k3 - whatever.  This will in any case be faster than a resistive divider.

dmjlambert

I have used a 10K-15K voltage divider connecting to the RX pin of HC-05 Bluetooth board and have not had errors at 115200 baud.  It seems extremely reliable.   What kind of speeds are we talking about where a voltage divider becomes a problem?

dlloyd

I really don't have experience with the HC-05 Bluetooth board itself, but a resistive voltage divider will always limit the rise/fall time of a signal. A 10K-15K divider seems rather weak ... its possible 115200 baud is near the upper limit.

With a resistive divider, any capacitive load is the enemy, so the length of connections, type of wire/cable and input capacitance play a role.

A 270Ω/680Ω from 5V to GND will draw about 5mA of current.


dmjlambert

This is great info, thanks!   So if not worried about 5mA, just go for the low resistance voltage divider for max performance.  If it communicates a lot, it is probably less than 5mA on the average, since the moments the TX pin is low it won't be drawing current. 

dlloyd

Oh, I just realized that although 5mA is OK for the Arduino, it might be too much for the IC on the Bluetooth module (I don't have a datasheet).

Therefore, the lowest values to use would be that of the RepRap link ... TxD-680Ω-1K-GND (at least this has been tested and implemented).

dmjlambert

Just about all the current would come from the TX pin on the Arduino, and little or none from the RX pin on the Bluetooth module, right? Because RX is just reading and is set for input.

dlloyd

Yes ... your right.  (I think I need some sleep now)

Paul__B

Fascinating.

I post the better solution and people just keep on talking about resistive dividers! :smiley-roll:

Go Up