kmod's blog

30Aug/130

3D printing update

No real project to tie these together, just a common tool/technology:

SainSmart filament review

A while ago I bought, and received, this SainSmart 1.75mm PLA filament.  Recently I've only been using my printrbot for making organization boxes; today I happened to need more, so I took this as a chance to test out the new filament.  It has 4.5 stars on Amazon, which is pretty good, though there's a common theme to the upset customers.  After using the filament I can see why: the filament has been printing fine so far (printed for a few hours), but the coloration leaves a lot to be desired.  It's hard to describe, but it feels cheap and plastic-y as opposed to the printrbot PLA I've been printing with which feels svelte and matte.  It's tough to tell from this photo, since the lighting is very different, but hopefully you can tell that the red filament is decently translucent, vs the black and pink objects on the table, or the white spoolholder.

Assortment of prints from different filaments

Assortment of prints from different filaments

Mechanically, and structurally, everything seems to be going great with it.  I've only tried it on one print, a hollow box, and the printer accepted it fine (which is saying something since I've been having issues with the printrbot filament), and the resulting boxes are sufficiently structural.  (Again, this is only after two hours of printing.)

Overall I'm definitely happy with the material, though I don't see myself using this color again.  I'm happy enough that I checked out their website, where they offer their filament at lower prices and with free shipping, so I might buy another spool at some point.

I also ran into this comparison of different PLA suppliers; the only component to the analysis was from a cost perspective, which is how I'm looking at the problem, but some commenters make the legitimate point that quality can be really hit-or-miss with these cheaper guys, and even though some suppliers are as much as 25% cheaper than other "cheap" options, buying a single bad spool can be hard to recoup.

Printrbot Simple upgrades

While I was browsing for filament, I went back to the Printrbot site since their filament seems quite good and they sell it at very low prices ($30/kg), though they are currently out of stock, except for pink.

Anyway, while I was on the site, I noticed that they are now selling a Simple Tower, an integrated carrying case + spool holder.  They're also selling a Simple Tower Tall variant, which works better if you buy the build volume upgrade.

