Serial protection for multiple talking Arduinos

Hello

The project that I’m involved now consist in one Arduino “master” that sends commands via serial to three others “slaves” Arduinos… and this ones, occasionally send some message to the master.

I have everything working perfectly, but in my researchs, I’ve seen a lot of posts about “serial pins protection” using resistors and diodes.

I investigated a lot and the conclusion that I arrived (with my limited knowledge) is described in the attached schematic.

Also, in case that I must use the resistors and diodes described (or any other that you correct me) I’ld like to know if the 5V where the Tx pin should be conected through a pullup resistor is the VCC pin located at the “In-Circuit Serial Programmer” block located at the back or the board or if all 5v in the Arduino are the same.

To the left of the schematic is the bare circuit without any resistor or diode and at the right is what I “think” the circuit should be for protection.

Please let me know if it is correct because I don’t wanna fry any board :slight_smile:

Thanks in advance.

Serial Protection Schematic V1.pdf (386 KB)

There is only one 5V

Hi,
How do you have the Tx/Rx of the master and slaves connected?

Wouldn't it have been easier to go to RS485 or CanBus?

Thanks. Tom.. :slight_smile:

That circuit offers no protection at all. You are miss understanding what you are reading.

The danger comes when one serial output is low and the other is high, there is nothing to stop a short circuit which will burn out both Arduinos.

Hello

TomGeorge:
How do you have the Tx/Rx of the master and slaves connected?

Crossconnected… Tx from master to slave’s Rx and then Tx from slave to master’s Rx

TomGeorge:
Wouldn’t it have been easier to go to RS485 or CanBus?

I’m a beginner, I have no clue about how to deal with that… I made a huge research to arrive to this point :confused:

Grumpy_Mike:
That circuit offers no protection at all. You are miss understanding what you are reading.
The danger comes when one serial output is low and the other is high, there is nothing to stop a short circuit which will burn out both Arduinos.

Oh… :o :o Attached is the code (due to size) where you can check if there is something that could put the pins in that situation…
What you reconmend to do?
1- Maybe to put something in the code that “check before read” if the condition of the pin is safe?
2- In the setup make the pins both low?
3- Or is just not neccesary the protection if the code is well written?

Please help me go in the right direction.

Thanks

Arduino_Slave_03.ino (9.13 KB)

Hi
Please take into consideration that all the Arduinos are very close to each other... not even 10 inches sepparate them.

Thank you.

What you reconmend to do?

I would recommend that the TX out of each slave Arduino is connected to a non inverting open collector buffer. Then wire the three buffer outputs together and add one pull up resistor. Then wire that to the RX input of the master.

In that way any one of the TX outputs can only pull down as they are merged and so you can not get a short.

Ok, I researched and see that is a microchip as the SN7407N.

I have worked with 74HC595 and 74HC165 before.

I'll investigate how to use this and when learn how-to, I'll make a new schematic and return here to check together if it is ok.

Thamk you so much :slight_smile:

Ok, here I am…

After research, I’ve found that the SN5407 would be ok. It has 6 channels so I could add more slaves later on.

As sugested, I added the chip to the Tx of the slaves, put the outs together, then a pullup resistor and that to the Rx of the master.

And I add on my own (by deduction of what is the chip doing) a second SN5407 to the Tx of the master back to the slaves. This chip could be a 1 channel model.

There are two versions of that part of the circuit. I think that the second one make more sense but maybe is not neccesary.

An alternative chip coul be the JM38510/00803BCA.

Please let me know.

Thank you.

Serial Protection Schematic V5.pdf (1.87 MB)

I think that the second one make more sense

They both certainly don't make any sense at all.
You have the RX of the Leonardo shorted to 5V, and the buffers totally wrong.

When drawing a circuit with things like buffers then you are doing it wrong. Each buffer should be shown as a symbol not all lumped together as a single chip. As you have it you have to remember the pin out of the chip and translate it to the buffer symbols. If you drew it out correctly you should see why those circuits are a nonsense.

a second SN5407 to the Tx of the master back to the slaves.

No need to, it will do absolutely nothing for you, but it does no harm. But in aly case you have no need for two of these buffer chips at all. You get 6 in a package. Also put a 0.1uF ceramic capacitor between power and ground of this chip.

Hello!

Let’s see how we’re going with this aproach.
I’m sweating… but I’m learning a lot.

Thank you.

PD. I realized that the Rx of the UNOs was shorted also :o

Serial Protection Schematic V6.pdf (148 KB)

Do not draw the buffers and the chip, just the buffers. You can label the PIN numbers on the buffers or draw the buffers with a dotted line round the outside to represent the chip.

All the buffer outputs must be joined together and then on to the Leonardo. The resistor needs to go from the joined buffer outputs to 5V.

Hello

Here we go!
I think we’re closer, because every time it is more clear for me what you mean.

Please let me know.

Thank you very much.

Serial Protection Schematic V7.pdf (1.79 MB)

Hi,
OPs pic.

Tom... :slight_smile:

Hello
Does that mean that it is correct? :confused:

Yes that looks essentially correct. Just a few tiny niggles with the way the schematic is drawn.

These tips are to help you produce a better diagram and are by no means any criticism. These things are often "unwritten conventions" but they are almost universally used.

One "rule" is that when ever possible positive is higher than negative physically on the schematic. So to look comfortable R4 should go up the the positive rail above it not to the one below. I would also try and avoid four wires meeting at right angles. Yes you used the right convention of using a dot to show they are joined but if it can be avoided then it should be.

Also using "net" symbols for power and ground often simplifies any diagram and saves you running wires all over the place and looking cluttered. So you use the ground symbol and then show wiring to all other chips from it. It is perfectly acceptable just to use that symbol on all the chips that need a ground and then you can eliminate those wires. The net symbol of a supply is a vertical line ending with a horizontal line making a T, then above the T write the voltage. Your symbol implies a battery and the other end is not connected.

The aim of a good schematic is for the wiring to look as uncluttered as possible.

Hi,
This is what @Grumpy_Mike was referring to.
I'm not sure what buffer IC you are using.


Tom.. :slight_smile:

Wao @TomGeorge, that schematic says exactly the same but much much simple to understand... Thank you.

@Grumpy_Mike, I've seen how newbies comes to this forum looking that any one of you solve their problems without making the effort to learn... I think that's not the point and that you all really want to help.

Thanks to you both, now I know sometihng new and how to draw a better schematic.

About the chip, I can buy the JM38510 at Amazon, the SM5407 at DigiKey... which one do yo think is best for me... also, any clue for a 1ch buffer IC? I don't wanna put the Leonardo serial back to the UNOs through the same chip and also let the others channels free for future UNOs addition.

Thanks a lot!!!!!!! :slight_smile:

I don't wanna put the Leonardo serial back to the UNOs through the same chip

There is no problem with using the same chip. But if you must then TI do a range of single logic function chips.

My only problem with DigiKey here in the UK is the postage charge and unless you you are buying a lot of stuff it can cost more than the parts. Which is my personal cut off point.