i plan to build a network of serial devices to transfer around 200bytes of data to a master arduino in a polling fashion. i would set a pin state to signal the slave device to send some data over serial.
I want 3 esp/arduino to attach to 1 rx pin. I would like to do this without a buffer or multiplexer. How should i configure the tx pins on the slave devices.
would i need a diode to protect when one tx is low it dont short the other one out when its writing? if so what diode would work?
Wire rx/tx point to point with each device so that all devices receive the same info. You can use the serial string sent data to address the device the data is meant for.
For instance, a sentence could be structured <1...9, data, data, data> where < is a sentence begin marker and 1...9 is the device id/address and the > is the sentence end marker.
i have an idea how i would structure the messages but didn't know i could just "connect them all together" and have a structured message protocol. The hardware will not care?
Give it a try and find out. Just don't mix 3.3V devices and 5 Volt devices RX/TX lines.
There is a better way to support multi-drop serial than RS-232 with diodes. It's RS-485.
but i dont understand, how can i create a network like this with rs485 as far as im aware arduino dont have rs485 signals
Using RS-485 modules. Technically, Arduino doesn't support RS-232 either, just TTL level serial. How far apart are the devices?
devices are about a meter apart. So the rs485 would convert UART signal voltages to rs485 voltages? is this the only difference or does it convert the bits into some other signal?
Okay then how many devices, what is the total length? This already sounds like too far for TTL to be reliable without some fancy footwork.
RS-232 and RS-485 do not alter the signal timing, just the voltages and currents.
there is about 12ft total of cat8 shielded twisted pair between all modules, some closer than others. everything even the enclosures are shielded. power supply is a rigol dp711, i talk to the psu through a max232 from about 25 ft sending scpi commands.
In that case diodes and TTL logic may work, but you have to be extremely careful about noise.
I am a bit confused about how to use the diodes, also if i did try TTL logic first and i have issues with signal integrity could i just easily convert to rs485 and keep the same messaging protocol/send&recv code?
Yes your code wouldn't need to change. The diode circuit uses one resistive pull up on the input, diodes convert each output to the equivalent of an open collector driver, pull to ground only.
Beware input logic thresholds, especially with 3.3V devices.
You need to consider why, this isn't usually done.
okay well obviously atleast the diode would only work in one direction oops lol. You think i should add a pullup on the master rx pin?
You must have a pullup resistor. If not the input is floating.
1 Like
im not aware if the Arduino normally comes with pullups or just uses the internal pullup/ is it even enough.
I "think" the esp32 is 5v tolerant. but i hear some will not tolerate 5v, I dont know what situation is not 5v tolerant . ill have to check but i hope my esp32 is.
Can you tell what the difference between these modules are?
im not sure why the price is so much different
The esp32 is NOT 5v tolerant. that sucks because at minimum i need a level shifter. i should just use the rs485 converter. which converters should i get. seems likes there's a bit more circuits on the more expensive ones.
No. It isn't. Oh, sorry, you beat me to it. The main difference among RS485 modules, is that some use timed, automatic RX/TX switching, and others have a control pin for that, you have to connect it to an I/O port and drive it in your software.
1 Like
Could you explain a little more for me. If I buy these :
https://www.amazon.com/Transceiver-Instrument-Communication-Development-Accessories/dp/B094MKRTRC
i will need additional io pins for control? what do they control? i will only be sending data to the master. or polling from the master have not decided yet
If you buy the automatic ones, you won't need additional pins (they control data direction of the transceivers). If you bus them, any device could function as a master, that is decided in software. Almost always, you will want to use polling to avoid bus collisions.
One "gotcha" with the automatic ones, is that a slave has to allow time for the master to return to RX mode from TX mode it used to poll..