Wait, the what upgrade?  They should have featured it more prominently (or emailed me about it): the small (4" cubed) build volume is my biggest complaint about the printrbot, and I'd love to extend it.  The upgrade costs $65, which feels a little steep given the base price, but I'm almost certainly going to buy it.  Plus I've stocked up on the M2 and M3 screws they like to use, so I should be able to assemble it faster :P

Current printing accuracy

Right now I'm very happy with most of the accuracy of my printrbot; I haven't gotten around to installing the endstops or fan upgrade, but I think if when I get the aforementioned build volume upgrade, I'm sure it will make sense to lump in the other upgrades at the same time.

The thing that I'm not happy about, though, is that right now parts are coming out too big.  The problem isn't that one of my axes is mis-calibrated; the motors move the right amounts, and the issue is that printing two parts that should fit together (such as a socket and a plug), they don't.  Also, if I put two parts close together but not touching, the print will usually end up with the two parts joined, which can be very difficult to fix for some more intricate models such as these captive planetary gear bearings.

At this point I'm not sure where the problem is; I don't think it's that I'm extruding too much material generally, since when creating solid layers I'll often get gaps between the fill lines, and even changing the "extrusion multiplier" down aggressively (0.75x), the rest of the print is clearly nonfunctional, but the close-together parts I was originally concerned about will still be conjoined.  At this point I think I need to start manually "slicing" some test patterns, such as laying out straight lines of plastic and measuring the width; hopefully this doesn't take to long to solve, because this problem is blocking me from building any mechanical parts.

Filed under: 3d printing No Comments
28Aug/130

Dropbox Hackweek, part 2: building a simple robot

I'm late in writing this post since Hackweek was a few weeks ago now, but better late than never I suppose.

As I mentioned in my previous hackweek post my goal was to use my new 3D-printer to build some parts for a simple robot.

Unfortunately, getting the 3d-printer working took four out of the five days of Hackweek, so there wasn't much time to get the robot going.  I was able to multi-task somewhat, since calibrating the printer involved many periods of waiting for test prints, so I was able to build a simple robot, though the "3d-printed" aspects were minimal.  Getting a basic working is surprisingly simple: get some simple DC motors, and apply a voltage across the terminals and they go!  These particular motors are small enough that they can be driven with a single LiPoly battery.

Using alligator clips to connect the battery and the motor is all fun and good, but eventually I wanted to control the motors from my ATmega.  I used a single L298N motor driver to drive two H-bridges, one per motor, which was surprisingly straightforward (I just built the "typical application" circuit from the datasheet).  For input, I used this joystick with the associated breakout board, and "mounted it" on a small breadboard as a simple control:

2013-08-09 00.38.47

I used one of my ATmega328 Arduino-like boards to read the analog readings from the joystick (which is just two potentiometers), and use those readings to implement a differential drive control on for the robot.  Here's another pic of the on-robot electronics:

2013-08-09 18.33.37

So electronically, this set up is extremely simple, and not very innovative; once I had all the parts, it probably only took a few hours to have the wheels turning.  Sidenote: maybe I'll write another post about this, but I'm learning that surprisingly, part-selection is where I spend most of the project's design time, since picking the parts involves knowing how they will all fit together, and verifying whether a part will work usually involves a relatively-complete idea of the design as a whole.

Base plate

It was definitely educational to get the motors turning, especially as controlled by a joystick, but the hard part of the project for me was building a chassis for all the parts.  There very first "chassis" I used consisted of just the three main parts (gearbox, breadboard, arduino) taped together, with no rear castor, so the breadboard was dragging along the floor.  I decided I wanted a baseplate to mount the gearbox + castor on, so I came up with this T-shape:
2013-08-08 22.30.24

Sorry this is the only picture I have; imagine that it's filled in and about 0.5cm tall.

What are those three squares, you say?  Well, my idea was to mount the gearbox using self-tapping screws, screwing them directly into the baseplate.  I've been printing most of my parts at low "infill density" -- ie while the part looks solid, the inside is only 20% full, to save on materials and printing time -- thus I was worried about whether there was enough material to actually screw into.  Ideally I'd be able to print those three screw-areas at 100% fill density, and while the 3d-printer is certainly capable of doing that, Slic3r, my slicing program (the program that takes 3d models and produces a series of line segments) didn't seem capable of it.

So instead, I decided to try creating these small square holes, and to create square "screw plugs" that would fit into them, with small caps on the bottom so that the base plate could rest on them (sorry for the lack of a picture).

This design worked, though there were enough issues that I'm not tempted to do it again.  Assembly became pretty complicated, since there was now an additional piece to hold in place while placing the screw.  The plugs added a bunch of play to the base plate, both in the XY plane, but also in the Z axis (I think this could have been avoided by making the plugs shorter than the hole).  In the future I think I'm going to try just using untapped holes, and use a nut+washer combination on the other side; I think this will be more reliable and not require separate parts.

Breadboard holder

The base plate let me attach the gearbox and the castor, and with some tape I was able to have a barely-structural robot.  It quickly became clear, though, that I needed something to hold the pcb above the gearbox, since it kept on sliding around and would eventually hit the wheels and the whole contraption would fall apart.  Here's the design I came up with; these are the three iterations of it, from earliest on the left to final on the right:

2013-08-09 17.46.28

The first design had several issues, the worst of which was that it was the wrong size, and secondly that it required a fair amount of support material.  The second iteration was the first that worked, but I realized that I wanted guard rails to hold the breadboard in place, which is the main change between v2 and v3.  You can see how it mounted on the baseplate:

2013-08-09 18.33.16

It had a fair amount of XY stability, but if I were to go back to it, I'd add a small piece on the bottom that would keep it attached to the baseplate, since right now it comes right off when pulled upwards.

Here's a video of it driving; this is before I created the breadboard holder, and you can tell it lacks structural integrity (though one could say it makes it up in spunk):

Overall, even though the 3d-printing aspect didn't turn out how I wanted, I found the experience of building a robot from scratch to be very rewarding, so stay tuned since there will be more robotics-related projects coming up :)

26Aug/130

Component area costs

I just blew out two ATmega328's, so while I wait for more to arrive I thought I'd post about something that's been on my mind.  I've been getting my PCB's made by OSH Park, an often-recommended source from which I've gotten great results so far, but the costs are starting to add up.  I've also tried Seeedstudio, but my OSH Park orders are coming in now under the $15 Seeedstudio minimum ($10 lowest-cost option + $5 shipping), plus OSH Park turns things around faster; Seeedstudio has some great larger options, such as $20 for 10cm x 10cm boards, and they're also great because they give you 10 copies back, but lately I've been sending all my orders to OSH Park.

When I first discovered OSH Park, I was pretty amazed by their $5/sq inch pricing: $5 isn't very much!  As I've been designing boards, though, I'm learning that neither is one square inch, at least if you're using through-hole components.  I recently had a foray into surface-mount components, where I was pretty happy with the size reduction from going to a partially-SMD design; the two boards in the picture are the exact same schematic, except with all the LEDs and passives replaced by surface mount components.  I wasn't even that aggressive about reducing the size: I stopped making changes once I hit the 5cm x 5cm Seeedstudio minimum (this was my test order with them).  This got me thinking, though: with such straightforward pricing from OSH Park, it should be possible to quantify the value of using smaller components.

Package costs

In order to quantify this value, I wanted to create a very simple measure of how "expensive" each package is; there are many aspects that contribute to the board size, but for these purposes I'm only considering the constraint that parts have to be non-overlapping.  I was pretty generous about saying how little space a package takes up, since that makes the conclusion even stronger: I assumed that you can and will place surface-mount components under every through-hole component, which reduces the effective cost of through-hole components.

I got the footprints from a variety of sources (mostly SparkFun libraries and the builtin "ref-packages"), though I tried to be consistent about using the same source for packages that would be directly compared to each other.  Again, these represent minimums and not "all-in" costs; they also assume that your boards are constrained by available board space, and not other factors such as handleability or edge connections.  Here are the approximate costs I calculated; all these prices are for an order of three boards, so the cost per board depends on how many of those three you expect to use:

  • Pin header: $0.05 per pin
    • 6-pin header: $0.30
    • 20-pin header: $1.00
  • DIP package (0.3" width): $0.07 per pin
    • 8-DIP costs $0.56
    • 14-DIP costs $0.98
    • 20-DIP costs $1.40
    • 28-DIP costs $1.96
  • SOIC: $0.02 per pin
    • 14-SOIC costs $0.28
  • SSOP: $0.01 per pin
    • 14-SSOP costs $0.14
  • 32-TQFP (0.8mm pitch): $0.40
  • 32-QFN (0.5mm pitch): $0.15
  • Through-hole resistor (1/4W, non-mini): $0.17
  • 5mm led: $0.24
  • 3mm led: $0.15
  • 1206: $0.035
  • 0805: $0.018
  • 0603: $0.012
  • 0402: $0.008
  • #4 standoff hole: $0.20

I was pretty surprised when I saw these numbers: using through-hole components is expensive!  It looks like the biggest gains are going from through-hole to any sort of surface-mount component, with diminishing gains from using smaller surface-mount packages.  For example, the 28-DIP ATmega328P, the chip on the Arduino and the microcontroller I've been using, costs upwards of $2 to place on the board, but you can cut this down to $0.40 if you use the 0.8mm-pitch TQFP version, and if you're aggressive you can cut it down to $0.15 by using the 0.5mm-pitch QFN package.  Same story goes for resistors: I measured the large-ish footprint I used on my Activity Monitor board to get the $0.17 number, but even a more conservatively-sized footprint costs way more than the resistors themselves!  Going down to 0805 cuts this by more than 5x, though there are limited gains to be had by going smaller than that.

One look at these numbers convinced my to never use through-hole components on my custom boards again -- in fact it seems like it can be cheaper to re-buy components in surface-mount packages than to order a larger board in order to reuse my existing components.

Testing down-scaling limits

I wanted to test how much I can cram parts together, and thus how cheap I can make the boards, so I created a new version of the Activity Monitor to test this.  The original version I made -- the one with all through-hole components -- cost me $21.50 for a set of three , an amount I was ok with since it was my first board.  I made this new version, however, much smaller by 1) taking out the standoff holes 2) using all surface-mount components 3) fully-using the back of the board 4) only using one header instead of the two redundant ones 5) putting components closer to the edge of the board 6) decreasing silkscreen sizes, and 7) using the full precision that OSH Park advertises (6-mil traces with 6-mil spacing, 13-mil drills).  Here's the board layout I came up with:

am_v1.2_brd

I'm not really sure if this will work out, but at $3.55 total for three boards, it was a no-brainer to go off and submit this to be made.

The thing I'm worried about the most is whether or not I can actually handle and manipulate a board that's only 1.1" x 0.65", but if all goes well, using surface-mount components means custom boards are even cheaper than I already thought they were.

Filed under: electronics No Comments
21Aug/130

