Teensy3 piggyback board

Status
Not open for further replies.

Roger Parkinson

Active member
Here's what I would like to build: a piggy back board for the Teensy3 which holds a microSD and a lipo charger circuit that feeds the Teensy3 with enough power (around 3.7-3.9 volts as measured in my prototype). I need something like this for the two projects I have (strictly hobby stuff) and it might be generally useful so if I can make it work I'll post the Eagle files. I don't have any ambitions to build these for sale, but if someone else does that's fine.

There seem to be two microSD holders available and the one Paul used for the Teensy 2.0 piggy back is smaller than the other, which is too wide to fit in the width of the Teensy3 (same as the width of the other Teensys actually) between the pins. Paul's piggy back board works well for the Teensy 2.0, is not quite so convenient for the Teensy++ 2.0 and doesn't match up too well at all with the Teensy 3. The part number for that microSD holder is HR1941CT-ND.

The second requirement of this is the lipo charger based on a MCP73831. It will take input voltage from the Teensy3's Vusb pin (which I rather rejoiced to see 'cos doing this on an earlier Teensy meant doing stuff with the solder pads and I usually screwed that up). It has a JST connector for the battery and a switch to kill the power going to the board, actually to the Vin pin on the Teensy 3.

Finally I figured since the microSD needs to use pins 10,11,12 and 13 my piggy back would cover the end of the Teensy3 including the push-button and I ought to put a second button to do the same thing, which just means a button that connects Program to GND. I do know there are other options for those pins but, if I read it right, they all involve using at least pin 13 or 14, both of which would need the end of the Teensy3 board covered. The other option is to drill an access hole in the piggy back board and save a little soldering. I'm still wondering about that.

I got the original charger circuit from asselinpaul.posterous.com (the design isn't on the web just now, a logistics thing, but they were happy to send it to me) and that is really a USB charger so my prototype on this consisted of sending the Eagle files to OSH, ordering some parts and then trying my hand at some SMD soldering. I was pretty surprised it worked actually 'cos I suck at soldering.

Next are the outstanding questions I have to resolve. Bear in mind this is the first time I've tried messing about with Eagle, I have hardly a clue what I'm doing, and my knowledge of electronics is pretty basic. I say this to encourage feedback. If you think I'm doing something dumb you are probably right and I'm happy to hear.
piggyback-early.png

0) Is this worth doing? I have looked around for other solutions but if someone can tell me 'all you really need is...' then hearing that now rather than later is good.

1) Paul gives a diagram for his microSD design which uses an MCP1700 to handle a 5v supply. I don't need that for the Teensy3 'cos it is built in (the 3.3v pin, yay!) but I'm not sure if I need the 74LCX175 etc or not. The larger microSD is very simple, basically the pins go straight through and I tested that to see if it works on the Teensy3: it does. So I'm hoping the smaller one is just as simple, but then why did Paul add that 74LCX175? So this is a general question about wiring that microSD.

2) I found by experiment (and then I looked it up...) that the Teensy3 won't flash if it is given less than about 4v. Specifically it won't flash using the 3.9v coming from the charger circuit which is what I get when the USB is plugged in. My solution is to route the Vusb directly to Vin through a diode and I have Vin connected to the battery through a similar diode. I'm fairly sure this isn't the best way to do this, but I haven't thought of anything better.

3) I've attached my Eagle schematic. I'm feeling my way here and I've only a vague idea how to do the board layout. If there's anything I'm doing at this stage that I ought to change around I value the feedback.

Thanks for any help
Roger
 

Attachments

  • piggyback-early.jpg
    piggyback-early.jpg
    36.9 KB · Views: 306
I've done some more work on this today. There's nothing like explaining what you're doing to get things moving along, even without any replies yet. This is the new schematic. It has Constantine's Teensy3 layout with most of the pins removed and I removed the diodes and just used the switch properly, so that's looking quite good. I think the push button is not the right one and I'll track down an eagle file for the one Paul uses. I've started work on the layout and it does all fit okay but I find it best to mount the microSD sideways, which means I could actually use the larger one if I want.
piggback-v2.png
Still keen to hear any suggestions. I think the wiring on the microSD is not quite correct yet. If I can't figure it out I will go for the larger one which I know just how to do.
Roger
 
Your SD slot is correctly wired, assuming the pin numbers on your U$1 component are offset by one compared to the numbering of the pins on the Teensy. E.g. CLK is pin 13 on Teensy, 14 on your component.

Now for your questions:
0) If you learn something for it, then it's worth it. But that's something you have to find out for yourself.

1) The flipflops act as level shifters, transforming the 5V input signals to 3,3V. Most SD cards get destroyed if you use 5V on them.

2) The 5V gets regulated to 3.3V by the onboard voltage regulator of the MK20 chip on the Teensy. 3.9V will be too low for the chip to still perform stable regulation. That being said, I'm not quite sure what you are trying to do. The charger only works when USB is plugged in, so why not use the USB 5V to supply the Teensy with power then?

If it's any help, I'm developing a Teensy 3.0 carrier board which allows you to use all the existing Arduino shields with the Teensy 3.0. The board takes care of all the level shifting and power supply for you. And because it's a carrier board, not a piggyback, the PRGM button still remains accessible (actually, my board can be used both as a carrier or as a piggyback). The board is currently being assembled at our fab, I hope to get the first samples in the next weeks. If there's sufficient interest, I might put it into volume production for sale.
 
Thanks for that. Yes, I can see the mistake on pin 14 now. So the SD wiring looks otherwise correct, excellent news.
re #2 the second design does use the USB to power the teensy if it is there. It came as a surprise to me that it wouldn't flash when powered from the battery but I get a lot of surprises. The previous sch had two diodes to achieve this and I've replaced them with a switch which makes more sense to me now that I've stumbled on the (now) obvious solution.

Your board might well be of interest, depending on the size. I find my projects need to squeeze into tight spaces because they tend to be wrist mounted, so I don't use Arduino shields. I might if I'm building something bigger.
 
But if you flash it, that means it's connected to a PC yes? So you can use the USB VCC?

Anyway, I assume you're building a battery operated project. Most battery operated devices use a switching regulator in stead of a linear regulator because they are much more power efficient. In this case, you could use a step-down converter to provide 3.3V, or a buck-boost converter to supply something around 4-5V. I would have to check the MK20 datasheet to see if you can just supply the Teensy with 3.3v from the battery, but that would be the most efficient solution. Just beware the Teensy 3.0 draws a lot of current, even at idle it still draws around 27mA.

My board won't be of use to you i'm afraid, because it's meant to be an Arduino adapter board it uses the (regular) Arduino shield size.
 
If I'm flashing then yes it is connected to the PC and then the power will connect from Vusb to Vin. No problem there.
The project will normally be battery powered, but switched off when not in use so I'm hoping that takes care of the 27mA idle. I'll have a try at using the hibernate options of the processor but I think Paul has some plans to make those work better/easier so I'lll wait and see.
The Teensy does run just fine powered from the battery, so does everything else attached to the project. I measured the output at 3.9v though it might drop as the battery drains. Anyway it does run fine on the breadboard.
 
Most battery operated projects use a buck-boost DC-DC converter because it can still supply, let's say, 3.9V while the battery voltage has dropped below that. Your project will run longer on the same charge, and also be more power efficient.
Of course, it adds some more complexity, and you need to protect your LiPo cell against undervoltage or it will be damaged.
 
"buck-boost" ah, wish I had known that term a few days ago. I knew something like this existed, didn't know what to call it and spent hours going down ratholes. I guess I did learn a few things though.
Okay, I probably ought to add that to the piggy back but for now I will keep it simple. I'll put it into the version 2 pile, to be done when I have more confidence.

Meanwhile I have a problem with the button. I can't find one that has an Eagle definition. Well, maybe I have but I don't know it.
Paul uses a KMR432GLFS and I searched for a def of that, no joy. I found a similar button on Sparkfun (https://www.sparkfun.com/products/8720) which claims it has an Eagle def (ie they put the link to their Eagle libraries on their product page) but if it is there it isn't easy to find.
So I'm stuck. Any suggestions? I really need a low profile button and all the ones I have defs for are too tall.
 
Then you will have to make your own footprint ;) . It's mostly less time consuming to look for a part that suites your application and then creating the footprint for it, then looking for libraries possibly containing a suitable part and then looking for suppliers that sell that part. If you want to work with Eagle, or any CAD software, you will have to accept that part creation is an essential element of designing PCB's.

The Arduino uses a very small SMD mounted reset button. You can extract that part from their Eagle files, but I haven't found a supplier which sells this button. I created my own footprint based on a button I found on Farnell, but it's quite large.
 
Not the advice I wanted, but it is the advice I needed. :)
Okay, I will get looking at the docs and tutorials. I'm learning a lot anyway.
Thanks
 
...but the Sparkfun button seems to be TACTILE_SWITCH_SMD/TAC_SWITCHSMD, it is the same one as used on the Arduino Pro Mini so I grabbed the Eagle files for that and checked the button. So I'm good.
Thanks for the pointer to that, I would not have thought of it otherwise.
 
1) Paul gives a diagram for his microSD design which uses an MCP1700 to handle a 5v supply. I don't need that for the Teensy3 'cos it is built in (the 3.3v pin, yay!) but I'm not sure if I need the 74LCX175 etc or not. The larger microSD is very simple, basically the pins go straight through and I tested that to see if it works on the Teensy3: it does. So I'm hoping the smaller one is just as simple, but then why did Paul add that 74LCX175?

That board was designed for Teensy 2.0, where you do need the buffers to translate the voltage from 5 to 3.3.

I have another simpler board for Teensy 3.0, which also has a place to add a Wiz820io Ethernet module. It was actually designed months ago, but I ran into many problems with the W5200. I could write a lot about the W5200 issues, but it turned out I needed to make a new version with the reset pin. Those boards arrived only days ago from OSH Park. I have a couple built up but not tested yet. They're just the SD and Wiz820io pads... no LiPo charger or other power management stuff.
 
Thanks, Paul. I will be initerested in seeing that new board, though I don't have an immediate need for Ethernet.
And yes I did understand that the design of the old board was for the Teensy 2.0 where it works very well.
 
I've updated the design a little, mostly picking some better parts and also adding a voltage divider to feed a voltage into pin 14/A0 of the teensy.
The idea there is to give me a way to measure the battery health. The switch (s3) selects between either the USB or the battery for power and the voltage is read after that switch, so if I have it switched to USB it will tell me the USB voltage, which is fine.
If the USB is unplugged and the switch is to USB the device is off. If it is switched to battery the reading will show the battery value. Strangely the two resistors are chosen because I can easily source those values. Freight is a bitch where I live so, while I'd rather use 0802 resistors I can more easily get hold of these 0603 ones. I'm a little wary of working with 0603, they seem very small. Such is life...
piggback-sch-v3.png
I've autorouted the connections and left them alone after that. Here's the result:
piggback-brd-v3.png
It looks more or less okay to me. I'm still trying to figure out how to stop the tnames showing up on the silkscreen because they look rubbish, but that isn't a show stopper. Actually they don't show up in that image but they do show up in the OSH Park preview.
If anyone wants to look and any advice is welcome. I have run the Eagle rules for OSH Park and they only tell me about some edge issues but those are for the teensy pins which I figure must be okay.
The files are at http://homepages.ihug.co.nz/~procon/eagle/piggyback.brd http://homepages.ihug.co.nz/~procon/eagle/piggyback.sch
 
I ran the OSH park drc file on your design and it came up clean.

If you are talking about the yellow lines, these are on the tDocu layer.
I understand that you really may not want to have any of the tNames labels visible on the board, however if you want to edit these (size, position etc.) then you need to right click on the component and use the "smash" command from the menu. You'll notice that all the little text objects now have their own little origin cross. Make sure to use "Vector" format, which can be changed in the objects properties.
 
You might add a 1 uF capacitor across the 3.3V and GND lines close to the SD card.

Most cards will probably work anyway, but the MMC spec recommends a capacitor located close to the socket, to ease the requirements on the card. Especially with the micro SD cards, there's no room to include much decoupling capacitance on the card!

EDIT: do not add more than 6 uF capacitance. More is not always better. If you add too much, it can cause problems with USB hot plugging, since your PC or a USB hub has to provide a surge of current to charge any power supply capacitance. Adding more on the 3.3V side is probably ok, but there's really no need to add a huge capacitor. Even 0.1 uF located close to short wires is more helpful than 10 uF located farther away with long wires (aka inductors).
 
Last edited:
Opinion: Eagle is awful, in ease of use. Others complain too.
For a quick small set of boards, expressPCB.
Better yet, with some time in learning (less by far than Eagle): Free/cheap DipTrace. very good user interface.
 
I agree. I've found my way around obstacles by surfing the Internet but that also includes things that should be rather obvious but aren't. I would not call it awful though, just not intuitive or perhaps counter-intuitive.
 
I'm finding Eagle okay, actually, though I've not tried the others. I figure if other people can make it work I ought to be able to.
Also, the alternative suggestions above don't run native under Linux. Some can be run using wine but I would need to be much more disatisfied with Eagle to install wine.
 
Roger,

You had asked how to eliminate the tnames layer from the OSH park boards. I just came across teh same issue and figured out that there is really only one practical way to do that.
If you use the convenient way of just pointing OSH park to your eagle .brd file then you would assign all the labels that you see on the thames and bnames layers to other layers. Just hiding these layers will not work. That, of course would be a PITA.

What is slightly less convenient is to create your own Gerber files using eagles CAM processor. Download the OSH park cam file from This Thread

Follow the process described in the thread, however, in the Top Silk and Bottom Silk tab, deactivate the layers thames and bnames layers. When you click on "process job" these will not be exported and you'll be rewarded with a "clean" silk screen.
 
Hey, good advice, Headroom, thanks. My boards are in progress at OSH Park, so I'll live with the result. But next time around I'll know.
I'd rather not mess with Gerber files, or not yet anyway, so the first option sounds best to me.
R
 
Hey, good advice, Headroom, thanks. My boards are in progress at OSH Park, so I'll live with the result. But next time around I'll know.
I'd rather not mess with Gerber files, or not yet anyway, so the first option sounds best to me.
R
 
Status
Not open for further replies.
Back
Top