Acrylic LED Art Project: Daily Log #2

Today I chose my design for the acrylic image: the Mustang logo. Here’s what it will look like:

mustang logo

I also figured out how to code the dynamic RGB color changer! I first created a set of loops that would get the binary translation of the input (range of 0 – 1023, halved to 0-511 for 9 bits) and then equally shared the bits between 3 integers (R, G, and B). While this worked, it was essentially a randomizer; it would take a random color with no real correlation to the light sensor.

So I had to figure out something else. We were using the FastLED library for the project, however I didn’t take a look at it until now. I took a look, and the library happens to have an HSV (hue, saturation, and value) converter to RGB. It would be perfect for this application! The hue follows ROYGBIV order, and I could limit it to ge between red and indigo (past violet it turns back to red) and it would follow the sequence smoothly with a direct relationship with light level. Of course, hue is limited to 0-255 with the FastLED library but a bit of manipulation can get our input into that range, by simply dividing by 4 and flooring the value. I did some testing in TinkerCAD, and found that it works fine. I did have to find an alternative method of converting HSV to RGB, because TinkerCAD doesn’t support custonm libraries :(. I found someone’s code who does this already luckily, so I added it in at the bottom. You can see my code in my Git repository, here

Leave a Reply

Your email address will not be published. Required fields are marked *