Finishing the Activity Monitor

This is a followup to some of my earlier posts, where I take the design from this post, have it made by OSH Park as in this post, and finally now I talk about what I needed to do to fix it up and get it working.

Getting it working

Creating a custom circuit board is pretty far out of my comfort zone, so going into this project I was pretty worried that I'd produce a broken or useless circuit board.  I think I spent most of my time worrying about mistakes like connecting supply to ground or picking an under-voltage part that would catch fire once I plugged the circuit in.  Luckily, the issues were much more mundane, and I was able to produce a working board on my first ever attempt, which I think is a testament to the systematic-ness of the process, as well as the simplicity of the design I decided to make.

Dim LEDs

As I mentioned previously, the biggest issue I noticed is that the LEDs were quite dim.  I had worried about this when designing the circuit, since I went with an inverter part that can only drive about 5mA of current; since I wanted it to drive two LEDs, I limited each LED to about 2mA, well below their 20mA rating.  I tested whether this would work by running one of my LEDs at 1mA, and I found the brightness to be acceptable, so I went with the low-current inverter.  Unfortunately, I had tested with a 5mm LED instead of the 3mm ones I had swapped into the design, so my thought was that the 3mm LEDs must just have a lower brightness-per-mA rating than the 5mm ones.  I thought of two options: pick a different inverter part, or different LEDs.  I ended up ordering both, to have both options open for testing.

After doing some searching, I picked this new inverter, which offers 24mA current per output.  Now I just had to replace the inverter, as well as the LEDs' resistors; I was definitely appreciating that I had only soldered one out of the four lanes.  I've been pretty unsuccessful in the past with removing parts from a board using desoldering braid, so I had bought myself a $5 solder sucker and this was my first big chance to use it.  I have to say, once I figured out the technique to it, it worked amazingly well -- the trick was to put the soldering iron on the top of the board and the solder sucker on the bottom, so that the pump could create an almost-complete seal against the board, and almost fully clean out the hole.  There was some residue left, which I cleaned up with the desoldering braid, and after some finnicking they all eventually came out.

The result, though, was quite disappointing: the LED was still quite dim!  To isolate whether or not it was the LED or the driver, using some alligator clips I manually hooked 5V to before the resistor; in retrospect this was probably pretty dangerous since it could have blown out the inverter.  Luckily, it didn't, and since the LED was still dim, I tested another LED, saw that it was bright, and replaced the ones on the board.  After doing that, everything worked fine, so I soldered in the other three lanes, put on some standoffs, and had my first board!

2013-08-20 16.20.46

 

Stray capacitance

I spent a fair amount of time just playing with the board, since I found the behavior to be quite interesting when I didn't connect the inputs to anything.  The first thing I found is that the state that the inverter reads / pulls the inputs to when they're floating is a logical '0'; the interesting thing is what happens when I briefly connect an input to Vcc, then disconnect it:

The logic level goes high while connected, then reliably stays high for a second or two, then goes low again.  My interpretation of this is that there must be "stray capacitance" that affects these input pins, so I'm effectively charging a very small capacitor when I connect it to 5V, and it takes the inverter a few seconds to discharge this stored charge.  I was curious how much this capacitance is -- but once I started thinking about it, I wasn't sure if I would be able to actually measure the capacitance, first because the value is so small, and second because it probably depends on the input being connected to the inverter, so it's not clear if I can isolate it.

What I did was I connected an additional discrete capacitor between the input pin and ground, to see how much longer the "high" logic level persists.  I didn't bother using a stopwatch since I was just curious about the rough magnitude, but adding a 10pF capacitor (the smallest I have) seemed to increase the delay from about 2s to about 5s, so I'm going to say that the stray capacitance is on the order of a few pF.  I just checked the inverter's datasheet, which lists a typical input capacitance of 4.5pF; I'm not sure if this is the same capacitance as I'm measuring, but it seems to make sense both logically and since the capacitance values line up.

Touch sensitivity

The next thing that surprised me is that when left disconnected, the input pins are actually sensitive enough that they can detect when I touch them with my finger!

I guess that with a 5pF capacitance, the slightest voltage fluctuation is enough to cause the inverter to switch states.  I thought it was pretty cool that it's so easy to create a touch-sensitive device that you can do it accidentally, but I'm not sure that this particular effect is practical, since there were many other (less-interesting) thing I did that also triggered the circuit, such as bending the power supply leads.

Seeedstudio Fusion boards

Shortly after I had sent out the PCB order to OSH Park, which is where the boards in the above photos+videos are from, I submitted a slightly-modified design to Seeedstudio.  I found their 10-boards-for-$10 option to be quite appealing, and I wanted to test it out and compare the resulting boards.  The only problem was that the $10 option has a 5cm x 5cm limit, and my original board was slightly too large (42mm x 65mm).  It's possible that I could have shrunk the board my being more aggressive about placing components next to each other, but I thought that this would be a good opportunity to experiment with surface-mount components, since I this order was already experimental in nature.

Seeedstudio fabricated the boards much more quickly than OSH park (a few days vs over a week), but since they're based in China, the shipping was much slower, and the overall turnaround time ended up being 3 weeks vs 2 weeks for OSH Park.  Here's a picture of what I got back:

2013-08-21 02.45.04

The picture is warped because I had to use a magnifying glass to get any decent detail.

 

You can see that I've very-professionally labeled the board with the revision number and date :P  I didn't examine the boards too closely, but they overall seem well-made, though I didn't go anywhere close to their specified minimum tolerances.  I'm not super happy with some of the silkscreen; in particular I found it very hard to tell which way I should put the LEDs.  To be fair, I had this same exact issue with the OSH Park boards, despite the LEDs there being much larger, so I think it might be an issue with the Eagle parts I'm using; it should be a good test to modify the silkscreen on them.

It was pretty cool to see all the surface-mount (smd) pads on my own board, and since I've been doing a bunch of reading about soldering smd components, I felt fairly good about my prospects.

Starting the job

I immediately ran into some issues assembling this board: first, I tried to show my girlfriend just how small a 0603 component is, and in the process I lost the first of many resistors.  The second is that smd components have a completely different set of markings on them; this is ok for the resistors, since I'm keeping them in their labeled bags, but was a hurdle for the leds and capacitors since I wasn't sure how to read the polarity on them.  I started the assembly by soldering the power LED and its resistor; doing an electrical test made everything look in the clear, but I connected the power and the LED didn't turn on.  Using my multimeter again, I discovered that I had placed the LED backwards, and also that the "diode" mode on my multimeter will actually drive enough current to light the LED dimly.

