The Pixhawk-CHDK trigger is coming along nicely. The prototype is done and the firmware is almost done.
The firmware is actually very simple. I'm using 32 bit timers for both measuring incoming RC PWM signal for for outputting 5 V pulses of specific lengths and all the USB CDC functionality is copied-and-pasted from a previous project. The most complex part is actually for command-line interface (or "CLI") parser.
To configure the device you plug into your computer using a mini-USB cable and then connect using Telnet, screen or other terminal application.
The command set is pretty simple and supports the following commands:
list -- shows all defined intervals add 1000,1200,85 -- adds a new interval delete 1 -- removes entry 1 change 1=1000,1300,85 -- changes entry 1 pulse 50 -- sends an output pulse of 50 ms show -- shows all settings parameters show <setting> -- shows the value of a single parameter set <settings>=<value> -- changes the specified settings parameter help -- shows available commands ? -- same as "help"
No need to "save" or similar. Everything is stored in EEPROM as soon as it is entered.
The PCB design is also almost done. I just need to check it a couple of times (time well spent, trust me) and verify footprints (likewise time well spent). The size is 5 x 2 cm and even though I probably could squeeze it down some more, I think I'll keep the current size seeing as how I'll be hand-soldering some of the parts and applying solder paste and components all by hand.
Here's a rendering (from the excellent 3D Gerber Viewer from Mayhew Labs:
Looking at some of my old schematics, I can see that I haven't been entirely consistent when naming components. Nowhere near consistent, actually.
Sometimes I have used "T" as prefix for transistors and sometimes "Q". And especially IC's that are prefixed either with "U" or "IC" – often I have used both in a single schematic. And also connectors that are named "CON" or "J" or "JP". Sloppy…
Well, no more! This page on Wikipedia has a nice table with designators for various component types (even though it does not comply with with IEEE- or ANSI-whatever standard).
So this is what I will use henceforth:
|D||Diodes – all types including Zener, Schottky and LEDs|
|U||IC's of all kinds. Technically it is used for "Inseparable Assemblies".|
|J||Connectors. The more fixed part of a connector pair (often the part soldered to the PCB).|
|P||Plugs. The less fixed part of a connector pair (i.e. the one on the wire).|
|Q||Transistors – all types including MOSFETs, IGBTs, BJTs etc.|
|Y||Crystals and oscillators|
|X||Transducers/sensors (no, X is not for crystals anymore).|
|JP||Jumpers. Not connectors but only actual jumpers that are linked or unlinked.|
|TP||Test point (pad or pin for measuring)|
|MP||Mechanical parts (standoffs, screws, mounting hardware etc.)|
This online 3D Gerber viewer is awesome.
Simply drag-and-drop your Gerber files and it'll generate a 3D model of the PCB which you can pan and zoom and save to an image.
For another project (that I have shamefully neglected to write about) I decided I needed to put it into some kind of enclosure. And I since I couldn't find any off-the-shelf enclosures that fit I decided to make my own.
A little bit of googling let me to Shapeways that lets you create 3D printed models from your own 3D files in several different materials.
The models themselves can be created in pretty much any 3D modeling application (including the free SketchUp or Blender). I used Luxology's modo.
Obviously, exact dimensions are important. So I got PCB dimensions and coordinates from Eagle and used a caliper to measure the size of the battery and plugs and so on. And I created dummy objects for the battery and the PCB to make sure that everything fit. This is what I came up with:
The stand-offs have 4.1 mm holes for threaded inserts to use with M3 machine screws (like these ones from RS).
And here with the dummy objects visible:
I exported the object to Wavefront OBJ format and uploaded it to Shapeways (I needed to rotate 90 degrees about the X-axis first in order for the preview image to render correctly on Shapeways) and specified the units as meters (since that's what modo uses by default).
The price came to €20.14 plus shipping (€8.38 for UPS shipping) for "white, strong, flexible" material. So now it's just wait and see how it turns out.
Bear in mind, that this is my first attempt at making a 3D printed object. I haven't even smoothed the edges or added support ribs or anything. Not to mention that I have only made the bottom part of the enclosure (it does however have a "lip" for mating with the top half).
For a much nicer custom enclosure, take a look at this one (also on Shapeways).
The PBCs have only undergone minor revisions and Gerber files have now been sent off to ITead Studio for fabrication.
Here's a 3D rendering of both sides of the PCB (yes, several of the components were unknown to Eagle3D and I didn't bother creating custom parts). Also, the largs pads for the RGB LED are actually mostly covered by soldermask:
First version of the PCB for the RGB Tumbler is ready. Although usually I do through a couple of revisions before I send it off and get it made.
The PCB ended up somewhat larger that I had originally planned. It is currently 3.6 x 3.6 mm.
Here are pictures of the PCB printed in 1:1 scale and populated with components to verify that everything fits (click for larger images):
I need to move the slide switch a bit up to make room for the 10 µF capacitor. And I will also move the battery holder up a little bit. The NCP1402 voltage booster almost touches it. Apart from that, everything looks pretty good.
Another problem is that I ended up placing several vias directly under thethe battery. This may not be the best thing. Especially since the vias on ITead's PCBs (ITead Studio is where I get my PCBs made) are not always completely covered (even though the Gerber files say they should be covered). I guess I'll just have to cover the vias myself with some tape or something).
For the airsoft flag device project I have been working with normal or semi-high-powered LEDs. And they just weren't bright enough so I had to step it up to proper 1W or 3W LEDs.
However, that required me to change the circuits since it's not a good idea to drive a 1W LED with a series resistor since way too much power will get wasted in the resistor. The correct way of driving high-power LEDs is with a dedicated constant current circuit.
So I decided to make a small board with just the driver circuit and external leads for power, GND and LED control as well as leads for the LED itself.
Of all the many ways of making a constant current regulator, I decided to go with the ZXLD1350 IC for reasons I can't remember.
EAGLE files: Eagle files
I have received the PCBs and assembled the first one. Everything expect connections to external components, that is.
Here's a picture. It looks pretty much like the rendering. And I know: some of the soldering joints could have been made better but bear in mind that this is my first SMD soldering attempt so I'm actually pretty pleased with the result.
Here is a 3D model of the board created with Eagle3D (here's a tutorial and here's some information about getting it to work on Mac OS X):
Schematic and layout revised again. I added the 10 µF capacitor (that really ought to be there) and a LED with accompanying resistor for debugging purposes.
Here a print-it-out-and-see-if-it-fits test. And it does fit. Note that all the resistors are the same value (doesn't matter of course since all 1206 resistors are the same size) and that I've placed a 1206 resistor instead of a 1206 LED. Also, the B sized 10 µF capacitor isn't placed on the printout but it shouldn't pose any problems.
Until now I have only made through-hole circuits.But the Airsoft Rounds Counter project's demand for a small PCB made me decide to use SMT. The components are a lot smaller so you can fit a lot more onto a small board but they are more difficult to solder by hand. (But easier and faster to assemble automatically. And cheaper.)
So I have to practise my SMT soldering. Fortunately there are a couple of great tutorials on the net. I used these:
- SparkFun's tutorials
- Excellent video tutorial
- SMD Soldering Guide by Infidigm
- This guide from fpga4fun.com about SMD was also helpful
And it's actually not that hard. I have – so far – had much success with flux-pen-and-solder-on-the-tip-of-the-iron method. A flux pen if your friend – trust me.
Here's an example of my handiwork (the ting at the top is a millimeter scale ruler):
The resistor in the image above is a fairly large SMD component: a 1206 sized resistor. The smallest I will be using to begin with are 0805 sized capacitors and SO-20 and -24 ICs. You can see the various SMD sizes here:
(Note: SMD means "surface-mount devices" and SMT means "surface-mount technology". I use the terms pretty much interchangeably. Which is wrong. I know.)
Oops. The photo interrupter's collector wire wasn't connected to INT0 on the ATTiny. That has been fixed now. Also, the board is now 1 mm wider so there is enough clearing from the segment A wirepad to the edge of the board.
And the VCC and GND traces are now 24 mils and all other traces are 12 mils wide. Refer to the first layout if you can't remember what the various wirepads are for.
Here's the first draft of an SMD PCB layout for the Airsoft Rounds Counter project.
The wire pads are as follows:
9V power input
- AN, CA
Anode and cathode the the photo interrupter LED
- CO, EM
Collector and emitter for the photo interrupter transistor
- A-G, DP
Segment anodes on the display
Digit cathodes on the display
- RST/PRG SW
Reset and program tact switch
Actual size is 49.53 x 20.32 mm.
In electronics as in everyting else, the more you mess up the more you learn (hopefully). With that in mind I figured, "what the hell, let's give it a go" and I sent an order to Micron 20 .
It is a pretty simple PCB for an ATmega168 (or -328) with voltage regulator, pull-up resistor for the reset pin, a crystal with associated load caps and a 3mm led with resistor.
The order specifications are as follows:
- 6.9 x 2.8mm (2700 x 1100 mils)
- Solder mask (blue) on both sides
- Silkscreen (yellow) on top
Minimum PCB size is 0.7 dm2 (square decimeters?! Why would anyone ever use square decimeters as a unit?) so I will received 4 boards.
I chose to have the boards done in 7 work days (you can choose between 24 hours to 15 days) and airmail delivery and the grand total was €66.
Now, we'll see what kind of mistakes I have made :)
It looks like this:
So far I've only been concerned with designing circuit schematics. That is, an illustration of how the various components are connected to each other but which not necessarily have any correspondance with how the actual, physical components are placed on a board. I have been using the free version of CadSoft's EAGLE which is very capable and has all the features I will need for the forseeable future. And it runs on Mac OS X (as well as Windows and Linux). It does have kind of a weird user interface but you get used to that.
EAGLE has both a schematic editor and a PCB layout editor and until recently I had never spent more than five minutes looking at the PCB layout editor so I had some learning to do. This tutorial from SparkFun and this PDF helped a lot. As did this list of layers from PCB-Pool.
Three more things I learned:
- Choose the right components when making the schematic - or later.
It quickly turned out that I had to go back and spend some more time in the schematic editor. Because up until now I just chose components without much regard for the "footprint" – i.e. size and shape. I didn't care exactly what resistor I was using as long as it had the right symbol and I could specify name and value.
But for PCB layout you really need to know whether there are 0.1 or 0.2 inches between the capacitor leads, for example.
So choose the right components when you make the schematic OR just drop in some components and then go back and change them when you starting working on the PCB layout.
Yes, I know that most engineer types out there will yell stuff about always choosing the correct component to begin with. But honestly, when I make the schematic I have no idea whether a given resistor will be 10 mm or 8 mm long. And I don't want to spend time thinking about at that time. So there!
- Make your own or adjust the packages
For some components I needed to change some details on the footprint. For the polarized capacitor I would like a square pad for the positive lead and for the 7805 volt reg I wanted to remove a lot of unnecessary silk screen print. This tutorial from SparkFun is helpful (http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=110).
As is knowing how to copy everything from an existing package. Here's how:
1) to identify the package and the library it's part of, choose the info tool and click on the part
2) open the library and edit the existing package
3) click the layers tool and show all layers
4) choose the group tool and select everything
5) click the cut tool (the scissor) – yes: cut. It will actually copy and not cut.
6) open or create the new package
7) click the paste tool (next to the cut tool)
And then you can add or remove stuff and save the package. Then edit the part, add a new package and connect pins and pads and then replace the old part with the new variant in the schematic editor (And choose Library -> Update all).
- Print and check
Print out a copy of the board in actual size by choosing File -> Print… and setting the scale factor to 1.
Then place all the components on the paper (push the pins through if possible) and make sure everything fits and the footprints are correct. I caught several mistakes by doing this...
Having made a couple of prototype-like projects I thought it would be nice to put the projects on proper made-for-the-purpose circuit boards. So far I've been using these boards and they have worked very well: the size is perfect for an ATmega168 with support components (like a 7805 volt reg and a couple of capacitors) and they are laid out like a breadboard.
However, I'm running out of space for components on those boards and using single-pad proto boards seems kind of kludgy.
So I began looking into making my own PCBs. But all that stuff with printing and ironing and splashing around with acids and whatnot just looks like too much hassle.
So if I don't want to make my own, I guess I'll have to buy them. It might be a bit more expensive but they will look soo much cooler with solder mask and silkscreen and stuff.
After a couple of hours of Googling I ended up confused on higher level. It turns out that there are lots and lots of companies making PCBs to order but specifications, requirements, prices, minimum quantities etc. vary wildly. My requirements are:
- Simple boards: typically only one copper layer and (for the time being) no small SMD components so layout isn't too complex.
- Small quantities: like one or two or six boards at a time.
- No hurry: I can wait a couple of weeks.
- Price: I don't want to spend too much money on something that is just for fun (actually, that's probably too late but still...)
- No hassle: by which I mainly mean import tax and VAT.
- Solder mask: I'd like a solder mask (http://en.wikipedia.org/wiki/Solder_mask) to help protect from shorts and to avoid having to tin all copper traces to prevent corrosion of the copper (not strictly necessary). Also, it look cool.
- Silkscreen: Not strictly a requirement but it would be nice to have outlines and labels silkscreened unto the board. And again: it looks cool.
Two providers I'm currently looking at are:
Both are in the EU so there's no import tax and VAT, both accept designs in EAGLE .BRD files (EAGLE is the schematic and layout program I use), and both are able to deliver single and double-sided boards with solder mask and silkscreen in small quantities for a reasonable price.