0
\$\begingroup\$

I am busy with a project where I am connecting a 5V(Amtel ATMega328) MCU to an 3V(ESP8266) via the serial port. Obviously I need some logic levels converted. I looked at the schematics of several open-source ones on the market to gain a understanding of how other people tackled this problem. On a side note I did build a voltage divider circuit just to start on something basic(just want to be sure I get the concept).

So I reviewed the FreeTronics logic level converter that uses a BSS138LT3G for logic level conversion. This makes some sense as it appears that this design is using a transistor with a low drop out to convert between voltage levels. You can find the schematic for freetronics logic level converter here.

I then looked at the Adafruit HUZZAH schematic board expecting to find one of the following components a voltage regulator or a MOSFET transistor or voltage divider of some sorts. Well I found the voltage regulator SPX3819 on the board but then I realized the serials pins where not using this at all...

When I studied the schematic I found that a 1N4148 diode was connected to the FTDI RX(receive) pin. I never realized you could use a diode this way(I am learning). So since this is a high speed diode it obviously causes a voltage drop from 5V to around 3V by the high speed switching almost like a PWM function would(Educated guess could be wrong). It seemed simple and elegant but then I noticed that they did not do the same on the FTDI TX(transmit) pin.

So at this point I am confused why would you convert a 5V input to the RX pin to 3.3V and then not convert it on the outgoing pin. Surely a serial port cant accommodate both voltages unless it is specified to handle it. Send 5V and receiving 3V just felt wrong.

Now I am speculating at this point but from my understanding, serial data transmissions are essentially bits being transmitted. A 5V being on and 0V being off. However I don't think that is realistic. How can I always have a 5V and 0V with components heating up, resistance variance and all the other factors in electronics? I suspect this designs works because 3V is above the 2.5V mark and the AMTEL MCU reacts to this voltage level like it was ON/1/YES bit being transmitted.

Now if my theory holds are there any risks with doing serial communications between an AMTEL chip and ESP chip via serial this way?

Or maybe I am just mad and missing something very obvious.

\$\endgroup\$
2
\$\begingroup\$

Whenever the 5V device transmits, it pulls the bus down, and the diode conducts to 0.5~7V, when it releases or pulls the bus UP to 5V, the diode blocks the current from flowing, and a resistor on the 3.3V device should pull the bus on the 3.3V side back to 3.3V.

Whenever the 3.3V device transmits, the "HIGH" (about 3.3V or a bit less) is supposedly inside ATMega328's specs for VinHIGH (3.0V to 5V) and the "LOW" is inside the VinLOW threshold (1.5V to 0V).

enter image description here

p.s.: the risks that I can see are having problems with the bus if ESP VoutHIGH is not high enough, if the diode is not fast enough or if the resistor is not strong enough to pull the bus in the speed you need. I dont think any of these will risk burning the ports though..

\$\endgroup\$
  • \$\begingroup\$ So my theory about the 3V being enough for a HIGH signal seems valid. I should have studied this more at school. Will accept the answer in a day or so if nobody gives a better answer. Thanks for helping me confirm I am not completely wrong.... \$\endgroup\$ – Namphibian Aug 27 '15 at 9:31
0
\$\begingroup\$

To add to Wesley's answer, the resistor on the 3.3V side of the diode is an internal pullup resistor on the RX pin of the ESP8266. This pin is connected to the RXD pin on the ESP12 breakout module that Adafruit uses in the Huzzah.

Also, ViL for the ESP8266 is 0.25Vcc, or 0.825V for Vcc = 3.3V. Therefore, a voltage of 0.5~0.7V on the 3.3V side of the diode still counts as a LOW input.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.