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

Which Arduino sketch for APA102?

Discussion in 'Software Support' started by Hamid, 2 October 2016.

  1. Hamid

    Hamid New Member

    Messages:
    7
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +nodeMCU/ESP8266
    Hi all,

    I just bought some APA102 strips. I'd like to set up ambient lighting for my monitor and Linux PC gaming. I have various arduinos and I'd like to connect the strips to an Arduino which I'll plug in via USB for the lighting.

    Reading around there is a lot of outdated info and none of the sketches I've seen mention the APA102 directly.

    Can anybody not just link, but please give a brief explanation of what the Arduino sketch needs to be doing?

    I assume it must implement the FastSPI library but what is the protocol for the communication with Hyperion over USB?

    Thanks
     
    Last edited: 3 October 2016
  2. redPanther

    redPanther Moderator Developer

    Messages:
    211
    Hardware:
    RPi1/Zero, RPi2, 32/64bit, +Arduino
  3. penfold42

    penfold42 Moderator Developer

    Messages:
    750
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Doesn't that sketch need to be changed to ws2801 and then Hyperion needs a device type of adalightapa102 ?

    Btw, the protocol is between the arduino and Hyperion is serial
     
  4. penfold42

    penfold42 Moderator Developer

    Messages:
    750
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
  5. redPanther

    redPanther Moderator Developer

    Messages:
    211
    Hardware:
    RPi1/Zero, RPi2, 32/64bit, +Arduino
    The normal adalight sketch must be set with correct controller and ledsize. The hyperion type is adalight. Adalightapa is for lightberry. The fastled controller name is APA102.
     
  6. penfold42

    penfold42 Moderator Developer

    Messages:
    750
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    So the first sketch needs to be updated with something like
    FastLED.addLeds<APA102>(leds, NUM_LEDS);
     
  7. redPanther

    redPanther Moderator Developer

    Messages:
    211
    Hardware:
    RPi1/Zero, RPi2, 32/64bit, +Arduino
  8. Hamid

    Hamid New Member

    Messages:
    7
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +nodeMCU/ESP8266
  9. Rick164

    Rick164 Administrator Staff Member Administrator

    Messages:
    190
    Hardware:
    RPi2, +Arduino, +AtmoOrb
    Last edited: 8 October 2016
  10. redPanther

    redPanther Moderator Developer

    Messages:
    211
    Hardware:
    RPi1/Zero, RPi2, 32/64bit, +Arduino
  11. Hamid

    Hamid New Member

    Messages:
    7
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +nodeMCU/ESP8266
    Does using an Arduino without hardware SPI affect the performance? I'#m using an Leonardo compatible and they didn't break out the SPI pins.

    I need to decide whether to buy a different board for faster updates or if this interface isn't affecting it.
     
  12. redPanther

    redPanther Moderator Developer

    Messages:
    211
    Hardware:
    RPi1/Zero, RPi2, 32/64bit, +Arduino
    @Hamid can you post a link to your board? Perhaps spi pins share gunction with other pind, like arduino uno
     
  13. Hamid

    Hamid New Member

    Messages:
    7
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +nodeMCU/ESP8266
    Unfortuantely they don't. I have inspected the board and the pins or not connected. (I have the datasheet for the ATMEGA32u4 to compare with).
     
  14. redPanther

    redPanther Moderator Developer

    Messages:
    211
    Hardware:
    RPi1/Zero, RPi2, 32/64bit, +Arduino
    Then try fastled examples. If you get it work, then adalight script will work to
     
  15. Hamid

    Hamid New Member

    Messages:
    7
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +nodeMCU/ESP8266
    Apologies, perhaps I wasn't clear; It is working correctly, but the update speed is slightly lagged behind the screen updates (~200-300ms by my guess). I was wondering if hardware SPI would improve the update rate.

    I have the Serial BAUD set to 1,500,000 between hyperion server and the arduino, the smoothing set to 80ms and I am using hyperion-x11 on 2x4K displays with the right hand display cropped off (--right-crop 3840).

    Is it already running as well as I can expect or should it update faster?
     
  16. penfold42

    penfold42 Moderator Developer

    Messages:
    750
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    It should work but max speed might suffer.

    I'm also curious about the board too - can you post a link ?

    If there's no SPI breakout then de-bricking it will be tricky
     
  17. Hamid

    Hamid New Member

    Messages:
    7
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +nodeMCU/ESP8266
    It's cheap, I wouldnt de-brick I'd just throw it away, I bought several more; https://www.amazon.co.uk/KOOKYE-ATm...qid=1476016511&sr=8-1&keywords=kookye+arduino

    MOSI+MISO are pins 10 and 11, which you can see from one of their images are not connected.
     
  18. penfold42

    penfold42 Moderator Developer

    Messages:
    750
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
  19. Hamid

    Hamid New Member

    Messages:
    7
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +PhilipsHue, +nodeMCU/ESP8266