#106 RS485 Serial Data Transmission - on wires (no radio waves)

preview_player
Показать описание

If data transmission via radio waves is not for you (see video #73 on the nRF24L01+ modules) then maybe good old 2-wire transmission using the RS485 interface is a better choice.

The modules are to be had for pennies, the coding is simple and no libraries are required although we do use the SerialSoftware library to create a new serial port on arbitrary GPIO pins - not needed if you have a Mega 2560 as that four hardware serial ports built right into the hardware.

Data transmission speed can be quite high (115200 bps) and distances quite long (1.2km) but not both at the same time!

All in all, this can be a solution for outlying buildings, sheds, barns and the like as long as they have power.

As a bonus, you get first look at my new blog which I'm going to use to fill the gaps between videos. Yes, I know, I'm spoiling you.

All code can be found in my Github:

Interesting links about stuff I mention in my video:

Wikipedia article on RS485

Bangood RS485 modules

Nick Gammon's excellent article on RS486 including libraries and multidrop example

My new blog! All about stuff I never get to video about.

Here's one I made earlier... classic childrens TV

My channel and blog are here:
------------------------------------------------------------------
------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

Thanks to you and Gammon, I got my RS485s working. The absence of that delay that Gammon found out was the culprit of the failed communication.

IldefonsoZanette
Автор

Cool, reminds me of my old days when I ran Land-line teletype over in Vietnam, we dealt with a sort of ancient version of this using tube sets that amplified the signals after they had been processed by the crypto gear, I also did some time in the Brigade Headquarters Switchboard room as an operator for a few months, this was where I was exposed to the phantom and phantom simplex circuits using the earth as one side of a land line phone circuit it was really amazing, we could go from the Cam Rahn Bay to Saigon and to Phu Bi using just the earth for one side of the circuit. Basically one wire communications. Of course we did use special gear that got it done, I still recall the glow from the tubes in those boxes....

JerryEricsson
Автор

What could possibly be better than more Ralph Bacon. Huzzah!

tabmaryland
Автор

Once used some RS232 - RS485 converters for a fussy customer. Distance was a bit close to 10m, so customer insisted. He also insisted on some "fancy" ones at about £50 each! He was paying, so he was correct ;)

jd
Автор

Excellent tutorial on RS485. I am justing a project that will be using RS485 and your video was a big help. Thanks so much..

DncmFamily
Автор

ALWAYS USE GREAT CAUTION WHEN MAKING DIRECT COPPER CONNECTIONS OF ANY KIND TO OUTBUILDINGS!!

This is a HUGE subject to try to cover briefly in a comment. Suffice to say the following.

1. MASSIVE inductive spikes (10's thousands of volts) can appear on the outdoor connections that can blow your circuitry (literally) to smithereens. Research for example opto and galvanic isolation of RS485 lines.

2. Protect your circuits and youselves as much as possible by fitting suitable lightning arrestors and transorbs (tranzorbs, TVS diodes) with suitable fuses in series - Google for more info.

3. Even when any outside mains power supply has been properly and professionally installed with maybe individual bonded earth in addition to any SWA earth cable back to the consumer unit, NEVER, NEVER, NEVER assume that there is ZERO voltage between ground potential in the outbuilding and ground potential in the house!! It MIGHT spike to several thousand volts difference during an overhead lightning storm!!

It's why it's not such a good idea necessarily to have an outside supply from an MCB covered by an RCD feeding other internal circuits as well. Use a separate supply feed altogether from the main isolator or use an RCBO connected BEFORE the main RCDs. Otherwise you may find spurious whole or half house power trips happening all the time.

Hope this doesn't confuse people too much but please research on line as it is important for YOUR life and safety as well as to protect your gear.

boblewis
Автор

Used RS485 for my original home grown home control system, about 9 years ago. Had the same problem with the output buffer.
RS485 worked well for a few devices but found CAN bus a lot easer and more reliable for multiple devices. The MCP2515 CAN bus Module are a bit more expensive but still less than a £1 each (from AliExpress) and go up to 1Mb/s and use the same number of com wires.
If you use a micro controller with built in CAN bus (e.g. ESP32) you can just use a SN65HVD230 CAN bus buffer about the same cost but requires fewer pins.

nburton
Автор

If using twisted pair you have to ensure you pair the twists up, and you should use a drain wire, as you mention grounding the shield on one side, this is a drain.

tablatronix
Автор

Hi Ralph. I see you managed to find your MAX485 modules. '-) You can have up to 32 standard 12 Kohm modules (including the master) on a RS485 bus. If, however, you use the MAX487 chip you can increase this to 128. I'm soaking up Nick Gammon's wise words and will adapt his protocol to my needs. Many thanks for the video.

boldford
Автор

I just remembered why I have a pile of these modules at home, RS485 is used for DMX lighting control, so you can use these modules along with an Arduino (or any similar) to control DMX stage/disco lights.
Now I mention it sounds like a cross over to Big Clive channel :D (sure you don't mind me mentioning his channel here)
I had a sketch working on a few lights as a proof of concept and meant to do something proper with it for a simple control without needing full computer, dmx dongles and software for some static looks and some basic effects.

mcocker
Автор

Hi Ralph I do think RS485 deserves to be revisited to scratch a little deeper below the surface. You had a defective module first time round so you were unable to create a multidrop network. Additionally, you never overcame the buffered delay in printed characters.

boldford
Автор

Hi Ralph, I maybe missed it somewhere in the video but it is probably worth mentioning that RS485 requires 120ohm terminating resistors at each end of the line, i cant imagine they are built in to the RS485 modules as this would then prevent you from having anymore than 2 in the network so this would likely need to be added manually. nice video though, thanks for sharing :)

Logical_Controls
Автор

Thanks for sharing 😀👍
Interesting to see your blog, nice done 👍

avejst
Автор

Ralph Bacon ... Nick Gammon, some unintentional pun in there somewhere ;)

mcocker
Автор

Thanks ! As always very detailed and informative...greatly appreciated.

mrasp
Автор

I use SN75176B for RS485 communication. I have not faced the issue as mentioned by Gammon. But I have a different issue -- after transmission, once I enable reception, sometime, the 1st byte of reception is the last byte that was transmitted. I have used some software work around, but a simple fixed delay after transmission did not solve the issue. Somehow, either the delay sometime appears inadequate while some other time, the delay becomes too much and I loose the 1st valid RX byte.

Debraj
Автор

Hello, I have a question: is this a 485 communication.
Is it possible with a "D1 MINI WEMOS Pro 4M 16M" using "Tasmota" e.g. B. to control a "JUNTEK DPM8624 60V24A Programmable DC DC Digital Adjustable Step Down Voltage Power Supply Buck Converter 485 Communication"?

lutzmuller
Автор

Great Videos Ralph - keep up the good work. (You kind of sound a bit like Pierce Morgan - but a much kinder, smarter version. )

mumumumah
Автор

Hi, great video, I have a question, is it possible to connect multiple slaves (rs485 output sensors) to MAX 485 (to A- B), and read slave values from Arduino, Thanks in advance

purveyorenterprise
Автор

Hi Ralph its Bob tried your Blog but no confirmation email back so will leave it with you, All the best and blog looks good!!

MrBobWareham