Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Teensy 4.0/4.1 to Raspberry Pi wired communication over 1-2 meters

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    5

    Teensy 4.0/4.1 to Raspberry Pi wired communication over 1-2 meters

    The project I am working on has a pi and teensy communicating where the teensy controls a bunch of stepper motors and recieves sensor input, and that data is sent to a pi to be diplayed for the user on a large touch screen. The display allows inputs to be sent to control motor positions and speeds (basically an HMI).

    What is the best way to communicate between the two? I figured i2c is out because of the cable distance, so would Serial, CAN, or USB be appropriate? The two will likely be connected by USB anyway to do OTA updates. I'd like to use the 4.0 since it's a tad smaller and things are going to be tight in my control box, but if I have to use a 4.1 it isn't too much of a problem. Thanks!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,980
    USB can do 2 meters. It's the way needing the least amount of extra hardware, just a good quality 2 meter cable. USB provides power, but for 2 meters make sure the cable has #24 or larger wires for the power. Cheap cables have tiny #28 or #30 wires which cause too much voltage loss if going a long distance.

    Serial using RS422 / RS485 can go a long distance, but you need the transceiver hardware on both ends.

    CAN bus also needs transceivers, and you'll need a CAN add-on board since Raspberry Pi doesn't have CAN built in.

    Ethernet is the other good way to work over long distance. There you'd need Teensy 4.1 and the ethernet kit, and of course an ethernet cable. Ethernet has the nice advantage that it's magnetically coupled, so you don't have to worry about ground loops or ground difference if the 2 aren't powered from a common source.

  3. #3
    Junior Member
    Join Date
    Feb 2021
    Posts
    5
    Thanks for the help. Ethernet seems like it may be the way to go.

    Does the ethernet kit just break the pins out to be used with an RJ45 connector? Because of the physical requirements, most of my connectors are industrial m12 style plugs. Is it possible to wire striaght to the board if I'm not using a standard ethernet plug or does the ethernet kit have some other functionality needed to facilitate data transfer?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,980
    Quote Originally Posted by jackson View Post
    Does the ethernet kit just break the pins out to be used with an RJ45 connector?
    The connector is a "magjack", which means is more than just a plain RJ45. It has the ethernet magnetic coupling parts built in.

    The kit does more or less just break out the pins, but to a magjack. It also has 1 capacitor. Scroll down to the bottom of that page for the schematic and datasheet on the magjack.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •