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

AtmoDuinoBox - multi protocol arduino code for ambient lights

Discussion in 'Ambient Lighting System' started by kenwonders, June 3, 2016.

  1. kenwonders
    • Premium Supporter

    kenwonders MP Donator

    Joined:
    January 19, 2007
    Messages:
    703
    Gender:
    Male
    Ratings:
    +646 / 0
    Home Country:
    England England
    This may have limited interest to most, as usually you will setup your ardiuino for the light system you wish to use then forget about it.

    However, due to various reasons (like testing) I wanted to be able to leave the arduino alone and run up AtmoWin (in either AtmoDuino or V2 mode) or Ambibox and have them still work. Because they have different headers, this requires something a little different. The solution here will accept any header from the above (could be more later) through a matching method, it does appear to work VERY well at speed.

    To use:
    1. Please already know your FastLED config before trying this, as it's always best to get the lights working with the 'FirstLight' example :)

    //-----------------------EDITABLE CONFIGURATION
    #define NUM_LEDS 176
    #define LED_TYPE WS2812B
    #define DATA_PIN 11
    //#define CLOCK_PIN 0
    #define COLOUR_ORDER RGB
    #define SERIAL_SPEED 512000
    //-----------------------EDITABLE CONFIGURATION

    2. Edit the top section with your configuration, if you use LEDs with a clock pin, uncomment CLOCK_PIN, give it a value and swap the FastLED.addLeds line in 'setup()'
    3. The default speed I set here is 512,000, which is supported in the following ways:
    • Ambibox: 'AtmoDuino' section from SerialPortConfig.ini in the Ambibox program files dir
    • Atmowin: Requires 1.0.0.9 from AtmoWin thread, change speed in device configuration option.
    4. Try other speed values. If you have only a few LEDs then the standard arduino 115,200 will work ok, however that is not enough bandwidth for larger amounts of LEDs. It is also common to have some lower speeds fail despite higher ones working, most Unos can go pretty fast.
    5. Hope it works for you :)

    Info about the detection for those interested:
    I worked out how to calculate the correct 4 bytes for each header type, this means you only need to enter the NUM_LEDS value:
    AtmoDuinoV2 - 0xD7, 0xEE, 0x23, NUM_LEDS - 1
    AtmoDuino on Ambibox - 0xFF, 0x00, 0x00, NUM_LEDS * 3 - this value can overflow, but when truncated the byte leftover is matching ambibox, so that is what ambibox appears to do too
    AtmoDuino on AtmoWin - 0xFF, 0x00, 0x00, NUM_LEDS

    So that the loop is not complex, it is only ensuring each header part received matches at least one predefined header, but it could do better. If anyone better at that sort of thing (I tried a success array but it took too long) then please let me know.




     

    Attached Files:

    • Thank You! Thank You! x 4
    • Like Like x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,307
    Ratings:
    +1,141 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    Very nice work!
    Will add to AtmoDuino repo among the others if you don't mind with credits to you in the commit and inline :)
     
    • Thank You! Thank You! x 1
    • Agree Agree x 1
    • Great Idea! Great Idea! x 1
  4. kenwonders
    • Premium Supporter

    kenwonders MP Donator

    Joined:
    January 19, 2007
    Messages:
    703
    Gender:
    Male
    Ratings:
    +646 / 0
    Home Country:
    England England
    Happy to, I present no license for its use or destruction :)
     
    • Like Like x 1
    • Thank You! Thank You! x 1
  5. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,307
    Ratings:
    +1,141 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
  6. Dragy
    • Super User

    Dragy Super User

    Joined:
    April 27, 2009
    Messages:
    778
    Gender:
    Male
    Occupation:
    Student
    Ratings:
    +332 / 1
    Home Country:
    Netherlands Netherlands
    Show System Specs
    Very awesome, thank you for this!
     
    • Thank You! Thank You! x 1

Users Viewing Thread (Users: 0, Guests: 0)

  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Like Us On Facebook

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!