The lightPi is actually the first project that I did related to Raspberry Pis. And I kind of just forgot the reason why I first started doing it. I may have done it because I wanted to try to ... wait, I remember now. My first idea related to all these projects was to control an LED strip, making it go on and off with controls with SSH access(and through PHP too). That little thing grew into the multi Pi project that I have on display on my Projects page.
The 10.0.0.10 just means it's accessible through my own home router for accessing the services and controls. I have 10.0.0.2-9 on reserve for my other devices, and all these internet-of-things stuff starts on 10 and goes on.
Special thanks to then UVB-76, now Agiri, for inspiring me and helping me with all these projects and teaching me the fundamentals of programming as well as electrical stuff.
The lightPi was first started as just an LED strip light controller for fun, it wasn't even for lighting. After moving to an apartment, I became lazy at turning off my lights in winter nights(I'd assume that no one wants to get out of a warm bed on a cold winter night), so I started this project so that I can switch my lights on and off without having to get out of my bed. So pretty much 50% of my projects are related to laziness, 50% for fun. In this case, something fun became super useful.
I forgot how I controlled it in the beginning, yes I have a bad memory. But right now, it is being controlled by a MOSFET(IRLB8721 N-Channel) with the gate pin connected to one of the Pi's GPIO pin. The Pi sends pull-up and pull-down signals to control the MOSFET, and the MOSFET's source pin is connected to ground on the PSU(Power Supply Unit) and drain connected to the ground on the LED strip. Also, it started as a premade LED strip, and it just wasn't bright enough to light my studio. After about 2 months, I decided to go with custom-made LED chips. Basically just soldering my own LED lights for the maximum brightness that my power supply can handle. I used a custom made PCB with 24 pieces of 2835 LED chips that was supposed to be used as lights in trucks. I soldered 10 of them in a ringshape given that they're 4.8W a piece, so 48W in total with 240 pieces of LEDs. Divide that by 12V that's 4A, which makes it just under the 5A rating on my 12V PSU.(it's a cut-up laptop charger I bought from eBay. Love these chargers, built-in everything including fuses. I also used these power adapters on my other projects.)
I have two goals when making stuff, whether it is a physical gadget or coding programs. The most important thing to me is that it has to work. As long as it works, I'm good. The other thing is that it has to be as simple as possible to maintain or to upgrade. I don't want a bunch of random wires, or excessive components or complex designs to just make one thing work and eventually forget what the wires were all about. So when designing this whole light thingy, I decided to go with just one PSU that powers both the Pi, as well as the LED strip. One of the perks of a Raspberry Pi is that it can be powered through the GPIO pins with a 5V supply. Problem is, I'm using a 12V charger. But that wasn't hard to fix, a 12V to 5v step-down regulator saves the day. So in the end, the 12V PSU wire connects to the LED as well as the regulator to power the Pi. And there is my goal of simplicity that one PSU powers everything, and it acts just like a regular light.
Oh, I should also mention the physical light design. I bought one of the floor lamps that Walmart sells for about $14. I took out the bulb that came with it and wrapped the PSU's power cord around the stand to make it somewhat nicer(instead of having lose cord hanging in mid air). The lamp came with a half-sphere holder with the opening facing up, which provides me the space to put my custom soldered LED ring. The positive and negative wires of the LED going outside and around the sphere holder, and I have been thinking to just poke two holes on the plastic holder to run the wires through(I Actually Did.), but then, it wouldn't solve any major problems, and it's already working AND I have to resolder the wires to put them through and solder them back. NAH, I'm good for now.
The control part is pretty straightforward. Because I have been setting up my own web servers on my production server, and I am so fluent with setting it up, I decided to go with NGINX+PHP on the Pi(essentially it becomes a webserver). A PHP script that utilizes shell_execute() function to execute native Pi commands to control the GPIO pins to turn the lights on and off.
What happened later...
Even more extra features:
Thanks to Agiri, I have a whole set of programs installed on the lightPi for even more light effects, like dimming, breathing, and reactive to music. So basically when there's a beat in the music, the light goes bright, and fades off, creating a super cool visual effect. Later on I migrated this feature into a standalone project as the 10.0.0.14 clubPi(because it makes my apartment looks and feels like a nightclub :P )
What happened two weeks after I wrote this project description:
Two weeks after I wrote everything above, (about a year later since the original setup with the LED strip) I finally resolderd everything, and made everything much much nicer. The reason for this rework was because I used a tiny breadbord to plug in the MOSFET and all of its pins. The MOSFET generates a huge amount of heat, to the point where it melted the plastic cover of the first breadboard. I noticed this because the light kept on flickering from time to time and it annoyed me SO MUCH. But I was lazy then, I replaced it another breadboard, and of course that got melted again and started to flicker, again. I didn't want this to be a fire hazard because of the possibilities of shorts after the plastic melts, so I did a whole rework on this part.
I used a 50x70mm through hole PCB board to solder the TO-220 packaged MOSFET, with a 40x40x20mm heatsink thermal pasted on the back of the MOSFET, and hot glued the heatsink onto the PCB. To make sure it dissipates all the heat generated form the MOSFET, I also added a 12V 40mm fan on there blowing air towards the heatsink.(Later I found out that the fan was an overkill. The heatsink itself was enough.). I originally had the 12V fan connected to the 12V PSU, but then realized it gets too noisy. Then, this great idea came to me, since if the LED isn't on, the MOSFET won't be hot, so the fan doesn't need to be on 24x7. So I connected the negative wire on the fan to the MOSFET. Voila, the fan turns on and off along with the light. But it still wasn't good enough, because that didn't fix the noisy issue, and here I did the most stupid and illogical thing: I solder a resistor in between the fan to the MOSFET to lower the voltage, which in turn slows down the fan. The result voltage was around 6V I believe. I called this action stupid because I have a step-down regulator soldered on the board too! In hindsight I realized that I could have just soldered the fan to the regulator, but I didn't... and I'm too lazy to correct this mistake, everything works fine now. I also replaced the Rpi 3B with an Rpi zero w for a smaller footprint on the stand. Here are photos of what this whole thing looks like now:
Scratch ALL THAT... on 9/4/2018
I had a rework on this whole thing again because something died... I replaced the Pi zero w a long while back because it didn't have enough processing power to act as my central processing unit, so I switched back to a RPI 3B. About the dead thing: I don't know exactly what died, but most likely the MOSFET died becasue the PI ran just fine, the light lights up if I connect the PSU directly to it, but it does not switch on. And if anyone knows me, which noone does, I hate breakable things. This time, I'm using a single channel relay to make things stop breaking once and for all. Same usual setup with the one difference that the Pi directly control the relay that controls the power to the LED lights now. Much Much simpler. I think from now on I'll start building everything simpler.
The 2020-4-16 update
Yes I used the Chinese date format, because it actually makes sense in places like this. 1. this is my space, I get to do what I want :) 2. the year matters the most on these types of things(that I only update it once couple months or years, in this case, 2 years.). The relay turned out to be the best choice I had made. And I think I'll be using just that from now, though I have made less and less things because of lack of time AND lack of ideas. Creativity dies with age? Maybe.