After watching Guardians of the Galaxy I realized that nobody uses flashlights in the future. Pick any movie set in the future and instead of a flashlight people use some kind of fancy luminous rod or an ungodly bright ball of light to light their path. In the opening scene of GotG I saw how impractical-but-awesome a handheld lantern ball would be and I totally had to have one.
Here's what I'm going for:
1. Must be oh-dear-Lord-I'm-blind-why-is-that-so-bright bright.
2. Must be dimmable to mitigate item 1 in the event I actually want to use it for anything.
3. Wireless charging so I don't have to ruin the aesthetic with a charging port.
4. Controlled with a single-button-interface so I don't have to ruin the aesthetic with buttons and switches all over.
Did I mention I want this to be bright? Like hand-held headlight sort of bright? Initially I thought this type of thing would be a cakewalk. I mean, everyone's first project is just figuring out how to light up an LED, right? Well I tried that, but even a string of high brightness white LEDs is just enough light to read by. I've settled on a pair of Cree XML2 wide angle high powered LEDs, which can be driven by up to 3 amps constant current. That's more like it.
Dimmable because why not. The challenge here was finding a constant current driver with a PWM input and a small enough form factor to cram into an 80mm ball with everything else. I settled on a 1 amp driver because I also have concerns about controlling heat dissipation. This forced me either to use a 2S Lipo to drive the LEDs in series with one driver or to use two drivers and consume 2 amps at full power from a 1S Lipo. I decided on the series configuration as that should also help with battery life.
Wireless charging. A 5V wireless charging module was easy enough to find. Of course, this would only be capable of charging a 1S lipo. That means I need a way to switch the lipos between a 2S configuration for powering the system and a 1S configuration for charging. Using DPDT logic level relays I can switch a pair of 1S lipos from a series configuration for discharge and a self-balancing parallel configuration for charging. Sweet.
One button to bring them all, and in the [light of a hand held lantern] bind them. With some clever programming this isn't terribly difficult. The hardest part is powering the system up using the button when the microcontroller isn't running yet.
I started de-soldering connections, more or less working my way backwards until something worked like it was supposed to. Except that never happened. I broke down and bought another batch of components which should arrive soonish. From the testing I've done the circuit should actually work, which leads me to believe that the micro is fried. Unfortunately, it'll be a huge pain to swap it out since basically everything is built up around it. I think I'll replace it with a socketed ATtiny85 8-pin DIP, since I actually have some now. I've learned my lesson - I'll be using IC sockets for everything from this day forward. I've been slowly getting the hang of DipTrace and I may just send out a board to get fabricated like a normal person.. as cool as the deadbug air wiring looked I think I need to take a different approach.
I'll update this log once parts show up and I figure out what I'm doing with my life.
EDIT: DERP the schematic I uploaded is wrong. I criss-crossed the coils on the two relays. The actual hardware I have here is wired correctly, but the schematic is wrong. I'll fix it and upload a new one shortly.
I took some time this weekend to continue assembling this thing.
At this point there wasn't much left for me to connect, so I prepped the batteries. A quick test showed that they weren't exactly balanced and I figured it would be bad to just... plug them in like this.
So I shorted them together through a power resistor. Now kiss! Also I put them in a frying pan in case I suddenly found myself with a smoldering pile of plastic and lithium.
And now the moment we've all been waiting for!
I plugged in the button and... it doesn't work. As soon as the microcontroller powers up it seems like all the pins go HIGH - the LED's go to max brightness, the relays jump back into "charge mode", and the one pulsating LED in the button never fully dims. I need to figure out if I fried the microcontroller or if there's something else at work here... This is what I get for jumping straight into assembly without testing the subsystems first.
As I populated the board I had to make a few tweaks to the layout.
Look at all those potential shorts! If only I knew what I was doing... The LiPos I bought have built in protection circuits that should protect against short circuits but I can't shake the feeling of impending catastrophic failure and lithium polymer battery fire. I'll just try extra hard not to drop it so it doesn't explode. Actually, that's exactly what happened in the opening scene of Guardians of the Galaxy so I'll consider it a feature.
I decided to put the charging circuitry on first. The charge controller I chose was an SOT-23 form factor, which is pretty tiny. I bought 4 of them fully expecting to destroy a few or sneeze and lose one forever. Turns out one was enough so now I have 3 extra to.. you know, charge stuff I guess.
I painted one side of the board white because I wanted to.
I plugged in one of the batteries and soldered up the wireless power modules to make sure everything worked as intended. It didn't explode and the LED came on when it was done, so I guess it works.
I went ahead and charged the other battery too, so hopefully they stay at least kind of balanced for when I plug them both in together. Unplugging JST connectors sucks.
After selecting components I decided to tackle board layout. I will be using a small piece of perfboard. I sketched up a wiring schematic or three but quickly discovered that this strategy would not work well for laying out components on the board. I downloaded Eagle and taught myself just barely enough to generate a compact board layout which would help me figure out where components should go and which side of the board to put them. I couldn't quite find all of the right component footprints and the PCB traces are just general routing guidelines. I planned on deadbugging and air wiring some of the components anyway. This is one of my nearly final iterations.