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

RPi + OpenELEC Cannot communicate between RPi and Arduino

Discussion in 'Software Support' started by ngng, 31 March 2017.

  1. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    Hi all, I've been making progress with my setup at home but am encountering some problems. I have the my LED strip connected together and talking to the Arduino (verified by loading a different sketch). I have verified Hyperion is running, and my phone can successfully connect to the server. I have not added an inline capicator

    When I power only the Arduino, I see a quick, successful LED test. Once the Pi and Arduino boot up I see a quick LED flash, but do not see the rainbow swirl effect.

    I am unable to control the LEDs through Hyperion. When I SSH into the Pi and manually set a color I see confirmation from Hyperion, but nothing on the LED side. I'm not sure if it's a configuration issue with the Arduino, or a communication issue between the Pi and the Arduino. Thanks for any help!

    Code:
    BoxOfLights:~/hyperion/bin # ./hyperion-remote -c blue
    hyperion-remote:
      version   : V1.03.2 (brindosch-99d9396/d3713a8-1469452981
      build time: Jul 25 2016 06:54:18
    Connected to localhost:19444
    Set color to 0 0 255
    
    Hardware:
    RiPi3 with OpenElec 7.01 and Hyperion
    IEIK UNO R3 Board ATmega328P
    Mokungit 1APA102-C Individually Addressable Magic Color LED Strip 36 Pixels/m 180

    Configs:
    Gist => hyperion.config.json
    Gist => Arduino sketch
    Note, my hyperion config uses "AdalightApa102". When I tried modifying the type to "apa102" type I did not see any activity from the LEDs at all.

    Hyperion log
    Code:
    Hyperion Ambilight Deamon (572)
      Version   : V1.03.2 (brindosch-99d9396/d3713a8-1469452981
      Build Time: Jul 25 2016 06:54:40
    INFO: Selected configuration file: /storage/.config/hyperion.config.json
    HYPERION INFO: ColorTransform 'default' => [0; 167]
    HYPERION INFO: ColorCorrection 'default' => [0; 167]
    HYPERION INFO: ColorAdjustment 'default' => [0; 167]
    LEDDEVICE INFO: configuration:
    {
      "colorOrder" : "rgb",
      "delayAfterConnect" : 0,
      "name" : "P51HyperionConfig",
      "output" : "/dev/ttyACM0",
      "rate" : 460800,
      "type" : "AdalightApa102"
    }
    
    Opening UART: /dev/ttyACM0
    INFO: Creating linear smoothing
    HYPERION (CS) INFO: Created linear-smoothing(interval_ms=50;settlingTime_ms=200;updateDelay=0
    EFFECTENGINE INFO: 27 effects loaded from directory /storage/hyperion/effects
    EFFECTENGINE INFO: Initializing Python interpreter
    INFO: Hyperion started and initialised
    INFO: Boot sequence 'Rainbow swirl fast' EFFECTENGINE INFO: run effect Rainbow swirl fast on channel 0
    BLACKBORDER INFO: threshold set to 0 (0)
    BLACKBORDER INFO: mode:default
    started
    INFO: Json server created and started on port 19444
    INFO: Proto server created and started on port 19445
    EFFECTENGINE INFO: effect finished
    
    JSONSERVER INFO: New connection
    BLACKBORDER INFO: threshold set to 0 (0)
    BLACKBORDER INFO: mode:default
    EFFECTENGINE INFO: effect finished
    EFFECTENGINE INFO: run effect Cold mood blobs on channel 50
    BLACKBORDER INFO: threshold set to 0 (0)
    BLACKBORDER INFO: mode:default
    
    Arduino pins:
    Ignore the wire colors, I had to flip the connector backwards for a better connection. I have verified the correct direction of the clock and data.
    [​IMG]

    Testing LEDs through the Arduino (different sketch loaded):


    RPi3 + Arduino test:
     
  2. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    The Arduino picture is missing a ground pin.

    Hope it helps.
     
  3. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    Do I ground it to the PWM side, or the Power side? I've tried both, but there is no difference. Thanks!
     
  4. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    I think I found this (See attached) picture on the wiki here. but in any case, it shows the what the connections are.

    Hope it helps.
     

    Attached Files:

  5. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    Okay, I've added the ground wire on the Arduino. I don't think I need to ground anything on the RPi.

    [​IMG]


    When I send commands to change color from the command I can see the LEDs doing something, but I'm still not seeing any solid color or working effects.

    I double checked the manufacuter site and read:
    I updated my Arduino sketch to use the BRG color order while keeping the Hyperion config to use RGB. Still no luck and everything is white.

    [​IMG]
     
    Last edited: 31 March 2017
  6. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Yes. you NEED a common ground connection to all attached. However it should be grounded Via the USB connection already.

    you would at least see the LED's emitting colors, wrong colors. but colors non the less.

    Hope it helps.
     
    Last edited: 31 March 2017
  7. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    Okay, another update. I believe the RGB byte order provided online was incorrect. I loaded another sketch to test and found BRG gave me the correct colors on boot. After setting the correct color order on the Arduino to BRG and keeping the Hyperion config at RGB it looks like I can control a single LED. This is odd.

    On first boot with Pi + Arduino this is the resting state, note the LEDs that are off:
    [​IMG]

    When I connect with the Hyperion Android app and use the color wheel and choose yellow:[​IMG]

    Gist => Test sketch
     
  8. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    How many LED's are you using? I ask because the two sketch's have different values. One for 240 and the other for 168.
     
  9. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    I have 168. The 240 value was a default when I was trying to determine the color order.
     
  10. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Out of curiosity what does " sudo ls -l /dev/ttyACM0 " return on the Rpi?
     
  11. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    Code:
    BoxOfLights:~ # ls -l /dev/ttyACM0
    crw-rw----    1 root     dialout   166,   0 Mar 31 18:41 /dev/ttyACM0
    
     
  12. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Are you uploading the sketch via the arduino ide on the Rpi?
     
  13. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    No, I'm plugging my Arduino into my laptop and uploading from the IDE on there..
     
  14. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    As a test, would it be possible to install the arduino ide on the Rpi and see if it can upload the sketch without issue?
     
  15. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
  16. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    I'm not sure what this would accomplish since I can confirm I am able to upload sketches.

    I am already using the official sketch.
     
  17. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Making sure the Rpi can communicate with the a arduino without issue on /dev/ttyACM0


    Yup I realized that shortly after posting. My mistake
     
  18. ngng

    ngng New Member

    Messages:
    13
    Hardware:
    RPi3, +Arduino
    Oh, I've confirmed that the RPi can talk to the Arduino. With the latest changes I can issue commands from the RPi to the Arduino and change the LED color, but only a handful at a time (see above photo).
     
  19. Akriss

    Akriss Active Member

    Messages:
    513
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Yes. However if you want to make sure the communication between the two is without fault I would install the ide and test an upload or two.
     
  20. taconapsack

    taconapsack New Member

    Messages:
    5
    Hardware:
    RPi2, RPi3, +Arduino
    Any update on this? I am having a similar issue and was wondering if you solved the problem.