Initial notes on using MAX485 based TTL-to-RS485 adapter boards with Arduino or Raspberry Pi

By: ( +David Herron; Date: July 2, 2017

Tags: MODBUS » Raspberry Pi » Arduino

I've been looking for an inexpensive but robust way to connect an inexpensive embedded computer to an RS485 network. The MAX485 based interface boards look enticingly inexpensive, and claim to be easy to connect. They should be more reliable than a USB RS485 adapter, because the MAX485 boards are hardwired to GPIO pins. It took much searching to find any advice about connecting these adapters to a computer. The board I received was marked DI/DE/RE/RO on one end, and Vcc/A/B/GND on the other. The latter is clear, that's power and the RS485 pins, but what could the other end mean.

For this project I do not have working code. Instead this post is about noting a useful resource explaining how to use the MAX485 based TTL-RS485 adapters.

Earlier I'd posted how to use an USB RS485 adapter to read data from a simple MODBUS device: Read a MODBUS temperature sensor through USB-RS485 adapter on Ubuntu and Raspberry Pi And how to read that same MODBUS device from an Arduino using an RS485 shield: Using an Arduino to read a simple MODBUS/RTU RS-485 temperature sensor

Both of those were simple to implement and read from that simple device. One thing that stood out using the two USB RS-485 adapters I have is how unreliable they are. After awhile the host computer would stop recognizing the adapter, and I'd have to reboot the computer. This is unacceptable for the typical MODBUS use case, which is industrial control devices. As a result I've been looking for a more reliable RS485 interface board.

Amazon search for ( MAX485 based TTL-to-RS485 interfaces

The MAX485 chip is made by Maxim Integrated, a large integrated circuit maker.

The manufacturer home page for the interface board I have says nothing about how to use the interface board. Literally nothing. I was able to find the Maxim Integrated datasheets and other information.

Block diagram of using several MAX485 chips to form an RS485 network

This diagram shows four MAX485 chips wired to form an RS485 network. That's great, and it even shows the DI/DE/RE/RO signal pins. That explains what the pins on that end of the board are, but it doesn't explain how to use this to interface with a computer.

The MAX485 signal pins

And this explains what the MAX485 signal pins are, on the MAX485 chip itself. The two ends of the board I have contain 8 signal pins total, and it seems likely those simply correspond to the MAX485 pins. This explains that the DE/RE lines enable input/output functions, while the DI and RO lines are where input/output occurs.

That's close. But it's not everything.

This page has the key: (

It shows a GPIO pin (pin 8) being used as input to both the DE/RE lines to disable/enable both by setting the one pin high or low. The UART's TX/RX lines are connected to the DI/RO pins on the interface board. There's a bit of Arduino code to send regular text over the RS485 network. That's nice, but of course I want to run MODBUS over the interface and it's not clear where to go from here.

Well, there's enough clues to begin to do something, but I'll have to leave that for another day. The outline of the idea is:

#include <ModbusMaster.h>

void setup() {
    // use Serial (port 0); initialize Modbus communication baud rate

    // communicate with Modbus slave ID 255 over Serial (port 0)
    node.begin(1, Serial);

    pinMode(8, OUTPUT);

void loop() {
    digitalWrite(8, HIGH);
    result = node.readInputRegisters(1, 1);
    if (result == node.ku8MBSuccess) {
        tp_modbus = node.getResponseBuffer(0);
    tp_status = result;
    digitalWrite(8, LOW);

That's what I plan to start with ...

« Correct character encoding with DOMDocument implementing a Wordpress content filter Scientists looking for a Giant Elephant at the center of the galaxy; Taking pictures of Black Holes »
2016 Election Acer C720 Ad block AkashaCMS Amazon Amazon Kindle Amazon Web Services America Amiga and Jon Pertwee Android Anti-Fascism AntiVirus Software Apple Apple Hardware History Apple iPhone Apple iPhone Hardware April 1st Arduino ARM Compilation Artificial Intelligence Astronomy Astrophotography Asynchronous Programming Authoritarianism Automated Social Posting AWS DynamoDB AWS Lambda Ayo.JS Bells Law Big Brother Big Finish Bitcoin Mining Black Holes Blade Runner Blockchain Blogger Blogging Books Botnets Cassette Tapes Cellphones China China Manufacturing Christopher Eccleston Chrome Chrome Apps Chromebook Chromebox ChromeOS CIA CitiCards Citizen Journalism Civil Liberties Clinton Cluster Computing Command Line Tools Comment Systems Computer Accessories Computer Hardware Computer Repair Computers Cross Compilation Crouton Cryptocurrency Curiosity Rover Currencies Cyber Security Cybermen Daleks Darth Vader Data backup Data Storage Database Database Backup Databases David Tenant DDoS Botnet Detect Adblocker Developers Editors Digital Photography Diskless Booting Disqus DIY DIY Repair DNP3 Do it yourself Docker Docker MAMP Docker Swarm Doctor Who Doctor Who Paradox Doctor Who Review Drobo Drupal Drupal Themes DVD E-Books E-Readers Early Computers Election Hacks Electric Bicycles Electric Vehicles Electron Emdebian Encabulators Energy Efficiency Enterprise Node EPUB ESP8266 Ethical Curation Eurovision Event Driven Asynchronous Express Face Recognition Facebook Fake News Fedora VirtualBox File transfer without iTunes FireFly Flickr Fraud Freedom of Speech Front-end Development Gallifrey git Github GitKraken Gitlab GMAIL Google Google Chrome Google Gnome Google+ Government Spying Great Britain Heat Loss Hibernate Hoax Science Home Automation HTTP Security HTTPS Human ID I2C Protocol Image Analysis Image Conversion Image Processing ImageMagick In-memory Computing InfluxDB Infrared Thermometers Insulation Internet Internet Advertising Internet Law Internet of Things Internet Policy Internet Privacy iOS Devices iPad iPhone iPhone hacking Iron Man iTunes Java JavaScript JavaScript Injection JDBC John Simms Journalism Joyent Kaspersky Labs Kindle Kindle Marketplace Lets Encrypt LibreOffice Linux Linux Hints Linux Single Board Computers Logging Mac Mini Mac OS Mac OS X Machine Learning Machine Readable ID macOS MacOS X setup Make Money Online March For Our Lives MariaDB Mars Mass Violence Matt Lucas MEADS Anti-Missile Mercurial MERN Stack Michele Gomez Micro Apartments Microsoft Military AI Military Hardware Minification Minimized CSS Minimized HTML Minimized JavaScript Missy Mobile Applications Mobile Computers MODBUS Mondas Monetary System MongoDB Mongoose Monty Python MQTT Music Player Music Streaming MySQL NanoPi Nardole NASA Net Neutrality Network Attached Storage Node Web Development Node.js Node.js Database Node.js Testing Node.JS Web Development Node.x North Korea npm NVIDIA NY Times Online advertising Online Community Online Fraud Online Journalism Online Photography Online Video Open Media Vault Open Source Open Source Governance Open Source Licenses Open Source Software OpenAPI OpenVPN Palmtop PDA Patrick Troughton Paywalls Personal Flight Peter Capaldi Phishing Photography PHP Plex Plex Media Server Political Protest Postal Service Power Control Privacy Production use Public Violence Raspberry Pi Raspberry Pi 3 Raspberry Pi Zero ReactJS Recaptcha Recycling Refurbished Computers Remote Desktop Removable Storage Republicans Retro Computing Retro-Technology Reviews RFID Right to Repair River Song Robotics Rocket Ships RSS News Readers rsync Russia Russia Troll Factory Russian Hacking Rust SCADA Scheme Science Fiction SD Cards Search Engine Ranking Season 1 Season 10 Season 11 Security Security Cameras Server-side JavaScript Serverless Framework Servers Shell Scripts Silence Simsimi Skype SmugMug Social Media Social Media Warfare Social Network Management Social Networks Software Development Space Flight Space Ship Reuse Space Ships SpaceX Spear Phishing Spring Spring Boot Spy Satellites SQLite3 SSD Drives SSD upgrade SSH SSH Key SSL Stand For Truth Strange Parts Swagger Synchronizing Files Telescopes Terrorism The Cybermen The Daleks The Master Time-Series Database Tom Baker Torchwood Total Information Awareness Trump Trump Administration Trump Campaign Twitter Ubuntu Udemy UDOO US Department of Defense Virtual Private Networks VirtualBox VLC VNC VOIP Vue.js Web Applications Web Developer Resources Web Development Web Development Tools Web Marketing Webpack Website Advertising Weeping Angels WhatsApp William Hartnell Window Insulation Windows Windows Alternatives Wordpress World Wide Web Yahoo YouTube YouTube Monetization