So, I removed the LED and tried to put it on in the other direction.  I was having a lot more trouble putting it on the second time, which I had expected, but eventually I had to just give up.  I took a closer look, and I had actually ripped off one of the pads without even noticing it!  Thankfully the LED and its resistor are right next to each other, so I simply created a solder bridge between the two, which solved the problem.

Rest of the assembly

Thankfully, this board only uses a small number of different types+values of components, so the soldering was pretty straightforward, if a little painstaking.  Unfortunately, I had placed the capacitors backwards -- I dislike that the stripe is on the positive side, rather than the negative side like electrolytic capacitors.  So I had to remove+resolder four capacitors.  I'd already done this once, so it wasn't completely new to me, so I went ahead and started doing it... and immediately ripped off the pad from one of the capacitors.  I realized that I ripped it off because the capacitor was still soldered to the pad when I tried to remove it; from removing through-hole components, I'm used to having to tug a fair bit to get the component out, but this was definitely the wrong way to think about the surface-mount ones.  Once I realized this I had better success with the last three capacitors, only ripping off one of the pads, and only barely.  Here's a close-up of some of my touch-up work:

2013-08-21 02.14.49

I connected it all up, and thankfully it all works, except for the fact that I ran out of diodes.  Here's a comparison of the sizes of the two boards; I'm pretty happy with the size reduction, but I think that I can be much more aggressive about packing the components together.

2013-08-20 23.21.30

 

Thoughts on surface-mount soldering

This board definitely tested my soldering skills -- incidentally, people actually do sell soldering practice kits, but my version costed less and is actually useful at the end.  I only used 1206 capacitors, which I found to be quite easy to handle (though I had to get used to removing them), and 0603 resistors+LEDs, which definitely were tough but I felt like it was only about as tough as I felt my first few through-hole boards were at the time.  I can definitely imagine it's possible to get to the point that I feel comfortable soldering 0603 components, which is good because I have a board coming in soon that uses 0402 capacitors.

It definitely took me a lot longer to assemble the surface-mount version of this board than the through-hole one, but I think that that's largely a function of it being my first time doing surface-mount soldering; given the cost savings, both from the components but more significantly from the reduced PCB costs, I can see myself making all my boards surface-mount from now on.

Filed under: electronics No Comments
14Aug/131

Myduino: creating a low-cost arduino substitute

One issue I've quickly run into is that I want to embark on new projects, but don't want to completely disassemble my existing projects in order to get the parts I need.  For some parts of the project, like resistors and wire, it's pretty easy to over-buy those and not need to scavenge old projects for them.  For other things like breadboards, it's less easy, but at $5 a breadboard, I don't mind over-buying these as well.

