Arduino UNO UART protection resistors [SOLVED] - Page 1
Forum section: electronics / beginners

author: Lucky-Luka
author_rank: Unknown
timestamp: February 11, 2021, 08:02:59 pm
content: Hi allLooking at the Arduino UNO schematic I've noticed a couple of 1k resistors on the rx tx lines between the main IC and the ATMEGA16U2 (which should manage the comunication between the usb port and the ATMEGA328P).What are the those 2 resistors needed for?Protection?From what?Thanks

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 11, 2021, 08:11:11 pm
content: Probably in case one or the other MCU tries driving into another pin assigned as output.Tim

author: sleemanj
author_rank: Super Contributor
timestamp: February 11, 2021, 09:03:52 pm
content: Since the 328p can trivially be programmed by the user to set those pins to output high or low (eg digitalWrite(0, HIGH) ) while the other end is doing it's thing, it is inevitable that you'd get an effective direct short through that path at some point, the resistors solve that problem in the simplest way.

author: Lucky-Luka
author_rank: Unknown
timestamp: February 11, 2021, 10:03:07 pm
content: shouldn't this affect the logic levels?

author: pqass
author_rank: Super Contributor
timestamp: February 11, 2021, 10:52:11 pm
content: Quote from: Lucky-Luka on February 11, 2021, 10:03:07 pmNot really.Inputs are high impedance so whatever the voltage on transmitter side of the resistor will almost be the same on the receiver side (think of the 1K resistor as being in a divider with the high impedance of the input). Besides, it's a digital signal so the Voh of the output will be higher than the Vih of the input (similarly, Vol of output will be lower than Vil of the input), therefore, no flip H->L or L->H.See:http://www.interfacebus.com/voltage_threshold.html

author: PeteH
author_rank: Unknown
timestamp: February 11, 2021, 11:49:51 pm
content: Plus let's a pin header side of the UART take over the peripheral from the onboard MCU as well if you wanted to use it for something else.With series resistors, just need to worry about loading vs data rates, not an issue at typical UART rates but can impact rise/fall time.

author: Lucky-Luka
author_rank: Unknown
timestamp: February 12, 2021, 08:37:54 am
content: Quote from: pqass on February 11, 2021, 10:52:11 pmIn the graph of the site, which is the column for Arduino? The second one?

author: pqass
author_rank: Super Contributor
timestamp: February 12, 2021, 02:43:49 pm
content: Quote from: Lucky-Luka on February 12, 2021, 08:37:54 amThe linked graph is specifically for the popular logic families seen across the bottom.Since the ATmega328P can have a Vcc between 1.8 and 5.5, the thresholds will vary (by Vcc, current through the pin, temperature). See attached graphs taken from the 328P datasheet.So,@Vcc=3V: Vih ≈ 1.5V, Vil ≈ 1.2V, @Vcc=5V: Vih ≈ 2.7V, Vil ≈ 2.1V@Vcc=3V,0mA,25°C: Voh ≈ 3V, Vol ≈ 0V, @Vcc=5V,0mA,25°C: Voh ≈ 5V, Vol ≈ 0VNote: 0mA because there will be virtually no current through the output pin when connected to an input.So, if Vcc=5V, an H on the output pin (on the 16U2, assuming it has has the same levels) will produce 5V (Voh) which will flow through a 1K resistor and PCB trace into the 328P pin 2 (Rx) which will see it as an H for all voltages above 2.7V (Vih).Similarly, an L on the output pin (on the 16U2, assuming it has has the same levels) will produce 0V (Vol) which will flow through a 1K resistor and PCB trace into the 328P pin 2 (Rx) which will see it as an L for all voltages below 2.1V (Vil).Fun fact: This is why you can get away with interfacing a 3.3V IC to an Arduino, if the output's Voh > 2.7V (Vih of 328P). But the Arduino output must flow through a 1K/2K resistor divider into the 3.3V IC input to avoid damaging it.