Tuesday, February 20, 2018

PortaLED

I was also able to assemble the other PCB, the portable LED circuit thing. It was rather interesting assembling it since I had to go in and fix a few places that didn't reflow well, and I accidentally dumped a ton of flux on the board (didn't realize the flux pen would release so much). After a bit of debugging, the main LED driver seems to work and I am able to program the microcontroller. However, the battery charger doesn't work, or at least charging indicator light doesn't work. I'll need to figure that out later. Also, during my debugging process I lifted a pad somehow and one capacitor is soldered in at an angle now.

Completed board. A bit gunky from the left over flux.
My idea to program the microcontroller with the pads on the bottom of the board turned out to not work so well. It was too difficult to maintain good contact with all the pins without some sort of clamping rig, and for now I just soldered in some pins. I can take them off when I'm happy with the firmware.

Programming header.
This thing is stupidly bright. And hot. Running the LEDs at full power generates quite a bit of heat from the LEDs, and I'll likely limit how long that mode is allowed to run for.

Bright.
Things to do (updated 2/25!):
  • Fix charger (seems to work but LED doesn't turn on during charging)
  • Add different brightness modes (added 8 brightness modes; thinking about implementing a brightness ramp and shutting down some brightness levels when battery gets lower)
  • Add battery low voltage shutdown (code doesn't allow lights to turn on when battery is below a certain level, need to add warning)
  • Add battery voltage blink out (done, but code is blocking and a little buggy)
  • Design a case (in progress)
All updates 2/25:

I've just written a simple firmware for the light; it now has 8 brightness modes and can display the battery (or VCC in general) voltage. I'm still considering adding more brightness and blinking modes, but for now my focus is designing a nice case for it. (Code at my Github here.)

Reading more into the datasheet of the ATtiny85, I think I've just found my new favorite microcontroller for small projects. It can has 4 PWMable outputs (some can be setup to be opposing pairs with a deadtime generator) and a differential analog input mode with internal 20x gain, and everything else in a normal AVR. The PWM I know isn't that special, but I'm not sure how common the differential input mode is among 8-bit AVRs. Regardless, a cool feature I will want to try out some time.

Saturday, February 17, 2018

LED Flash

I was able to come back home for the long weekend and assemble the PCBs I ordered from OSHPark. I designed an LED flash driver and a constant current portable LED light thing (that I really don't know what to call) several weeks ago and only now have the opportunity to put them together.

Some background on why I made these: For EE lab in school we were asked to order free op-amps from TI, and I decided to just get some more free parts while I was at it. I wanted to make a simple LED flash for high-speed photography, and wanted to test out the UCC27324 MOSFET driver. And since I was already using LEDs, why not learn a bit about boost circuits and constant current LED driving with the LM3410 constant current boost LED drivers? All of this is good design practice in the end too.

Back to the LED flash. Here are the PCBs for the flash and constant current driver:
Purple PCBs!
Close-up of the flash.
Here some screenshots from KiCAD:
Schematic

PCB

Monday, February 5, 2018

Super Blue Blood Moon

Super blue blood moon! What a mouthful! On January 31st, 2018, there was the second full moon of the month, the moon was closer to earth than normal, and it just happened to be a lunar eclipse, giving rise to the red moon.

I decided to wake up early in the morning to take some pictures of it with some friends. They turned out pretty well:





This time I managed to capture the red color! I think the compression from Blogger kills the image quality, but you can these photos (along with a few more, all in better quality) and a relatively uninteresting timelapse on my Flickr.

Thursday, January 11, 2018

Holiday Trinket: Third Time's a Charm?

Nope.

I got some new solder paste to see if it was the source of the issue:

Fresh paste.
Used the stencil to apply the paste to a new PCB:
Paste applied.
 Placed all the components:

Ready for heating.
Fired up the skillet:

All soldered in place. (I had to manually solder the
center LED as it didn't reflow properly).
And after soldering the battery holder and switch to the back side, I was greeted by this:

More than before! And alternating!
A non-oscillating circuit. I tried to apply different voltages as the supply (since during simulation I realized low voltages could cause the circuit to lock up) and none of them worked. I'll see what else I can do to attempt to debug this later.

Tuesday, January 2, 2018

Holiday Trinket: Take Two

Turns out it was essentially impossible to solder the transistors upside down; It didn't help that my solder paste was "expired" and incredibly runny. The method of using a toothpick like CNLohr failed miserably on the tiny pads. Despite knowing that everything was going to go badly, I still tried to put one trinket together.

I ordered a new set of PCBs with the transistors corrected and got them a few weeks later. Today I attempted to assemble a trinket again, but this time with the aid of a stencil. I ordered a simple plastic solder stencil from OSHStencils so I wouldn't need to precisely dab solder paste anymore.

Stencil in hand.
Using the same runny solder paste from before, I just had to spread a blob of paste over the stencil using the provided plastic card until all the holes were filled.

Stencil aligned and ready to go.

Saturday, November 25, 2017

Holiday Trinkets

I've been messing around with ring oscillators and decided to make a little holiday-themed trinket to give out. It was a good opportunity to get back into PCB layout and to learn how to use LTSPICE to simulate the circuit.

I originally wanted white LEDs, but with their high voltage drop and the 3V of the coin cell, they would never light up. In the end I had to use red LEDs with their Vf of ~1.8V. (This is when a green soldermask is more fitting for the occasion and better complements the red. However, the purple still looks amazing.)

Snowflakes!
Backside!
Of course, since I didn't think there could be an error in layout after checking that the schematic was right, there was an error. An error I found a few days after sending off the design.

Turns out the pin out for the default 2N3904 in KiCAD differs from the SMD MMBT3904 (which I really should have checked the datasheet for). The base and collector pins have swapped pin numbers, so when I solder up these circuits, I will have to flip the transistors upside down. And I thought I would have learned from the nixie tube clock. Oh well.

Friday, November 3, 2017

Ray Tracing and College

Working on a ray tracer has been quite fun, especially when debugging it when the image doesn't come out right.

I don't think that box is supposed to be cut off.
This was a bug with transforming the bounding box with a rotation.
It's mainly based off of Peter Shirley's raytracer in the Ray Tracing in One Weekend series of books, just implemented in Java. It's certainly not fast, but that's not really a big issue since I'm treating this renderer mostly as toy to learn more about the fundamentals of ray tracing.

Teapot! This uses a rather inaccurate model of glossy surfaces
but looks nice.