In this guide, we will be looking at how to set up the Glowbit Pico Orb Snowflake and Bauble Kits. We will be looking at how to get going with the default code they ship with, breaking down how the code works, and learning how to modify it to make your own custom Christmas ornaments.

Transcript

This microcontroller could make you a billion dollars. I'm filming in here. Santa! Merry Christmas, Jimmy! It's Jared. Right. Oh my, it's a Core Electronics Glowbit Pico Orb Snowflake Kit. Let's take a look at how to set one up.

In your kit, you will find a Glowbit Orb with all the LEDs that we will be lighting up, a Raspberry Pi Pico, which is the little device that we'll be using to control the LEDs, a micro USB to power this all, and two of these acrylic diffusers to diffuse our LEDs. And you'll also have some mounting hardware for the diffusers and a little bit of wire to hang this up. Now, you're either going to have the snowflake kit or the bauble kit. The snowflake kit comes with the snowflake diffusers and the bauble kit comes with the bauble diffusers.

The code that comes preloaded on the Pico will also be slightly different between the two kits. Just, you know, some animations and colors that it shows by default. However, this guide will show you how to set up and customize both of these kits however you want. Link below is the written version of this guide where you can find more documentation and demo code and instructions and all of this if you need.

Starting off, pick a diffuser that you like and peel the protective paper off the front of it. Some fingernails would really help here or just use the included little tool to get that, you know, edge going and then peeling off. Just be careful because acrylic scratches easily, so don't use anything metal on them. Once peeled, use the four standoffs and eight screws to mount the plate to the top of the Glowbit Orb like so. Then grab your Pico and pop it into the rear headers like so. Just ensure it sits all the way in there.

Now, how you hang this is up to you. You might have some nice fine tinsel or string, but we've included some wire for you if you need something and it's pretty maker themed. A nice way of doing it is folding the wire in half like so, tucking the loop through the top hole, then feeding the two loose ends through and pulling it tight. And then with your straight ends, just go ahead and tie a simple knot. With that, your orb is ready to go on the tree. We just need to power it through the micro USB, which goes into the top of the Pico like so. And we should automatically get a nice little animation going.

Now, in terms of powering this, we recommend a USB power source that can supply up to two amps at five volts. A USB wall charger will do this just fine. And if you need something more portable, a phone battery bank should work as well. And there we go. We have our little bauble or snowflake ready to go up on the tree. And if you're happy with that, you're done. But this is a fully programmable LED panel. So let's go ahead and learn how to modify it.

To do this, we're going to need to install a program called Thonny, which works on Windows, Mac or Linux. Once you've installed Thonny, go ahead and open it up and ensure you have your Pico connected to your computer via USB. In the bottom right of Thonny, you should be able to find your Raspberry Pi Pico and connect to it like so. After selecting it, we can hit view and go to files and see all of the code that's on it. Now, there's quite a bit going on in here, but you don't need to know about all of it.

In here, we have a file called orb extension, as well as some Python scripts called Glowbit and Petme. We can ignore these as these are just part of the libraries that help us control the LEDs. What we are interested in is the main.py file. So we're going to go ahead and double click to open that up. And I'm just going to close the files tab here so we can see it a bit better. The code that we place in this file called main.py is what the orb will run automatically when we power it on.

Now, I'm using the bauble here, so I've got the bauble code loaded into main.py so it acts like a bauble. But if we open up our file viewer again and we go into examples, we can see that we have not only the bauble code, which is in main.py now, but also the snowflake code here as well. If I go ahead and press control A to select all and then copy and then paste it into here and save that, this will now behave like a snowflake instead of a bauble. It'll have the snowflake default code. And vice versa, if you have the bauble and you want to try the snowflake, you can try out the snowflake code by pasting it in.

Now, this bauble is going to behave like the default programming of a snowflake. And if you have the snowflake and you want to try out the bauble, you can do the exact opposite. It might be a smart idea to leave bauble and snowflake as they came and not modify them at all. So you have a backup, you know, on the Pico if needed. If you do accidentally change or delete these, you can get all of the code you're seeing here in the written guide linked below. Alrighty, let's take a look at the bauble code first. Don't worry though, we will be modifying the snowflake code next. So let's start by running...

