# UART communication between LPC2138 (3.3V) and ATmega88(5V)

I want to establish UART communication between LPC2138 (3.3V) and ATmega88(5V). But since they are at different power logic level, i need bidirectional level translator in between both devices.

I come up with following part

As seen on above site, module has MOSFET, resistors and capacitors mounted on PCB. I want to know, Can it work in my case ( for UART comm )?

If TXB0104 is device used for interfacing, is below connection correct? Please check pin mapping and is there any pull up needed at LPC2138 or ATmega88 side or shown connection is enough.

Thanks.

A simple solution is to run ATmega88 at 3.3V and no external hardware is required.

If not, a cascaded two transistors could do the trick, or 2 stage Not gate (in both TX and RX lines). As the communication in the line is only in one direction. Thi will cost you afew money.

• is correct however it will reduce the speed grade and you have to use the crystal at 10MHZ – Lokanath Sep 2 '15 at 11:30
• @Lokanath UART communication is 9600b/s .. 115200 b/s maximum, that's speed which most of trasnsistors can handle. Any buffer module you could use is consist of the same hardware, and if it produce problems just use better transistors. But why specifically you mention 10MHz – Nasr Sep 2 '15 at 11:37
• see speed grades part in data sheet page no 1 ,the possibilities for operation at 3.3V is only if crystal used is 4Mhz or 10Mhz ,i just considered the higher speed – Lokanath Sep 2 '15 at 11:40
• You are right, I thought you are taking about speed will decrease when we use transistors with 5V power. – Nasr Sep 2 '15 at 11:43
• oh nono...not the transistor:) – Lokanath Sep 2 '15 at 11:46

The part that you suggested seems to work fine( however the supplier is lacking of some more depth information about the part). Just make sure that you make the right connections:

3V3 side - 5V side

LPC2138 TX -> ATmega88 RX

LPC2138 RX -> ATmega88 TX

Please refer this post to know difference between I2C AND USART

USART, UART, RS232, USB, SPI, I2C, TTL, etc. what are all of these and how do they relate to each other?

The part you have chosen has not shown anywhere that it can be used with USART but in fact I2C needs only 2 wires while USART needs 4 wires so your ebay part is not compatible since 2 wires are taken for power itself. I would recommend you using this

https://www.sparkfun.com/products/11771

http://www.tenettech.com/product/3148/voltage-level-translator-txb0104-breakout

http://www.robotshop.com/en/voltage-level-translator-txb0104.html

I am sure that the above device will meet your application requirements

Hope this helps

• To order this module from sparkfun, it will take some time to get it in India, Unfortunately, I have time constraint. If you can suggest some online module ( from indian origin ), it will be great help. Thanks. – Electroholic Sep 2 '15 at 11:36
• @Electroholic Updated links for india – Lokanath Sep 2 '15 at 11:44
• Thanks for your answer. But in datasheet, it's not mentioned that it can be used for UART. Can I use it in my application? – Electroholic Sep 2 '15 at 11:52
• please see the last comment in sparkfun.com/products/11771 ,a person has verified that it can be used for both UART and SPI – Lokanath Sep 2 '15 at 11:56
• without using level translator, if I use pull up at 5V line, will it work? – Electroholic Sep 2 '15 at 15:44