This tutorial is aimed at getting some instant gratification from your WS2812B LEDs (trade name: NeoPixels). I'll briefly cover a bare-bones setup for the Particle Photon.

Transcript

G'Day! If you've got some addressable LEDs, these are WS2812B's, also known by the trade name NeoPixels. If you've got some of these and you just want to get some instant gratification powering them from a Particle Photon, this tutorial is for you. This will work with any number of LEDs up to from just a couple to very very many the only constraint that you'll have there is powering them so for this project, I'm carrying everything from a lab supply but a 5 volt DC power supply will do. I won't cover pairing the photon to your particle account because that's something that we've covered in other tutorials, so I'll link those below. Let's get started.

So first things first is to assemble the Particle on a breadboard in the way that I have with the picture just to clear things up a little bit we have 5 volts coming in I've just used a DC barrel connector with some screw terminals, so we have a main power leads, these red and black that's carrying 5 volts that 5 volts is going straight to our LED strip to power that it's also going across the bus of the breadboard to go into V in of the particle because the Particle is a 3.3 volt device, but if we put 5 volts on the Vin Pin, the Particle will be able to regulate that down to 3.3 volts. Now because the LED strip is a 5 volt device, and the Particle is a 3.3 volt Device, in the middle here I have a logic level converter which is essentially a voltage translator so that 3.3 volt signals from the particle get translated into 5 volts for the LED strip. Now we can head over to build.particle.io and what we can do here is either copy and paste the example from this code block but if you want to see where that came from you can also import it yourself, that's an Adafruit example. So we can go down to the libraries tab on the bottom left open that up and we should see an entry for NeoPixel, this is the neopixel library if you don't see that you can just enter NeoPixel in the search box, we can click on neopixel and this is all the libraries that are required and we also have three examples. So the example the today is this a - rainbow example so we can click that and I'm going to click "use this example" we could we're going to choose to include the library into a project that we're writing but I'm just opening this example so I click use this example and that will pull it into my local projects so we can see here now in 'My Apps' I have something called Infinity Mirror and below that is the rainbow that infinity mirror is is an old project but if I click on this a rainbow project we already have it open on the right and very simply we have only two parameters that we can really change straightaway the pin that the LED strip is connected to is d2 that's how we've wired it, so that's okay, and we have 10 LEDs in our strip defined at this point. So if we upload this code only 10 LEDs will work which is fine but I've got a whole roll here so I'm going to blow that out to something like, let's just say a hundred, there is probably at least a hundred on the roll, I already have my particle device linked with my account and you can see the devices connected there if you need to set the target you can come down to devices on the bottom left and select which particle device you want to upload to. I already have my target set so I'm just going to hit this flash button. Whoops, and just waiting for that to complete.

We can see some status down the bottom of the the flash status has been a success and if we come over on to the bench we can see the LED strip is now running this cool rainbow demo around what looks to be maybe 2/3 of its length so, while we are here, why don't we just take a moment to change how this script works I'm sure we can find something interesting why don't we why don't we speed it up a little bit so let's just have a dive through the code. We have this set up and then we have the loop and the only thing that's running is rainbow with some argument, 20, if we go down to rainbow my rainbows defined that's just below and we can see that the argument that's going in is called wait and when delaying for wait so that 20 is going to be a delay in milliseconds between frames of animation so if I set that to 1 and reflash the particle, the particle photon, let's let's see if that behaves as expected this should have behaved much faster now. Just wait for flashing to complete and now here so now the whole thing is going full disco, so that's pretty cool.

So there you have it a quick start guide to getting your addressable LED strip to go full disco I'll see you next time.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.