Sunday, September 25, 2016

The light went out!

Alternative title (for those who don't remember Ralph Bashki's Wizards); "Hey! Who turned out the lights!" (One of the freakiest Doctor Who monsters ever!)

I tested the load sharing and charge circuit on my new board. The battery I had been using for testing was pretty badly drained and after waiting two hours it was a relief to see the "charge" light finally go out. Means the schotkey and MOSFET are doing their jobs correctly. Next up is install it in a holocron for a lighting test. Then write some quick-and-dirty code to test the user option buttons.

Taking a step back, this is a big change in how I do electronics. I was just window-shopping at Adafruit and I realized I don't see myself needing any protoboard soon. Or even a lot of hookup wire. I've pretty much moved over to PCBs.


This is actually the previous version, plus my first-ever surface mount PCB


To recap, this is the process of the Holocron circuit I'm testing now;

1) Drew up the schematic in EAGLE

2) Ordered parts, mostly from Digikey

3) Drafted the board in EAGLE

4) Sent the EAGLE files out to OSHpark, a board making company.

5) When all the mail had arrived, stuck the smaller parts on the board with a syringe of paste and then put the board into my T-962 to solder them all at one go.

6) After the board cooled, hand-soldered larger components like the USB jacks.

7) Attached my Adafruit USBtinyISP to the new board's header, and flashed the on-board CPU with the software I'd written in the Arduino IDE.

8) Test and install


The first disjunct from how I did things as a teen is although I still have a big parts box, I don't use it unless I've made a mistake or need to test something or are too impatient. For the most part, I spec out the exact components I need and find them through the parametric sorting system at Digikey.

Digikey is very friendly towards small orders, and has a huge catalog. What makes it navigable is their parametric system; the usual method is to drill down, specifying the most important values first and winnowing down the choices.

The next big change is going to printed circuit boards. There are a number of fab houses now that will do small prototype runs for cheap. So I do a lot less of assembling components on protoboard (although that still has its place). PCBs allow me to make a denser, more compact board, they offer much higher reliability, they are faster, and lastly, they are the only practical way to include surface-mount components.


Perfboard construction. Even protoboard is neater (and faster) than this!

EAGLE is the key tool here. There are other programs to draft PCBs. EAGLE has a hobby version that is essentially full-function (just restricted in board size and layer count). It also has a schematic editor, and the nifty thing is, board and schematic are automatically linked. So the software will ensure you route your copper traces to make exactly the same connections as are shown in the schematic.

There are software tools out there to simulate the circuit itself. I haven't used those yet. Schematic is helpful enough. The big trick with EAGLE is parts libraries. There are many libraries contributed by users (the big hobby vendors like Spark Fun and Adafruit have libraries for most of the parts they sell) but I'm afraid not all the footprints are trustworthy. So the trick with EAGLE is to slowly build up your own unique library of trusted parts, parts you have personally verified on a PCB you have made. Fortunately, the EAGLE editor is odd, but useable; I've several personally created parts that have now been tested in production.


Again this is the previous version. This is most of the layers turned on in the EAGLE display; top copper, bottom copper, silkscreen...

It is quite possible to hand-solder surface mount (some crazy people even hand-solder the seemingly impossible, like BGA components). Faster, neater, and more electrically sound results come from reflow soldering. Basically you put a specially formulated paste of microspheres of solder in a flux base on the board, plop the components on top, and then carefully bring it to a calculated temperature over a carefully timed interval so the solder melts, flows, and then hardens correctly.

The software-controlled infrared heat lamp of my T-962 reflow oven does this quite nicely (many people have improved their T-962's, many others have made their own out of toaster ovens and microcontrollers).


The hat is not essential to operation. A couple of fire bricks from my brazing days, however, are; it blows some pretty hot air out the bottom when in use.

And then I'm in the Arduino infrastructure. Arduino is basically a wrapper (you could even think of it as training wheels) around the AVR series of microcontrollers. I spent a while learning how to write straight C code and shove it into a "naked" AVR chip using avrdude, but the main thing that experimenting has left me with is an alternative to a working USB connection on my boards.

All I need is a six-pin header and I can plug in a USB adaptor I have. And after that, with some exceptions, I write Arduino-style code. The Arduino IDE is another piece of freeware. It is a bare-bones coding program, with essentially no advanced tools. But for the 8 KB of software I'm putting into a Holocron brain, it is enough. It's rather like the good old days of writing HTML pages in a text editor...


The main window of the Arduino code editor -- showing some very un-Arduino like code; these are direct register calls basically written in bog-standard C.

It took a few years to get all the pieces of this toolchain into place, but now I have it, doing electronics has largely moved for me from squinting at poorly-labeled parts, tacking them in place with random bits of colored wire and hoping, to a largely computer-aided process executed on the laptop.

Which is a lot like much of my props-making now. I'm making still-increasing use of laser cutting, which translates 2D CAD (actually, Illustrator -- and actually, I use the freeware Inkscape despite some ongoing file conversion woes) into precise cuts in the material. And 3d printing, naturellement.

No comments:

Post a Comment