element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Upcycle It
  • Challenges & Projects
  • Design Challenges
  • Upcycle It
  • More
  • Cancel
Upcycle It
Blog Upcycled Clock – Testing the RGB LED strip
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: carmelito
  • Date Created: 9 May 2017 4:16 AM Date Created
  • Views 1402 views
  • Likes 5 likes
  • Comments 4 comments
  • upcycledclock
  • upcycle_it
  • upcycleit
  • neopixels
  • apa102
  • led stirp
  • spi
  • iot
  • intel edison
Related
Recommended

Upcycled Clock – Testing the RGB LED strip

carmelito
carmelito
9 May 2017

After receiving my package a few weeks back the first few things I did after stetting up the latest version of the Yacto image, and testing the python UPM examples for SeeedStudio sensors which I plan to use for the build , I tried testing Neopixel strip (WS2812), which is one of the most important part of the build. After finding out there was no UPM example and after trying Adafruit's Arduino library for a couple of hours with the Intel Edison image and then back to the Arduino Uno to check if all the connection are ok .. By this time I had also consumed a couple of Red bulls just to see I can grow wings image . I then resorted to searching the internet to see if there was something with respect to the Intel Edison and Neopixels WS2812, and lo and behold I was taken to the Intel communities web site where I found a couple of threads showing why the Neopixels WS2812 is not supported/won't work with the Edison.

 

Here is details from intel forms which best desribes the issue with using WS2812 - https://communities.intel.com/message/315650#315650

“ you won't get consistent write times since clock cycles for any Arduino commands like write are non-deterministic. The reason is because the Arduino on Edison runs as a process within the Linux system, where execution is controlled by the kernel and also shared with other processes.”

 

 

This meant I had to think about alternatives, and based on the forum post on Intel communities, I decide to buy a LED RGB strip(APA102 LED) from Sparkfun- https://www.sparkfun.com/products/14015. Here is a brief description of LED Strip –“These are addressable 1-meter-long 5V RGB LED strips that come packed with 60 APA102Cs. APA102 LEDs are very similar to WS2812s with a few caveats: APA102s can be controlled with a standard SPI interface, and they have an extremely high PWM frequency. There is access to each APA102 LED, and each strip length can be easily modified. You will be able to control each LED RGB individually”

And after receiving the package, I was finally successful in getting the new LED strip cycling through colors image . Here are some details of the testing setup..

 

For the circuit as show in the picture below, I used

Pot connected to A0 – this is to test the various color of strip

To power the LED strip , I am using 4x AA batteries

Data – pin #11

Clock – pin #13

 

image

 

The python program is based on UPM example for apa102 LED strip

#!/usr/bin/python
# Created by Carmelito to test LED strip and this is based on
# Grove Pot https://github.com/intel-iot-devkit/upm/blob/master/examples/python/groverotary.py
# Led Strip https://github.com/intel-iot-devkit/upm/blob/master/examples/python/apa102.py
from upm import pyupm_grove as grove
import time, sys, signal, atexit
from upm import pyupm_apa102 as mylib
from time import sleep


def main():
    # Instantiate the strip of 60 LEDs on SPI bus 0 connect Data-D11 and Clk- D13
    ledStrip = mylib.APA102(60, 0, False)
    knob = grove.GroveRotary(0)
    abs = knob.abs_value()
    while True:
        # Read values
        abs = knob.abs_value()
        print("Abs values: " + str(abs))
        lightValue = lightSensor.raw_value()
        print ("Light Value: " + str(lightValue))
        sleep(1)
        if abs <100:
            print("Setting all LEDs to Green")
            ledStrip.setAllLeds(60, 0, 255, 0)
            time.sleep(2)
        elif abs >100 and abs <300:
            print("Setting all LEDs to Red")
            ledStrip.setAllLeds(60, 255, 0, 0)
            time.sleep(2)
        elif abs >300 and abs <600:
            print("Setting all LEDs to Blue")
            ledStrip.setAllLeds(60, 0, 0, 255)


        elif abs >600 and abs <900:
            print("Setting LEDs between 10 and 20 to Red")
            ledStrip.setLeds(10, 20, 60, 255, 0, 0)
            time.sleep(2)
        else:
            print("setting all LEDS off")
            ledStrip.setAllLeds(60,0,0,0)
            time.sleep(2)


if __name__ == '__main__':
    main()

 

Here are few more picture which gives an insight on how I plan to use the RGB LED strip, basically an example here would be to have the LED strip turn bright yellow if it is going to be sunny today based on the OpenWeatherMap API which I used in a previous blog post -Upcycled Clock - Reading out the weather using eSpeak  and blue if it about the rain so that you can remember to your umbrella with you..

 

{gallery} Testing RGB LED strip

image

Setting RGB LED strip to Green

image

Setting RGB LED strip to Red

image

Setting RGB LED strip to blue and then setting LED 10 to 20 to Red

  • Sign in to reply

Top Comments

  • Workshopshed
    Workshopshed over 8 years ago +1
    Hey Carmelito it's coming together nicely. Theoretically you could use the MCU to talk to NeoPixels but I'd not want to be the one who ports the code. Good call on the APA102 chip!
  • mcb1
    mcb1 over 8 years ago +1
    I agree good call to shift sideways with the hardware, rather than fight it.
  • stevemaka
    stevemaka over 7 years ago

    APA102 is orginal Taiwan chip, super expensive....if you buy it from China, it is APA102C, but it has already stopped producing, as Taiwan supplier didn't provide IC any more, now the best choice is APA107/SK9822

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 8 years ago

    Great post.

     

    The APA102 is a great choice.

    Thanks for bringing it to my attention.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 8 years ago

    I agree good call to shift sideways with the hardware, rather than fight it.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Workshopshed
    Workshopshed over 8 years ago

    Hey Carmelito it's coming together nicely. Theoretically you could use the MCU to talk to NeoPixels but I'd not want to be the one who ports the code. Good call on the APA102 chip!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube