Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. IP Gateway based on ncat + socat + USB

IP Gateway based on ncat + socat + USB

Scheduled Pinned Locked Moved My Project
5 Posts 2 Posters 1.2k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • thazlettT Offline
    thazlettT Offline
    thazlett
    wrote on last edited by
    #1

    I have been trying out different controllers (I use domoticz right now and have for a while). Having a TCP/IP based gateway like the ESP8266 is useful for this as you can have multiple clients connect to it, unlike a USB/Serial based one.

    What I ended up doing was using ncat (nmap package) and socat in this manner to basically create a linux based version of a TCP/IP based gateway. So I can use the USB/Serial based gateways here.

    So far this seems to work with mysensors and rflink very well for me (run two instances for each serial port and tcp port. I did not find much info on this when I was googling around so I thought I would share:

    #!/bin/bash
    
    port=5003
    serial=/dev/ttyUSB0
    baudrate=b38400
    
    ncat --listen --broker --keep-open 0.0.0.0 $port &
    socat $serial,$baudrate TCP:127.0.0.1:$port &
    
    

    My plan is to shove this on a pi zero w on start up with my rflink and mysensors gateways attached. Then I can just tell my controller(s) to connect to my 'gateway box' over my network. I could probably put it into a docker container or systemd/init script to do things a little cleaner(&) but hey, it works.

    1 Reply Last reply
    1
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      What USB gateways are you using?

      1 Reply Last reply
      0
      • thazlettT Offline
        thazlettT Offline
        thazlett
        wrote on last edited by
        #3

        Standard USB MySensors gateway (Arduino Nano based) and an RFLink gateway(Arduino Mega based).

        1 Reply Last reply
        0
        • gohanG Offline
          gohanG Offline
          gohan
          Mod
          wrote on last edited by
          #4

          The raspberry gateway isn't supported on the Pi zero?

          1 Reply Last reply
          0
          • thazlettT Offline
            thazlettT Offline
            thazlett
            wrote on last edited by
            #5

            I actually didn't know that raspberry pi gateway was a thing! nice, i'll have to try that. I have been using a USB one since 1.5. I guess what i'm doing here is just more generic.

            I have it running on an orange pi one right now and it's fine. I plan to move it to a r-pi zero w when I have some time. Perhaps put it all in a project box and place it strategically in the house.

            To explain a little bit about what I did: A problem with socat I had was it seemed to garble the serial data between connected clients, making it useless with more than 1 client(I don't think that's a socat issue though, I think that's because more than one process is trying to access the tty device at once). Ncat fixes that by just repeating anything pushed into it to all connected clients. So it's ttyUSB0/1 <> socat <> ncat <> One of more clients.

            Hopefully it's useful for people.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            24

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular