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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Rpi0 and WS2812 pixel strip
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 2 replies
  • Subscribers 684 subscribers
  • Views 730 views
  • Users 0 members are here
  • led
  • raspberrypi
  • pixels
Related

Rpi0 and WS2812 pixel strip

Former Member
Former Member over 10 years ago

I am working on a simple project to control a 8-LED WS2812B pixel strip from a Raspberry Pi Zero. Nothing fancy, just want to be able to send instructions from the Pi to the strip and have the LED intensity and color controlled via (Python?) script. I have some resistors, the WS2812 strip by Nulsom, the Pi, and the GPIO breakout and breadboard kit. What's the best way to connect this? I've seen some Arduino instructions thay say to use pin 9 on the Arduino which is a digital out and supports PWM. Is that the same as pin 21 (PCM DOUT) on the Pi, or should I be using a generic GPIO pin (i.e. 11) on the Pi? Do I need to add any resistors, capacitors or transistors? I appreciate any help!

  • Sign in to reply
  • Cancel
Parents
  • rew
    0 rew over 10 years ago

    The WS2812 protocol is quite simple: make the output high, wait for 400ns, output the first databit, wait another 400ns, then make sure the output is LOW and wait another 400ns. Repeat for the other 23 databits for the first led, repeat for all the other leds in your string. Make sure that you don't wait more than 50 microseconds with the signal LOW because that is an indication for the leds that you want to start over!

     

    Sounds simple, but isn't. The timing requirements are pretty strong: wait 400ns too long in sending a "0" bit, and the WS2812 thinks you sent a 1. Actually, if you want 400ns, you actually SENT a 1. Somewhere between 0 and 400ns the WS2812 will starting thinking you sent a 1.

     

    Anything simple that does things with the GPIO pins is out of the question.

     

    On the "more complicated" list is: Write a kernel driver that does things with timers and such. Still: Won't work: the timing requiremetns are too strict for that.

     

    What CAN be done is to use a DMA controller inside the ARM processor to toggle the right bits at the right time. This is not a beginner programming job... On the other hand, someone beat you to it: https://github.com/626Pilot/RaspberryPi-NeoPixel-WS2812

     

    On the other hand, you can buy my usb_ws2812 at WS2812 usb controller and leave the low-level stuff to the board. But then again, you wanted to do it without an externall controller. But it IS easiest that way....

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • rew
    0 rew over 10 years ago

    The WS2812 protocol is quite simple: make the output high, wait for 400ns, output the first databit, wait another 400ns, then make sure the output is LOW and wait another 400ns. Repeat for the other 23 databits for the first led, repeat for all the other leds in your string. Make sure that you don't wait more than 50 microseconds with the signal LOW because that is an indication for the leds that you want to start over!

     

    Sounds simple, but isn't. The timing requirements are pretty strong: wait 400ns too long in sending a "0" bit, and the WS2812 thinks you sent a 1. Actually, if you want 400ns, you actually SENT a 1. Somewhere between 0 and 400ns the WS2812 will starting thinking you sent a 1.

     

    Anything simple that does things with the GPIO pins is out of the question.

     

    On the "more complicated" list is: Write a kernel driver that does things with timers and such. Still: Won't work: the timing requiremetns are too strict for that.

     

    What CAN be done is to use a DMA controller inside the ARM processor to toggle the right bits at the right time. This is not a beginner programming job... On the other hand, someone beat you to it: https://github.com/626Pilot/RaspberryPi-NeoPixel-WS2812

     

    On the other hand, you can buy my usb_ws2812 at WS2812 usb controller and leave the low-level stuff to the board. But then again, you wanted to do it without an externall controller. But it IS easiest that way....

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
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 © 2026 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