1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RPi + Other Software Replace network with direct serial communication

Discussion in 'Software Support' started by Snowman, 3 December 2018.

  1. Snowman

    Snowman New Member

    Messages:
    3
    Hardware:
    RPi1/Zero, 32/64bit, +Arduino
    Hi,

    I am trying to replace my current OpenELEC (boblight/boblightd) -> USB (serial mode) -> Arduino -> LEDs setup with an Android TV box (Shield) setup.

    As far as I understand, I need to replace the Arduino with a Raspberry which runs the Hyperion server, which is fine for me. I also need to setup an ethernet or wifi network connection, which I want to avoid. The Android box is connected to the Wifi and I want to avoid adding an additional Wifi interface or router to the RPi just so the Android box and the RPi can talk (I think its very bulky and energy inefficient).

    My desired solution is to connect the RPi to the Android box via USB or Bluetooth and let them communicate via a serial parallel channel (SPP). SPP, because it's simpler to implement than a native USB communication channel. My idea is to write a simple Android service (I'm a software developer) that acts as a TCP server that the Hyperion framegrabber connects to and forwards the data to a serial channel. On the RPi I would then bridge the serial interface to the Hyperion endpoint. Given that the required bandwidth is low enough and fits into a serial channel with e.g. 115200 baud (~150kbit/s), this should work.

    Now my questions to developers or other people that are familiar with the underlying communication protocol:
    • Do you thing this can work out, i.e. what is the bandwidth requirement for a 50 led setup?
    • Are there any existing solutions to this problem that I might have missed (point to point instead of network connection)? (I don't want to use external framegrabbing hardware due to 4K/HDR limitations and cost)
     
  2. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    943
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
  3. Snowman

    Snowman New Member

    Messages:
    3
    Hardware:
    RPi1/Zero, 32/64bit, +Arduino
    Thanks but I'm aware of that, I only need it for unprotected content. So my biggest issue is actually only the communication.
     
  4. Snowman

    Snowman New Member

    Messages:
    3
    Hardware:
    RPi1/Zero, 32/64bit, +Arduino
    Looking at the source code of the android screengrabber, it seems it is sending protobuffers with the grabbed image data at the configured framerate. For the default setting which is 60x34 pixels at a framerate of 30 fps, this roughly requires 1550 kbit/s (width * height * 3 + a few additional fields + some overhead).

    According to online forums, the RPi's serial UART interface works stable up to 1 mbit/s, but can go much faster too. This is slightly too slow for the default settings; but for my 50 led setup, I can go with a lower resolution image, e.g. 20x15, and the bandwidth requirements drops to 220 kbit/s.

    So it looks like the serial communication approach can work.