Monday, August 20, 2018

CNC Upgrade?

I've been using my CNC on and off over the last couple of years, making parts for random projects but not really using its full potential. I recently had to make some plates for a keyboard a friend was making, and it had been nearly a year since I last used my CNC. It took a trial run to figure out the right feeds and speeds for my machine, but I was able to cut out some acrylic successfully for him.

However, during this quick run I saw the shortcomings of my CNC (and remembered how the last "upgrade" reduced my machine's rigidity) and decided to completely replace out the gantry. A significant amount of flex came from these unsupported x-axis pipes and I wanted them replaced with supported rails.

Added a steel bar so the bearing blocks don't roll independently.
After adding a temporary fix to the old gantry, it was time to start anew.

I bought some SBR20 rail, 8020 extrusion, and some screws that I didn't already have in my collection of random screws from overbuying for previous projects.
Parts arranged how they will go together.
In the span of a week after my summer internship ended, I steadily pieced everything together and got the gantry installed.

SBR20 rail installed into tapped holes.
Scrap piece of wood used as a mounting plate.
Nut mount for the plate.
Screw installed.
Old gantry.
New gantry.

Complete.
Spent some time figuring out how to use CAM in Fusion 360 and will likely be doing all my CAD/CAM all in Fusion now.
Test engrave of China. Seems to work fine.

Some things to fix:

The original bearing blocks for the y-axis rails have become loose (as expected with screws threaded into wood) and will need to be replaced with aluminum. The blocks also have some independent wiggle (issue that arose from the last upgrade) and I will likely need some more brackets to strengthen the gantry.

Now that the y-rails are further apart (due to my lack of planning; I really should have just used 1530 extrusion for the vertical beams too but no big deal), they extend over the edge of the wood sides and are currently only supported by a couple of bolts on the edge on top of far too thin aluminum angle (the only hardware I had on hand). This need to be beefed up and properly aligned to be square the the other axes. When installing the axes I only rolled the gantry back and forth hoping for the right alignment. The rails about 1/8" too far apart so the bottom extrusion of the gantry isn't flush.

Haha.

Sunday, May 13, 2018

LED Flash Testing

I was able to do some more testing with the LED flash using a photodiode to test the rise and fall times.

Jank setup.
The BPW34 photodiode is setup with a simple transimpedance amplifier (10K resistor and a 22 pF capacitor in parallel to form low pass). With this, we can see the pulses go through the LED. The rise and fall times appear quite fast, although I haven't fully quantified this.

Pulses.

With 22 pF capacitor.

Without capacitor.
Measuring the voltage across the 0.02 ohm current sense resistor, I get about 75 mV, which means 3.75 A is flowing through the LEDs. I will need to test what happens if add another LED in series, then another string in parallel.

Small note:
Moving the LED slightly removed even more ringing?: I just realized the opamp was hitting the rail. doh.
Clean.

Saturday, May 12, 2018

PortaLED Round 2

I've had a couple of ideas for some projects to make, all involving LEDs because RGB LEDs and lights in general are always fun. However, all of them would only look nice if I can make the enclosure. I want to make a small puck-shaped lamp which looks great in the mind but will likely looking rather ugly in real life due to my limited manufacturing abilities.

So before I get ahead of myself, I decided I need to actually finish my projects. I can't forget about the LED flash and the PortaLED (and the timelapse slider which I really should finish sometime instead of doing other things).

To finish off the PortaLED, I plan to build a full enclosure out of PCBs and redesign it to actually be portable like a keychain light.

The biggest electrical changes that need to be made are:
 - Smaller inductor (use the 1.6 MHz version of the LM3410)
 - Smaller diode
 - Proper Power OR
 - Buttons and switches on the board

When I was browsing Instructables, I came across this mini LED cube pendant:
http://www.instructables.com/id/LED-Cube-Pendant/. I found the compact construction and use of PCBs for the entire frame really well done, and in the circuit the author described a simple power OR circuit that would fit my needs. The use of a P MOSFET in the reverse direction and a diode would properly OR the battery and USB/ISP power so that the battery is not back charged by the ISP header and that when it is plugged in the battery is not charging and discharging at the same time. I also came across the MAX40200 ideal diode in my search for a solution and was tempted to use it, but found out that there are ICs with the P-FET and diode all in one package (from the site I saw before!: http://cameroncharles.blogspot.com/2012/01/petzl-zoom-led-conversion-final-chapter.html; he had the same OR and I didn't even realize!). I'll also be using the same smaller diodes the blogger used.

The OR is really quite clever; the internal body diode conducts when only the battery is connected and causes the VGS to become quite negative, turning on the FET and allowing the battery to connect with little forward voltage drop. When the USB is connected, the gate is pulled high and the FET stops conducting. The body diode will also not allow current to flow backwards into the battery. The FET's arrangement is just like when it is used for reverse polarity protection.

And now I realize my circuit is effectively a clone of the one above. Which is fine with me.

5.8.18

My PCBs should have arrived at my home today (still at school) and I just ordered enough parts to make three complete lights. I ordered my PCBs from PCBWay, and holy they are fast. I placed the order on the 3rd, and they are delivered in just 5 days. Crazy. Ten boards for $5. (shipping is $20, but that really isn't that bad.) I will be using them again for sure for any boards I need in higher quantities and bigger than 3 sq in. Hopefully there are no errors in the layout (it's almost the same from the last revision).

11 (!) Red PCBs.




Time to begin planning out the larger lamp I have in mind.

5.12.18

Now I'm back home, I was able to solder up a board. There are still issues with the design, and I'm not sure what is causing it. Just like the first version, after programming the microcontroller the light is unable to sustain and brightness except the lowest one. The other modes just blink. Also, the LiPo I was using was somehow depleted to far below safe levels (maybe a short?). When I directly connected the DIM pin of the LED driver to VCC, the LEDs did turn on to full brightness, so I know the LED driver works. However, with the small 4.7 uH inductor rated for 1.2A, the inductor started to smoke. Changing it out for the 16 uH inductor from the previous version fixed that issue (although it is much bigger).



I can't figure out what is going on with the microcontroller and why it won't output anything on the PWM pin. I feel that there might be a brown out when the system turns on. I also noted that when the system is running part of the rail drops to ~2V (not sure why). How did this circuit work before?

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.