through the board code and actually seeing how it works, what's actually going on here. So our code starts by importing the libraries that we need, including orb extension, which handles all the LED interactions. Then we go ahead and set up our orb and define some colors here. Here we're defining a red as our top color and a green as our bottom color. These names you can kind of set to whatever, we've just chosen top and bottom here. Then we start by using this handy function.

Now, there are a few functions in this library that just kind of make using the LED a bit easier. This one called segment by axis allows you to kind of split the orb into two sections and organizes all the LEDs to make it easy to use. And here we're using it to split the orb into a top and bottom half, and we're just calling this above and below. Now we get to the important part of our code. We have two functions called action A, and down here we have action B. Action A and action B, these are kind of the frames that you can alternate between in the code.

So you might put your colors or your animation in there and whatnot. It's where you put the thing that you want your orb to be doing in, the actual code for it. So those are our two functions. We're just going to come back to them in a sec. But if we go down, we can see that we have our first kind of important command, which is clearing the ornament. It gets rid of all the LEDs on there because every time we restart this, we want to clear what was on there. And then we have our infinite while true loop, which is just going to keep looping whatever code we put in here.

And it's really straightforward in here. We're saying do whatever is in action A and then put the board to sleep for half a second. This just means it'll pause for half a second. Then we say do action B and then pause for another half a second. And so this is just going to keep going between action A and action B. So let's take a look at what is actually in action A and action B. So in action A, we have a bit of an animation going in here. And anytime you kind of do animation with LEDs, it's probably going to be using a for loop like so.

This loop here basically says all the pixels in above, so the top half, I'd like to go through them and set them one by one. And I want to set them to the top color here, which if we scroll up is basically saying I want to set them to red. So essentially this section here is going to go through and set all the pixels in the top half clockwise. And this sleep here is the time between each pixel being set. Just for the fun of it, I'm going to set this to 0.5 seconds. And we're going to go ahead and run that and see what that actually does.

We should see that the red now, see how slow it's moving now? That's because we changed the sleep. You can change the value of that sleep to make this spin faster or slower or whatever you need. Now this line here does the exact same thing, but it does the below, which is the bottom half. And it does it in the bottom color, which if we scroll up, we set it to be green. So action A sets the top to be red and then it sets the bottom to be green. Very nice. If we go down to action B, however, we can see that we've got pretty much the exact same code, but instead of setting it to top color and bottom color, we set it to blank color, which is blank. It's nothing.

And that's how the animation works. It runs action A, which sets red and green, and then it runs action B, which sets blank and then sets blank. And we get that infinite loop cycling. Very nice. So how can we modify this? Well, first of all, some very easy things is we could go ahead and change the colors that it's cycling. These are just RGB values. And if you go ahead and Google RGB color picker, you should find something that lets you select a color and get an RGB value. And you can just go ahead and paste them in here like so.

Here I've gone ahead and changed this from red and green to orange and blue. And if we go ahead and run this, by the way, when you press play, it will save it as main.py. So whenever I unplug this and replug it back in, it'll have the code saved. And if we take a look at it, we now have our orange and blue cycling instead of red and green. Alrighty, I'm just going to go ahead and undo what I did there. And I'm going to go ahead and create two new colors like so. Let's go ahead and pop that in.

So I've created two new colors here called top color two and bottom color two. And just for the fun of it, I'm going to go down here and change this. So instead of clearing it with the blank color, it's going to set this to top color two. And then it's going to go ahead and set it to bottom color two instead, like so. Now let's go ahead and run that and see what happens. So we should do red and then green, and then we should wipe purple and yellow. Very nice. And that is pretty funky. You can go ahead and change the sleeps and timing and all of this to speed it up or slow it up or whatever you need as well.

Let's do one more thing here. I'm just going to go ahead and undo that again, just to get back to the default, everything we had of the red and the green, like so. If we take a close look, we can actually see that this middle row of LEDs is actually not being lit up. Let's take a look at some more functions that can be very helpful and actually use them to light this up. For the sake of ease here, I might actually go ahead and create another color, and I'm just going to go ahead and set it to white, like so.

And then down here, I'm just going to put it outside of the while true loop because I want this to kind of...

here and stay there kind of forever. I'm going to go ahead and use this orb.pixel set. And this is going to set a certain color. I'm going to set this to white instead to a certain pixel. Every single LED on this board has a number. And I'm basically saying I want to set number 42 to white. And 42 just so happens to be the middle one. And by the way, the LED counting system starts on the very outer left and it goes 0, 1, 2, 3, 4, all the way through to 23. And then it moves in one all the way around, in one all the way around, in one all the way around. You start counting from the left every time.

