TDG-Bus

About: Teaching and making electronics since - well I don't even know

"Why not RS-485?" - you may ask.

Because why not? (I couldn't find a better name, please suggest!) Do you want to communicate with several Arduinos and/or Raspberries, other microcontrollers and SBC-s? "Duh, use Bluetooth or Wi-Fi." But it's not the optimal solution in every case, wired communication is better in several aspects! If half-duplex, byte-oriented communication under 1 Mbps is suitable for your project, give it a try!

The LIN bus is based on a really nice idea: you have the world's cheapest interface in practically EVERY microcontroller (and SBC), namely UART. Just wire it to a bus and ready to roll! The idea is the same: why not use a really popular bus IC and hack it?

Also the CAN transceivers are more modern than the RS-485. The CAN is well-documented in ISO 11898-1, a single twisted-pair is enough to go up to 1000 meters, and you can implement collision detection. So, wanna try?

Supplies:

Get an Arduino and a CAN "level shifter", not a full CAN compatible peripheral! I used the TLE6250.

Step 1: The Theory

The TLE6250 converts the CAN-compatible signals to simple TTL and you can feed this TX-RX signals to the Arduino's TX-RX (but not crossed: TX-TX and RX-RX).

Use twisted pair wires with 120 Ohm terminal resistors on each end for best performance, but it will work on your desk with jumper wires and without resistor.

Each board connects to the same bus - so everyone gets the very same message, even the sender! (that's how you check message integrity, if you get what you sent, everything went fine)

For absolute beginners: use master-slave topology, one master and several slaves. This can be insufficient in many cases, the pros can implement a token-ring based communication or wait for the final implementation here: https://github.com/the-developer-guy/

How to implement CSMA-CD is not decided yet. Performance calculations needed.

Step 2: Assembling and Testing

This transceiver is available in SO-8, so it's easy to solder it to a Protoshield!

The pinout:

- TxD - Tx (pin 1), RxD - Rx (pin 0)

- INH to ground and RM to high to enable

- GND to ground, Vcc to 5V

- CANH to one com wire, CANL to the other

Done! In this case the brown and red wires were the CANH and CANL wires. I used a Leonardo for Serial1 -> Serial monitoring and an Arduino Uno for generating traffic. If you are within the CAN specifications, you are good to go!

Arduino Contest 2019

Participated in the
Arduino Contest 2019

Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Fandom Contest

      Fandom Contest
    • 1 Hour Challenge

      1 Hour Challenge

    4 Discussions

    1
    None
    DIY-Guy

    21 days ago

    This brings back memories of serial communications in the early days of personal computers. It is good to see this kind of thinking being used with inexpensive Arduino processors. Thank you for giving me some new (old) things to think about again.

    Imagine a field full of agricultural sensors that all communicate with each other. This could be useful in so many applications. Please keep us updated!

    1 reply
    0
    None
    thedeveloperguyDIY-Guy

    Reply 20 days ago

    Serial is not forgotten, just hidden in plain sight. It's in your router giving you boot information, in your car disguiyed as LIN bus and probably in a million other places.
    For agricultural sensors - I would love to spread this bus but as an engineer, I must tell you about better options.
    In this case, wireless nodes are better with mesh topology (Zigbee, Thread) or if you are rich enough, you can choose Lora or 4g narrowband (NB-IoT).
    I developed this bus for my hackerspace/makerspace/eduspace - the box is not ready yet, but there will be boxes, you should insert your ID and it will request some information from a Raspberry Pi server. I needed an inexpensive communication wired method.

    1
    None
    robertbu

    Question 24 days ago on Step 2

    I'm inexperienced with electronics, but I've used I2C in a couple of projects to communicate between Arudinos. How does this method of communication compare?

    1 answer
    0
    None
    thedeveloperguyrobertbu

    Answer 23 days ago

    Great question!
    First, the distance. I²C is limited in distance, probably a meter tops. With this, you can go up to a kilometer @ 9600 bps.
    Speed - it's limited by the serial port and the CAN to 1 Megabit (but the distance is limited to about 25 meters if I remember correctly), but the typical serial speed never goes oves 115200, so let's say it's slower a bit.
    Third and this is also important: you can easily implement a PC sniffer and connect regular computers in this bus with an inexpensive hardware an no special driver is needed, while I²C could be tricky.
    Also, the most important part is that pesky level problem: 3.3 vs. 5V I²C bus, not a problem with this!