Share this page to your:
Mastodon

This is about the PCB I made that adds some functionality to the Teensy3.

The Teensy3 has a MK20DX128 32 bit ARM Cortex-M4 processor on board, as well as a USB interface and a heap of other handy stuff, not all of which I pretend to understand. The whole package is just over an inch long so it is suitable for use when you need a processor but there is no room. The kinds of things I build such as the laser pistol and the vortex manipulator tend to be tight for space so larger platforms, such as the Arduino aren’t really an option.
But Arduinos do a neat trick with their shields. Each shield is a board that plugs into the basic Arduino and adds functionality. They’re designed so you don’t need to even solder them, which isn’t a goal for me, but the notion of using a fairly standard add-on board to the main processor board definitely is. Even so the basic idea for this came from Paul Stoffregen, the guy who makes the Teensy boards, he sells several add-on boards for his other Teensy models.

The board we’re looking at here has several functions, these are things I keep needing in my projects and having a way of adding them compactly to an already compact platform is the main goal. I can add them in other ways but they all take up more room and, actually, end up more difficult. Here are the functions:

  • Micro SD Card. These are the little cards that fit inside phones and some cameras. They can hold a lot of data and they basically replace the disk drive a larger machine would use.
  • Battery charger. The Teensy gets power from the USB port by default, but when you want an untethered device you need a battery and you want a way to charge the battery. The right battery is a LIPO because its power to size beats the other technologies. This is why they use them in phones. But they are complex to charge and if you do it wrong they can catch fire and explode. So I wanted a reliable charging circuit that also fed off the USB port. I don’t want a second thing to plug in, that’s a waste of space.
  • Voltage measure. I want to be able to measure the voltage the battery has so I can pass it to the processor which can then display it somewhere eg on a screen.
  • Boot button. The Teensy3 has a button on it that causes it to reboot. My board will, of course, cover the button (unless I put it the other way up, but there are reasons not to). So I need to add a similar button to my board to do the same thing.

The process for making this is really very standard stuff, but this is the first time I did it myself so I’m documenting it for myself and any other first timers who want to read along. The resulting board is a PCB with SMD parts soldered to it. Here are the steps I took:

Design the circuit

I used Eagle V6.5, which is free and runs on Linux. Probably other places too but Linux is what I use. I used someone else’s charger circuit based on the MCP73831 chip. With Eagle, and probably similar systems, you sketch out the schematic (sch file) which is basically a circuit diagram and then you press a button and it generates a board (brd) which shows how the final board is laid out. There are a number of tricks to all this but I don’t want to rewrite the Eagle docs here. It isn’t particularly hard. You can nudge things around and get things positioned sensibly and so on. Part of this involves getting hold of the part description of each part you want. For the most part the Eagle libraries contain everything you need but I had to hunt around for a switch and the SD card description. You can make your own descriptions but I didn’t want to introduce that level of complexity this time around.

Upload the Design

Upload the design to OSH Park. These guys will, for a small fee (just over$NZ5 for three of these in my case, including shipping) make the boards. The boards come with wire traces through them and pads to attach the parts. They take about 3 weeks to deliver to me from the US. Your freight time might be shorter.

If you want to use my design you are welcome to. I have uploaded it to github.

Get the SMD parts

These can be ordered from lots of places, such as element14 or mindkits. Those are New Zealand links, you may have more local ones. Parts like these are mostly really small, just little specks, and they come in tapes suitable for feeding into the huge pick-and-place machine you have in your cellar allowing you to mass produce your device… you don’t have a pick-and-place machine? Neither do I. Read on.

Get some solder paste

It comes in tiny quantities, I got a 40g punnet. It goes off so you don’t want to stockpile it and you need hardly any. To make one board I used just about none of the 40g, ie I can’t see the difference. It is odd stuff. It behaves like paste at room temperature but when you heat it up to about 200C it liquefies and then goes solid as it cools down.

When cooled it is like ordinary solder, ie shiny, conductive and quite solid, no longer paste. When it liquefies something happens that looks like magic.

Put the solder paste onto the pads on the board

You need very little, just a small blob on each pad. The pads for the Micro SD are very close together and you’ll probably not be able to separate the blobs of solder on them. Don’t worry about that. Some magic will happen there later.

I used a sewing pin to put the blobs of solder in place and it was pretty tedious. You can get tubes of paste which might be easier ‘cos then you can squirt a blob on each pad. Some people make more elaborate foot controlled devices, but they probably do all this more often than I do. Others make a template of clear plastic with a hole for each pad and you just spread the paste over the plastic with the board held in place under it. You need to be making several boards at once to justify that.

Place each part

Because these are truly tiny take steps to ensure you can find them when you drop them. And you will drop some of them. A cloth across your knees etc is good, consider sweeping the floor first and do not do this over carpet. You will need tweezers (unless you have that pick and place machine in the cellar). I’ve seen a neat arrangement with vacuum powered ‘tweezers’ with a foot control that I see the point of now. But ordinary tweezers do the job eventually.

The trickiest one is the LED which has to be the right way around. The docs on whatever LED you buy will say how you tell. Do the largest parts first, and the Micro SD is easily the largest. There is space for the battery connector but that is not an SMD part. It is a ‘thru-hole’ part. Leave it for later. Also ignore the holes around the edges for now for the same reason.

The skillet

Now get your skillet. What you want is a free standing thing that you don’t expect to use for cooking food again. It doesn’t matter about non-stick coatings. You aren’t frying eggs. If you have an old electric fry pan that’s ideal. Give it a run first, heat it up and make sure you know where the hot spots are. I have a temperature sensor on my multimeter which helped. Make sure it gets up to 200C. Now turn it off and let it cool. You should be well ventilated for this, I took mine outside.

skillet

Put the board on the (now cool) hotspot, part side up, and turn on the skillet. Just let it heat up to the max temperature and watch carefully. The idea is for it to heat fairly slowly, so don’t dump it onto a pre-heated surface. When it reaches the magic point the paste will go shiny and liquid. Okay, that’s nice. And then you realise is it awesome. Remember those pads in the Micro SD that were so close together you couldn’t separate them? Well the solder paste does something like capillary action. It balls together on the pads, separating them from each other. There are videos of this on Youtube. Even after seeing them I didn’t quite believe it would be that easy. Of course it does depend on you having positioned the Micro SD just right, not too hard because there are white lines on the board to help.

Give it a couple of seconds or so after liquefaction to make sure all of the paste did it, then slide it off the skillet and let it cool. Naturally you want to avoid bumping any of the SMDs while things are still hot. It is very small so cooling doesn’t take very long.

Thru-hole

At this point you are ready to do the thru-hole parts. There are holes to add pins around the edges and these match up to holes on the Teensy3. You want to add pins to all of those holes except the three on the end next to the button. You also want to add the battery connector which is next to the Micro SD. However you might consider just attaching wires to the two battery connector holes if, like me, you’re trying to keep this small. The battery connector is quite big and, as I said, I am all about keeping this small. At this point you are using ordinary solder and an ordinary soldering iron and you’ve put the paste away.

Testing the board

Now you need to test the board to make sure nothing went wrong. You might have bad solder connections etc and you want to find them. Because you left off those three pins on the end you can put this onto a breadboard with a Teensy3 next to it and check all the functions out. But you will need two of those three pins on the end connected: The 3.3v and GND. These are pins 1 and 2 if you count from the side where the battery connector is (from the bottom up if you are looking at the photo below). In my case I found I had swapped the two resistors that control the voltage measure function, so that feature was broken. This is worth knowing. If you want to be even more careful you can test the third pin with a multimeter. It ought to connect to GND when you press the button.

piggback-breadboard

This is what my test breadboard looks like. I have a Teensy3 with all the pins soldered (on the left) and I just use that Teensy3 for testing (these things are cheap enough to run a spare or two). Note that you need to separate the pads underneath the Teensy3 to detach the USB power (VUSB) from the rest of the Teensy3 (VIN). We want power to come from the battery not the USB.  The pads are shown in the top right on the diagram shown below. Cut them apart with a sharp knife. You can solder them together again if you change your mind about all this.

I also had to add a wire the the VUSB hole on the Teensy3, this is one of the holes not on the edge so isn’t quite breadboard-friendly, but you can’t have all the holes on the edge without making the board bigger so the answer is to just run a wire from there and plug it into a convenient hole in the breadboard. There looks to be a tangle of wires there but there is an easy pattern. Every pin on the piggy back should connect to the equivalent pin on the Teensy3, that’s all there is to it.

You can see the battery connector trailing over to the right, the battery isn’t plugged into it just now, and there is a second battery in the lower part of the picture. We’re not using that today but it is the power supply for the clock function on the Teensy3.

You’ll want to connect a battery. I used a Lipo 1000mAh 3.7v and, of course, you’ll want a USB cable attached.

To test the board you need to load some software. I’ll assume you have your Arduino environment set up properly for the Teensy3 and you know how to load programs into it. You’ll find a test program in the google code link I gave earlier. This does the following once it starts:

  1. Wait 5 seconds to give you time to open a serial monitor
  2. Scans the micro SD card for files and prints a directory to the serial monitor. This verifies the SD card is working okay.
  3. Loops, printing the value of A0 and it’s scaled value, which should be about 4 volts. The LED on the Teensy3 will flash slowly. This verifies that the voltage measure is working okay.

The LED on the piggyback should be on steady. Make sure the switch position is on the Right (or Down if you look at the picture above). This is the normal ON position for the board. Now unplug the USB cable and the LED should continue flashing, running on battery.

With the USB cable still unplugged move the switch to the Left position. The flashing should stop. This is the OFF position. The battery is not being used now. Move it back to the Right and the flashing should restart.

Be aware that if the USB cable is in and you move the switch position it will cause a restart because power is cut briefly to the Teensy as the switch moves. Possibly I could use this instead of the reboot button.

The final assembly

piggyback

Once you are happy with the board you can finish it off. Add the three pins you missed before and, yes, it will be a bit fiddly because you already soldered wires to two of them and you can remove those. Then slide the Teensy3 onto the pins underneath the board and solder it all together. You’ll want to solder other things to the other Teensy3 connectors, of course, but the Micro SD etc are all taken care of. In the picture mine still has the end wires, but you can see the whole thing is very small. I plan to snip the bottom ends of the pins off.

Previous Post Next Post