So let's go ahead and run this one where we set the inner one to white like so. So with that, you have like individual level control over every single LED on the board. Now let's say I wanted to make that whole middle line white. We could find the number of every single LED on that line or we could use the set line function, which does exactly like it sounds. This is our orb.setLine. And we're saying we're going to set it to white. And we want the line to kind of line up with pixel 0. So pixel 0, remember, is the outer left one here. And we're saying I want you to start here and draw a line going all the way through the middle.

If instead we set it to pixel 6, so if we count it all the way out, that would be the top pixel here, that would draw the line all the way through. So basically you select where you want it to start and draw the line through the middle of it. So let's now instead give that a run. And we should get our whole middle row lit up as white. And now we have our animation cycling around it. Really nice. There's one more really helpful function that we want to cover. And to do that, we're going to need to take a look at the snowflake code instead.

So I'm going to go into our files and I'm going to stop it, which means that we can interact with the Pico and it's not putting out LED patterns and whatnot. And I'm going to go into examples, open up the snowflake example, copy it all, and I'm going to paste it into main.py, save it. And if we give that a run, we should see the default snowflake animation. So the snowflake code is pretty darn similar to the bauble code. We go ahead and import our things exactly like we did before. We go up and we set some colors. Then we have our action A frame and our action B frame. And then we just clear the ornament. And in our while true loop, we alternate between our A and B, exactly the same as before.

Pretty much the only difference is what we're actually doing in A and B. In our action frames, we have this set ring function that we wanted to touch on just before we finished. This ring function is super easy to use. And, you know, we've got like a circular thing, a sort of, you know, circular function would probably help out quite a bit. And this is just going to let us set the color of an entire ring. So the outer one is going to be zero and then one, two, and then that little dot in the middle that we're calling a ring is going to be three.

So in our action A, we set some colors on our rings and then we use pixel show to actually show it. And then in frame B, we just set some different colors for each ring and then show it. So we're kind of just alternating between the two. Let's do one more modification here before we wrap the video up. And we're going to add some more action frames here to create a sort of chasing animation on our snowflake. Starting off, I might add another color here and I'm just going to maybe pick something tealy to, you know, match this. But, you know, go ahead and set your own colors as you need.

Then we can just go ahead and if we copy this whole function, we can just paste it in like so. And I'm just going to call this action C instead. And then I might do another one and I'm just going to go ahead and call that action D. Then in our while true, I'm just going to go ahead and again copy it. And I'm going to say, hey, let's call action C after B. And then let's go ahead and call action D after C. So now we have four frames that we can use and we're just going to be cycling through them in our while true loop.

Now to make it clearer what we're actually doing here, I've gone ahead and removed all the colors from our action frames. And I'm just going to copy our white here. And I'm going to say on action frame A, I want it to be the outer ring, which is zero. And then how about we move in one to one and then two and then three. And I'm just going to go ahead and do this for all of our colors. Awesome. Now we should be able to just go ahead and run that code. Nice. As you can see, we're kind of just dancing. The color comes out the inside and then it keeps jumping down into the middle in this like infinite loop we've got here.

Well, that about wraps us up here. Hopefully we've given you enough to go out and make a neat little Christmas ornament to hang on your tree. It's also worth mentioning that in the examples file is the all examples code, which has some more demos of using the functions that we looked at and also a few other goodies that we didn't like a comments animation. But yeah, go have a play, make something cool. And once Christmas is over, you can either shove this in the Christmas tree box till next year, or you can use this for another project. We designed the Glowbit Orb to have more uses outside of just being a Christmas ornament. The outer ring has 24 LEDs, the inner has 12 and then six and then one. This could be repurposed as a clock or a timer.

A lot of things are divisible by 12. A lot of things around us also use sort of circular gauges, and you now have an LED matrix in the shape of a circular gauge. We're just trying to, you know, get those creative juices flowing after Christmas for a project. If you need a hand with anything from this video, or if you just made a cool Christmas ornament that you want to show off, head on over and post about it on our community forums. We're all makers over there. Until next time though, happy making. And Merry Christmas.

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.