DEV Community

Joshua M Loran
Joshua M Loran

Posted on

A Desk Light Project! First steps into Dev'dom

Since this is my first blog post, like…anywhere, I think it’s appropriate to tell you fine people how I started my journey into the dev world. Micro-controllers! A while back I happened into an Arduino Uno starter box and quickly tore through all of the starter projects that were explained in the included book.

Micro controllers are great! Not only do they give us the ability to create something new, but also give us the ability to hack into almost any device that uses electricity as well has many that don’t.

A micro controller does exactly what the name implies, it controls things, more importantly it controls things in a manner that you decide. There are many controllers on the market these days with Raspberry Pi and Arduino being two of the most commonly known to hobbyists. A friend of mine had shown me his Raspberry Pi and it seemed like a bit of magic. I had no programming experience other than an intro to Java course I took one quarter in college. What made the Pi actually work completely escaped me, but I wanted to know how to MAKE the magic.

I asked my buddy to show me how the Pi knew to do things. He had no idea. He had put a Nintendo emulator a jillion games on there, fabricated a little box and connected it to his TV. COOL!! He knew how to load software on it and run a program, but had no idea how to write the games or make it turn on a light switch.

Arduino Uno...
alt text

I’m going to talk about and show you one of the first rewarding projects I did using controllers.

I put up some shelves up above my wife’s desk so she could have more storage, but in doing so made the desk a bit dimmer on the working area and putting a desk lamp to light it was a bit ridiculous.

I had an Arduino already so I knew I could probably something neat. I wanted to try to make some lights that one could control from their phone. So, i ordered a jy-mcu bluetooth chip so my arduino uno would be able to talk to another device through bluetooth. I also ordered 3 meters of neopixel WRGB LED strips for the lighting.

JY-MCU Bluetooth transmitter...
alt text

After reading the specs for all my components and doing a little online poking around, I wired them together accordingly. It is fairly straight forward wiring, and I learned quite a bit. The neopixel lighting uses only a single data line to control every light with each pixel talking to it's neighbor. I added a 1000uf capacitor to smooth out any energy spikes in the data line since a dirty power signal could cause dirty data. A 220ohm resistor was also necessary on the data line. It looked like this...

Inside the Box...
alt text

From the outside...
alt text

One of the main resources I used drive the lights was Adafruit.com, which is where I purchased the light strips. They have a neopixel library that always you to choose a pixel and feed it WRGB values. I asked my wife what kind of colors she wanted and went about finding the correlating wrgb values. Once I understand what was going on I wrote buttons to dim and brighten as well as seperate the 3 tiers so they could be selected individually or grouped. I then added some animations for Hannukah and Christmas. Adafruit also had a rainbow animation that I didn't fully understand, but still used!

The addition of the tier selection meant that you could have your desk lit by the color of choice, while the accent lighting of the shelves above could be a soft blue or violet, an in your face red or orange, or an cool animated rainbow. Here is a link to my github for closer look.

IMAGE ALT TEXT HERE

Discussion (1)

Collapse
izzygianino profile image
izzygianino • Edited on

Great project, and I love the outcome. Looks very cozy and creates a special atmosphere in the room. Moreover, it looks very professional and well-arranged inside the box. I also learned from your post about microcontrollers, namely that a microcontroller does exactly what the name implies: it controls things and, more importantly, it controls things in a manner that you decide. I arranged a similar light project in the garage, but I used LED interior car lights instead. It worked out well and still working after 8 months.