The most expensive common component I have, though, is the Arduino-like microcontroller board that I use as the project base.  A real Arduino will run you about $22 on Amazon; there may be cheaper options out there, especially if you're willing to buy older versions, but this is the cheapest retail one I've seen so far (usually they're about $30).  These things are highly versatile and I wouldn't mind having a couple extras of them, but they're expensive enough that I'm not quite ok saying that I'm going to buy one per project I'm working on.

One very simple option is to simply disconnect the wires from the Arduino when I want to move it to another project, and reconnect the wires when I want to get a project running again.  I actually did this for a while, but this quickly became unmanageable, since I was having to remember exactly where all the different wires go.

Another option I've tried is to use the shield interface as a glorified connector, so that reconnecting the Arduino is just a matter of reattaching the shield:

Beginnings of a programmer project (bottom), hooked to a detachable arduino shield (left).

Beginnings of a programmer project (bottom), hooked to a detachable Arduino shield (left).

I'm using the SparkFun ProtoShield PCB ($5) with a set of Arduino stackable headers ($1.50), to give me a "connector" which is easy to snap onto Arduinos.  This system has served me fairly well, but at $6.50 a shield, I feel like I don't deserve to be swapping these out all the time.

So going back to my original thought, it'd be nice to be able to leave a microcontroller board connected to each project, but to not have it cost $22.  I looked around for some lower-cost Arduino variants, but pretty quickly I decided to build my own instead.

Enter the Myduino

Fortunately, with the popularity of the Arduino, there are many published schematics for Arduino-like microcontroller boards.  I've built my existing boards off of The Shrimp schematics, so I used that again as a base for this new board.  There are a couple ways I had to modify it, though, for its new purpose: first, I need an interface for connecting from the computer to the board in order to program it.  I decided to use the SparkFun "FTDI Connector"; I'm not sure how much of a standard this is, but they have it in their Eagle library and it has exactly the pins I wanted, so I decided to go with it (plus I can buy that cable if I want to).

The second decision is how I want to connect from the board to the rest of the project.  I decided to stick with the theme of using female headers, but instead of having four separate headers, I decided to have a single 2-row header, to reduce space.

The last decision is what to call it.  I've never felt great at naming things, so I decided to not put too much effort into it and just call it the Myduino :P

Here's the schematic I came up with:

myduino_v1_sch

There's not a whole lot going on here that isn't common to all ATmega328-based boards, so I'm hoping I didn't mess it up.  One thing I've realized in the course of writing this blog post is that I forgot to bring out GND and VCC to the header on the right, so I'm thinking I'll solder some extra loose wires to some of the exposed pads.

The thing that's probably more interesting is the board layout.  As I mentioned, one of the primary drivers for this project is to create a low-cost alternative, so my primary goal for the board design was to reduce the board size, since the board cost is directly proportional to its size.  So, the board is quite small (1.7"x1.35" to be exact); you can get a sense of proportions by noticing that that's a 28-DIP ATmega328 in the middle.  Here's what I came up with:

myduino_v1_brd

 

Note -- all the grey  writing (not the white) is stuff that doesn't appear in the final board construction; I probably should have turned it off entirely.  Also, there is a ground plane on the back (blue) side, but I usually turn that off for visualization to keep things cleaner.

This board is quite a bit more aggressive in its design than my first board, in a couple different ways.  First of all, I used surface-mount components (only simple two-terminal ones), which I've never used before.  Second, I actually put some of those components on the bottom of the board to explore the limits of doing that: I feel like I probably can put whatever components I want on either side, including through-hole ones, but I wanted to start first with just the decoupling capacitors, which are generally held to be easy to put on the bottom.

Third, I reduced the pad sizes on the header on the bottom.  The header has a pin spacing of 0.1", and the SparkFun library where I got this from has the pads have a 0.075" diameter, giving a 25-mil spacing between the pads.  I very much wanted to route the traces between the pads, but I also want to be using 10-mil traces with 10-mil spacing, which won't fit.  I had two options: decreasing to 8-mil traces with 8-mil spacing, or decreasing the size of the pads.  Decreasing the trace size probably was the "right" choice, since OSH Park can do 6-mil traces with 6-mil spacing, but I'm feeling confident in my soldering and I wanted to test pad-size limits too.

Fourth, I used a ground plane, since that seems like a good thing to do.

Lastly, I did all the routing on this board by hand.  Part of the reason for why is because when I first tried auto-routing it, I used the wrong settings (50-mil grid width) which made the autorouter totally unable to route the board.  In retrospect, though, I'm pretty happy that I did the routing manually, even though I re-ran the autorouter with better settings and it was able to do it.

I submitted the order to OSH Park for a total cost of $11.45, and I should be getting it back in a few weeks.  There are a couple changes that I'm thinking about making, but I'm trying to hold off until I get the boards back to submit a new rev.

Cost

So, did I succeed in making this cheap enough?  Here's the bill of materials; except where noted, all prices are from DigiKey and don't include any bulk discounts:

Which comes out to $10.33, not including DigiKey shipping (starts around $3).  I'm actually pretty surprised by this; I thought it would be cheaper, since the board is so minimal.  I guess I didn't expect the headers to be so expensive.  I can think of a number of ways to cut costs if I wanted to:

  • Use seeedstudio to bring the PCB cost down to $1.52 ($9.90 + $5.30 shipping, for 10 boards), though I haven't received my test boards from them yet.
  • Use a cheaper ATmega part, for instance this one looks pin-compatible and is $0.80 cheaper
  • Redesign the board to not bring all 20 pins out separately to the header.  I rarely use more than 8 of the pins on the Arduino, so one possibility is to have a 10-pin header with two of the ATmega pins connected to each header pin, letting you drive the header from either pin.
  • Use male headers instead of female ones.  This might actually make a lot of sense for breadboarded projects, since the male header could be inserted directly into the breadboard.
  • Buy in bulk; this is particularly true of the $0.10 capacitors, which decrease in cost to $0.024 if you buy at least 10 of them.

Overall, right now I'm not dying to implement any of these (except maybe the buying-in-bulk part), since this is cost competitive with the $6.50 "shield connector" option, and will hopefully be way easier to use.  Now I just have to wait for the boards to arrive, and figure out a plan for the meantime since I still have projects I want to do.

 

11Aug/130

Dropbox Hackweek: 3D Printing

One of the many perks of working at Dropbox is getting to participate in Hackweek, a weeklong hackathon for everyone in the company.  In the past I've worked on an AI project to predict user file accesses (fun but unsuccessful), a Python type analyzer and then a Python compiler built on top of the type analyzer (will be open sourced at some point), and a service-management service (in limited use inside Dropbox).  I wasn't sure what I was going to do for this one, but last week I happened to be looking into 3D printers, bought one on a whim (yes, they are cheap enough now to do that), and it arrived on Monday the start of Hackweek, so of course I had to do something with it.

Low-cost 3D Printers

There are a tremendous number of low-cost 3D printers these days; I don't remember how I started looking into them, but I think I was reading some article about how much the prices have dropped, was intrigued, and started doing some research.  This page is a good overview of the lowest-cost printers out there; one option that I had to quickly rule out is any printer that required me to print parts for it.  This sounds like one possible way to obtain a second 3D printer, but it seems like it would only add to the difficulty of getting a 3D printer to work, plus there are some obvious bootstrapping issues.  So I decided to only look into complete kits or products, which thankfully are quite well-represented even at this low of the spectrum.   One option that caught my eye was the Makibox A6, which retails for $200, easily in the "for the hell of it" category.  I managed to talk myself through the fact that the product is unreleased and it's from a new company, but what finally turned me off was that shipping is $36 for 6-8 week (!!) delivery, or $100 (!!) for 7-10 day shipping (this is from Hong Kong).  The prospect of $100 of shipping charges seriously bit into the allure of a $200 printer, so I kept on looking.

There's another similar product called Pirate 3D Buccaneer which seems appealing as well, but seems to suffer from some of the same issues as the Makibox, primarily that it's not released yet and it's a new company.  I decided to pass on this one too.

Then I looked into the $300 Printrbot Simple.  This particular model is quite recent and doesn't have that many reviews, but it's by a company that has released several other models in the past with what seem like generally-positive feedback.  The product page made no mention of any waiting for it to be available, so I went ahead and bought it along with some extra filament, for a total of $350.  Based on the other options at this price-point, I expected this to be another Chinese company with long turnaround and shipping times, but to my surprise they're actually US-based, shipped my printer out the same week, and I received it exactly one week later.

Assembling the Printr

Here's a picture of the half-assembled printer -- for some reason, I never take a picture at the beginning of a project, only once it's already in progress -- with about half the parts on the desk, the other half still in the box:

Half-assembled Printrbot Simple

Half-assembled Printrbot Simple

This was definitely the most difficult thing that I've ever assembled, but thankfully the instructions were pretty good, and overall the whole thing made a lot of sense, but just required a lot of work to put together.  You can definitely see what the difference is in buying a $300 printer vs a more expensive one: one of the primary construction tools here is the zip tie, and I'm talking about in a structural context!  In the middle of the above photo, you can see how the linear bearings are held to the square board via zipties; at first I was turned off by this, but it actually works quite well.  Overall I'd say I'm pretty impressed by the quality of the components, and the resulting printer definitely feels a lot sturdier than I thought it would.  The only thing that was pretty annoying is that they shipped me the wrong set of screws; Printrbot was very nice when I mentioned this to them and shipped me the ones I'm missing, but I wanted to get this thing assembled so I ran out to a hardware store and bought the missing screws.  They were pretty cheap, but I ended up taking a taxi to the store and this added to the effective printer cost; I took this as a call to stock some standard screw sizes myself.

I'm not going to go into build instructions since the Printrbot site does quite a good job with them, but the one thing I'll mention is that if you're thinking of getting a Printrbot Simple (which I would recommend after my experiences with them), one thing you should keep in mind is that the two upgrades they ship you (fan upgrade and endstop upgrade) are best installed while assembling the printer, since they replace existing components and require access that you won't have once the Printrbot is assembled.

Here's a pic of the finished printer:

2013-08-06 00.12.13

Assembled Printrbot Simple

All told, it was maybe about 6-8 hours from starting on the assembly to finishing it, though this included things like dinner and going to the hardware store.

 Calibration

There's a lot already written on this subject, so I'm not going to write too much about it.  Suffice it to say, though, that calibrating the Printrbot Simple is not just important, it's necessary to get prints of any quality.  In the above pic you can see the results of my early "prints", which are supposed to be cubes but are mostly just blobs.  Here's a close-up:

2013-08-06 00.12.29

Some early "prints"

I forget exactly what I had to do, but I'd say the most important things are to level the printbed, make sure you have your z-endstop installed and working (I originally didn't install it since I didn't have the screws to, but I was forced to jury-rig something to get the printer working), and calibrate the extrusion amount.  ie the printing program will assume that when it says to extrude 1mm of 1.75mm filament, you'll get exactly 1mm*pi*(1.75mm)^2 filament out.  My printer actually spooled out closer to 1.05mm of filament, so I had to adjust the extrusion multiplier to 0.95 to not have shapeless blobs at the end.  I did this in my slic3r settings, but it would have been better to update the printer's firmware settings, though I didn't know how to do that at the time.

After doing all this, I could reliably produce recognizable prints:

My first non-calibration prints

My first non-calibration prints

If you look very carefully, though, you can see that even though the cylinder is quite vertical, the smiley face has some severe slanting going on:
2013-08-06 02.06.13

This was a problem that took me a long time to solve; some prints look fine:

2013-08-06 16.50.45

But most came out terribly:

2013-08-07 12.27.16

It took me three full days of trying every single suggestion the internet had to offer; I tried tightening and loosing everything, I changed the firmware values and eventually started recompiling the firmware myself, I learned gcode so I could send manually-constructed test patterns to narrow down the issue, and many more things that I don't remember.  One of the most informative tests I ran, which I wish I had thought of earlier, was to flip the y-axis stepper motor cable (the y-axis is the one with all the slanting), and print everything in reverse.  Once I saw that this produced prints slanted in the same direction, ie the slant didn't flip as well, I concluded that the problem was mechanical and not electrical or in the firmware/software.

The thing that ended up fixing the issue was replacing the nylon string that was provided with some fishing line I was able to scrounge up (the instructions actually call for fishing line but I was shipped the string [Update: apparently there is something called "braided fishing line" which I didn't know about; I switched to the more-familiar "monofilament" fishing line]).  I'm not 100% sure exactly what was happening, but I assume that there was some sort of slipping occurring and the finishing line simply didn't incur that.  It was a pretty simple fix, but came just as I was about to give up after investing 40+ hours in fixing the issue; on the bright side, at the end I had a very good understanding of how my printer works, and how 3d printing works in general.

There's still a lot more I can do to calibrate the printer, but at this point I'm quite happy with the results; they're actually better than I was expecting from such a low-cost printer.  Here are some pictures from things I've printed; most of them were on pretty low quality settings and without solid layers:

2013-08-08 19.38.24 2013-08-08 23.21.03 2013-08-09 17.46.28 2013-08-11 01.49.32

Overall, I'm very happy with the Printrbot Simple.  I was worried that with a cheap printer I'd get sub-par print results, but in my experience the main limiting factor is that the printbed size is relatively small (100mm cubed, or about 4" on a side).  I was worried that a cheap printer would be nearly unusable and that you really do need to spend $1k+ and get a "nice" one, but I think my experience is a evidence that 3D printing really is accessible to people who've never done it before, and even at low-cost if you're willing to invest time.  My personal take is that 3d printing is in enough of its infancy that I think you need to be willing to invest a significant amount of time regardless of how fancy the printer is you buy, which partially negates the biggest selling point of the more expensive printers.  For example, you have to have a good understanding of how the printing process works in order to know what kinds of structures you can build and what the limitations will be, or how and when you can reduce the quality (and thus increase the speed).

Where to go from here

One of my primary interests in buying the printer was to build functional and/or structural parts; it's been cool to print out sculptures that I've found online (see the pug figurine above), but I don't see that as being much more than a novelty since I won't be designing them myself.  In general, I'm intrigued by the idea of being able to produce physical parts; I know this is possible using more conventional methods, but I never got into woodworking or machining, so this is another whole new world that's been opened for me.

In the third photo above, you can see some structural pieces, which are part of the robot chassis that I'll talk about in a future blog post :)

Filed under: 3d printing No Comments
10Aug/131

Making custom PCBs

If you look at my recent posts, the pattern that I think emerges is that I'm learning that technologies and disciplines that previously seemed inaccessible, are in fact most definitely accessible.  For instance, I assumed that since FPGAs aren't something you see very often, using them must be a magical process with a high barrier to entry, requiring lengthy instruction from people who already know what they're doing.  Instead, as long as you're willing to invest about $200 and a bunch of time, the tools are free and getting basic things working is straightforward.  Similarly for microcontrollers: even without platforms like the Arduino to bring the barrier down even lower, getting a basic microcontroller breadboard working is just a matter of reading a schematic and following instructions.

This is a post about another area that I thought was off-limits to mere mortals: custom PCB design and production.  In middle school I got to etch my own circuit board, but the end result was a trivial "who pressed the button first" board.  That experience was definitely cool, but I think it might have left me with an even greater perception of the inaccessibility of PCB fabrication.

Low-cost PCB options

But then someone pointed me to OSH Park, a "community printed circuit board" site.  Similar to Multi-Wafer Fabrication, a low cost ASIC production method that I talked about in a previous post, this sort of panelized pcb construction aims to reduce fixed costs for small PCB orders by batching a number of them into a larger order, which is then submitted to a PCB fab house for actual production.  I don't know how much a dedicated PCB run costs, but OSH Park's pricing structure certainly goes way lower: you pay $5 per square inch, and get three copies of your board.  I tested their site and they don't have a minimum size; I submitted a tiny board and got a quote back for a total cost of $1.85, including shipping!  This is in contrast to other "low cost" pcb places that charge hundreds of dollars minimum for any order, though the unit price after the upfront cost is way lower.  I decided to check out a bunch of other sites as well; I was looking for 2-layer options (most of these places offer 4-layer as well at increased cost), and my main criteria were price and turnaround time.  Here are the most promising options I found:

  • OSH Park is one name that kept on coming up in recommendations, so often that I now use it as the benchmark against which to compare other sites.  (Many people recommend Batch PCB, which was acquired by OSH Park, and I assume that the recommendations transfer.)  As I mentioned, they have a flat $5/in^2 pricing model for a 2-layer board, and have special "medium run" pricing if your board is 150in^2 or more (I'm not sure if this also applies if you submit multiple orders totaling more than 150in^2).  As for speed, I submitted a design on 7/30, paid $5 for Priority Mail shipping, and received the boards today, 8/9.
  • ExpressPCB seems to be the best "fast" option: as opposed to the 7 business-day turnaround (time from design-submission to shipped to me) I got from OSH Park, ExpressPCB advertises as low as a 1-day turn.  There are other places that even offer same-day turnarounds, but ExpressPCB was unique in the price point they offered: their lowest offering is $51+shipping, when I couldn't find another place that offered 1-day turns for any less than $500!  There are a number of constraints on this particular offering though, such as not getting any soldermask or silkscreen layers, and also only being offered at a 3.8"x2.5" size.  That said, these seem like overcome-able obstacles if I want a board fast.  They also offer more traditional offerings, such as $166+shipping for a 2-day turn on anything less than 21in^2, which is quite competitive with OSH Park if you use the full size: you pay 75% more to get it 2-3x faster.
  • Gold Phoenix: I can't quite reverse-engineer their pricing function, but it seems to be $1 per square inch, with a $100 minimum.  In contrast to OSH Park and ExpressPCB, where you get a fixed 3 or 4 copies of your board for the price they quote you, the Gold Phoenix $1/in^2 price is per board, with no minimum number of boards (except for the $100 minimum).  This could be great for me, since I typically just want a single copy of a board I'm working on, and have to pay for the additional copies from OSH Park regardless.  For instance, buying a single copy of a 100in^2 board would cost $100 at Gold Phoenix, and getting it made at OSH Park would cost $500, though you'd get three copies.  Realistically, you'd probably want to get multiple copies of your board, especially since I've seen some reports that Gold Phoenix can sometimes mess up boards (though that seems to be the case with any of these low-cost options), but even if you compare getting two 50in^2 boards from Gold Phoenix for $100 vs getting 3 of them from OSH park for $250, it seems like a good deal.  The $100 minimum is pretty low compared to more traditional PCB houses, but it's still way higher than the $0 minimum at OSH Park, so I'm not sure when I'll try them.

I haven't tried ExpressPCB or Gold Phoenix so I can't actually evaluate them, but based on their features and pricing, and with some basic due diligence google searching, these three places seem like the best options, at least at face value.  OSH Park seems like a good all-around place, with bonus points for having a very good reputation; ExpressPCB seems like a good choice if you're willing to pay for faster turnaround, and Gold Phoenix seems like something interesting to try if your order would be more than $100 on OSH Park.

There are a bunch of other pcb manufacturers as well; one of the most common types is what I affectionately call the "cheapo chinese" options, since I've found a multitude of chinese sites that offer the same suspiciously-cheap service: 10 5x5cm (roughly 4in^2) boards for $9.90.  I'm actually very curious how it works behind the scenes, since there are so many places that offer that exact service at that exact price point.  The price seems very good, and gets even better if you look into their larger offerings, such as this site that offers 10 20x20cm (~62in^2) boards for $85.  I'm not sure what the catch is, but the price is low enough to justify trying out, so I submitted an order to what seemed like one of the most reputable of these services, SeeedStudio Fusion.  Shipping starts at $5.30 for their "0-30 day" shipping option, but they offer a bunch of other cheap electronics components, and you can bundle them into a single order to amortize the shipping cost.

PCB Design and Fabrication

After I had done my research and learned about the PCB manufacturing options, the inevitable next step is to design my own board and have it made.  I searched around for something I wanted to make into a board, and I settled on my edge detector circuit.  My thinking is that it'd be nice to have a simple logic analyzer that I can use to debug interfaces between components, and I decided to build a simple "activity monitor" (not calling it a logic analyzer since it's nowhere near that level) that shows both the logic level and edge detection for a couple separate signals.  I decided to make it follow the PMOD pin interface, so that I can connect it directly to the pmod ports on my Nexys 3.

The first step is to design a schematic for what I want to build; I decided to do this in Eagle since it seems to be the most talked-about option.  In retrospect, this process was fairly simple, except for the fact that I had to learn Eagle.  SparkFun was a tremendously helpful source: this tutorial walks you through creating a simple Eagle schematic, but maybe more importantly links to their Eagle parts library, which contains a huge number of parts in it, and was especially helpful since I've been ordering from them.

The schematic ended up being pretty simple: I decided to use the hex inverter I got, but otherwise the schematic is the same as the single-signal version from my earlier post:

activity_monitor_sch

The next step was the daunting one: converting this into a board layout.  The actual process was quite simple, though it involved a bunch of research to figure out: simply place all the components, and the route the "airwires".  Airwires are the board-level representation of unrouted signal connections, and having none of them represents having fully routed your board.  I'm sure there's far more sophistication to be learned here, but the high-level process ended up being remarkably simple, especially since in my case this board is simple enough to route that the autorouter was able to do it.  It was actually pretty fun to mess with the component placement to try to make the routing more feasible; for instance, I originally had the 'A' resistors and 'A' LEDs swapped, with the resistors connected to Vcc, but I noticed that by swapping them, the wires wouldn't have to criss-cross the board as much.  It was a pretty cool exercise, and this is what I ended up with:

activity_monitor_brd

I submitted this to OSH Park, and they helpfully gave me back this representation of what they were going to make:

i

It all looked good, so I hit submit.

Receiving the PCB

This was about two weeks ago, and the PCBs just arrived in the mail today.  They feel a bit smaller than I would have thought, but there's something undeniably cool about holding something this precisely-crafted in your hand, and knowing that you designed it.

2013-08-09 19.35.38

 

I probably should have done a simple multimeter connectedness test on the boards, but I was impatient so I immediately soldered one of them.  There were a few things I learned in the process:

  • My resistors and capacitors don't exactly fit the slots, but are close enough
  • My diodes have extra-thick leads and barely fit through the holes for them
  • The order in which you solder things matters
  • The silkscreen for the LEDs got cut off and I had to inspect the circuit to see which way they should go
  • I designed the board for 3mm LEDs but tested on brighter 5mm LEDs, and furthermore forgot to actually order any 3mm LEDs

Here's a picture of the partially-soldered PCB next to the breadboard I prototyped on:

2013-08-10 02.53.23

The PCB is definitely what I was hoping for in terms of compactness and robustness, but does it work?  I plugged in the ground and power lines, and both the level and activity LEDs lit up.  There were two problems: the first was that I didn't expect them to light up, and the second was that they were both very dim.  My theory is that the first problem, that the activity led was lit, is due to the fact that I left the inverter inputs floating, leading to an indeterminate output state which would oscillate between high and low.  I'm tempted to add a large pull-down resistor to keep the values stable, though the point of the inverter was to handle the decoupling itself; I guess this is what the 1Mohm resistors in my kit might be for.

The dimness seems to be caused by my bad assumption that at a given current, the 5mm and 3mm LEDs I have would be equally bright.  You can see what the 5mm LED looks like in the above photo (the red one on the left), which is running on about 1mA. and clearly visible  Unfortunately, the 3mm LEDs in the same configuration are much dimmer; I'm not sure how much I can reduce the current-limiting resistors I'm using, since the inverter only advertises being able to source/sink 4mA per output.

The silver lining on not having any more 3mm LEDs is that I can pick the ones I buy to be brighter; perfecting the circuit wasn't the focus of this particular part of the project, though, so I'll get back to that later.

So yes, the PCB works, though with some minor component issues, and overall I'm very happy with the $26 I spent to get these made, and now feel like a whole new level of circuit complexity is opened up to me.

Filed under: electronics 1 Comment
10Aug/130

Improved blog speed by serving smaller images

Unbeknownst to me, I've been serving everyone full-sized images from my blog.  I didn't really notice this because I visit my blog often enough that my browser caches them and they seem to load instantly, but once I moved to a new computer I noticed how slow everything was.

The issue was that my server wasn't generating thumbnails, so I only had the option of inserting the full-size images; since I'm new to wordpress, I assumed that this was just how it worked.  It turns out that I was lacking the "php-gd" module, which meant that wordpress wasn't able to generate the thumbnails, and it didn't provide me the option to embed them instead of the full image.  I found this out from this answer.  The steps to fix it were pretty simple; for Ubuntu:

sudo apt-get install php5-gd
sudo apache2ctl restart

The next issue is that all my previous posts still have full-sized images in them.  Generating thumbnails for all of them is pretty standard; I used this plugin and it took just a few seconds.  One weird thing about installing the plugin was that I had the ownership on my /var/www folder set to root:root (was careless during the server upgrade I guess), and instead of giving me a useful error message, wordpress asked me for FTP credentials!  I suppose this might normally be the right thing to do, since it's far more standard for people to run wordpress in a shared environment where there's ftp but no other filesystem access, but it was confusing that it wasn't even noted.

Anyway, I got the plugin installed and generated all my thumbnails.  I spent 10 or so minutes googling around trying to figure out how to replace the images, and while I found any number of references on how to change existing thumbnail sizes, it doesn't seem possible to batch-replace images with a different size class.  I thought about going directly to the MySQL database and changing the embedded image URLs, but the name of the resized image is based on the resulting dimensions, which makes some sense but unfortunately makes it hard to batch-replace all images with the medium versions.  At this point I decided to give up and replace all the images by hand, since I've spent as much time already trying to figure out how not to do that as it would take to just bite the bullet and do it.

While I work on that, here's a teaser image of an upcoming post -- and correctly sized, I should add :)
2013-08-09 19.35.38

 

Filed under: hosting No Comments
2Aug/130

New parts!

I just got my orders SparkFun and DigiKey, and now I have a bunch of new toys to play with:

And a bunch more.  To add to the fun, a friend lent me their $600 Metcal soldering station since they weren't using it; I don't have enough soldering experience to really evaluate the differences, but I can only assume that this is a big step up from my $11 RadioShack kit.

Inverter

First up was to replace my discrete-MOSFET inverter with the dedicated inverter part.  This part is quite nice actually: it can take any supply voltage between 2V and 6V, so I don't have to worry about stepping it up/down for use in 3.3V or 5V circuits.  I set it up in a simple configuration, with a red LED for logic high/low, and a yellow one for an edge detector, and used a potentiometer to generate an adjustable voltage [the edge-detector is missing in this photo]:

2013-08-01 15.07.18

Everything pretty much worked as expected: if I turn up the input voltage, the first (level-detector) led turns on, and if I turn it down, the first one turns on and the second one (edge-detector) briefly flashes.  For fun, I decided to check out the inverter's transition from low-to-high: it turns out that it does this reliably across a very narrow voltage band, much narrower than 1.35-3.15V range that they allow themselves in the datasheet.  Interestingly, I could pick a voltage that was right at the edge, which is what's going on in the above photograph.

As you might expect, in this case the indicator led is at an intermediate brightness.  The surprising thing, at least to me, is that the edge-detecting led is also on [sorry for not having the photo for this]!  This made me doubt my design, but after looking at it again I don't think there's any way for a DC current to sneak through there in a way I didn't anticipate.  The only alternative I could think of is that there must be some oscillating going on.  Unfortunately, I didn't have the tools to directly measure this, but luckily I had just received:

DIY Oscilloscope

The only tool I know of to debug this kind of issue, and presumably the most common, is the oscilloscope.  Looking on amazon, it looks like decent oscilloscopes start around $300 and up, which is a bit out of my budget.  Instead, I went with this kit from SparkFun (originally made by jyetech.com), since it's only $60, and also I wanted the soldering practice -- they list it as "on the higher end of difficulty as far as through-hole kits go", so I figured it'd be a good way to benchmark my soldering skills.  Getting this kit working is another story, but suffice it to say that after a few hours of soldering and re-checking my joints, I eventually had it up and running.

Unfortunately my phone couldn't take a good picture of the results so there aren't pictures for this section, but I immediately hooked the completed scope up to the inverter circuit above to see what was going on.  Well, actually first I had to jury-rig my setup a bit, since I only have one 9V wall wart, and the oscilloscope takes one for power, so I had to run everything else off the power from my USB breakout board.

Anyway, once I got it working, the result was pretty obvious: the circuit had very noticeable oscillations with period of about 16ms, for a frequency of about 60Hz, which nicely explains what's going on: the oscillations I'm seeing are from power supply ripples from the mains 60Hz frequency.  Unfortunately, I won't be able to able to debug my own power management circuit until I have two separate wall warts, since I can't run both my power supply and the oscilloscope at the same time, but hooking the oscilloscope leads to the USB power lines showed that the USB power was actually pretty good, less than +-100mV (the scopes finest resolution).  Unfortunately, I don't think the scope has very good power isolation, since if I don't connect the leads to anything, the display shows me a 60Hz wave, which I assume must be from coupling internal to the scope.  So to really test this, I'd either need a oscilloscope that I trust to not have power supply ripples, or somehow connect the scope to a different power supply, such as a battery.

So anyway, nothing truly revolutionary, but it's cool how much you can discover yourself with only some modest equipment.

Filed under: electronics No Comments