Today I will go over the interface boards for Project Pi Heater. If you're not familiar with the Pi Heater project, check the link above to jump to my last post regarding this project. With that out of the way. Let's start with the Pi Heater shield, it's the piece that goes onto the Raspberry Pi. I designed this shield and sent it off to the fab (OSHPark) pretty much a day or two before the Rev 2 Pi was announced. Not only did they re-arrange the GPIO pins a bit (not in a way that affects me, I believe), but they also added mounting holes, which would make for nice standoffs for the shield. Oh well, I'd rather use the 1.0's for this embedded application and save the 2.0's for something else, anyways.
This is the schematic. Let me start by saying this was the first thing I had ever created in Eagle. My first PCB ever. I designed it from scratch, myself. So go easy on me, but I do welcome feedback. :) The 2x13 (or is it 13x2?) header on the Raspberry Pi is split into two 1x13 headers in the schematic, mostly because I couldn't find a 2x13 in any of the libraries. I should also mention that I used SparkFun's Eagle Library to do this design. So thanks SparkFun, you guys rock.
Here is the board, as I designed it in Eagle. You can see I did a flood fill ground plane on both the top and bottom. This board is Rev 2.0, I revised it slightly after I had them made. I didn't add a decoupling capacitor originally. I later went and bodged one under the socket manually. This revision has an 0608 SMD .1uf cap on the back of the board under the ATTiny MCU.
As for the odd shape of the board, you saw in my previous post that this board expertly clears the USB, CAT5 ethernet, and the Composite video jacks. This saved me from having to use any spacers or do anything exotic to get the board to clear those tall components. It also helps keep the board secure since it lacks standoffs. I made the measurements with a digital caliper, and printed out the board a couple times to do test fittings and fine tune my measurements.
Unfortunately, this board is rather large when it comes to square inches. I think it cost me $39 for 3 copies from OSHPark ($5/sq inch). So on the next two boards, I went for the smallest size I could come up with. But first, let's cover this board.
As you can see there's an ATTiny chip on here. It's an ATTiny85, could have used a 45, could have gone with an SMT version. I went with the through hole 85 version because I bought a whole bunch of them awhile back. Most of the "little Arduino projects" that I come up with fit into the capabilities of an ATTiny85, so I've used them for a dozen different things. In this case, it's providing ADC's to the Pi. I have the ATTiny running at 8MHz off it's internal oscillator, at 3.3v, and it's connected to the Pi's UART which are physical pins 8 and 10 of the GPIO header on the Raspberry Pi.
My Python app on the Raspberry Pi communicates with the ATTiny over the onboard serial port to retrieve the temperature readings from the two temperature sensors. I've had this part up and working since before the board design started. One trick is you need to disable the TTY console that comes up on that serial port by default. I followed this guide to do that.
Moving on, I put a power jack on this adapter board, I wanted to be able to simply plug a standard wall-wart power adapter into the thing. The stepper control boards connect to this board via standard ethernet RJ45 CAT5 cables. The jacks are nice and cheap, and these are really low power steppers, so it works great for the task. The temperature sensor boards connect via RJ9 jacks. I had intended to use standard phone cord, but after having the board made and ordering RJ9 jacks, I realized standard phone cord is RJ11, not RJ9, so I'll be making my own cords for this. Not a real big deal, in the end.
Next up is the stepper control board. I simply took the one sided control board that came with my eBay steppers, and used that to draw my schematic. I went with SMD components to keep the board size down. It uses a ULN2003 transistor array chip to control the fields in the stepper. Nice and simple design. There are LED's to indicate when it's working.
My original plan involved making a board that adapted from the RJ45 jack to the connectors on the original chinese board, but it would have turned out poorly, and it would have been bigger than the board I ended up designing. I then planned on re-using the ULN2003 chip from the chinese boards on my newly designed board. But that too was making my board too large. A quick check of the price of an SMT version of the chip on Digikey and I was quickly designing my board to just use the SMT version. It was something like 31cents each. Totally no big deal buying 6 new chips at that price. I'd more than make up for it on the price of the PCB.
This is the board layout in Eagle. Looks rather large, doesn't it? I could have actually made it smaller, but I hadn't figured out how to put SMD components on the back side of the board yet. I've since figured that out, but still, it's pretty tiny. The LED's are kind of scattered around the board, 3 on the end, one near the main IC. I did this simply to get everything to fit in the smallest space possible, and still be routable. Like I said, had I figured out how to put things on the back of the board, I could have neatly arranged them all in a row. Oh well, maybe Rev 2.0, if I ever need to roll another revision. ;)
There it is, next to a quarter, for scale. I'd already soldered the decoupling capacitor, and the ULN2003 chip onto the board at this point. The board ended up well under one square inch. I got 6 of the boards made for about $8.
There it is on top of the original chinese board (pay no attention to the corner I cut out of the original board, I had a good reason at the time, I just don't recall what that reason was anymore). I love how the ULN2003, a 31cent piece when it's a name brand TI part, is a chinese knockoff on this product. heh.. I did end up desoldering the jack that the stepper plugs into and transferring that to my board. No point repurchasing that part.
A lot of people are afraid of soldering SMT components. It's actually not too bad if you have good eye sight. I highly recommend checking out some of the SMT soldering videos that EEVBlog has published on YouTube. I can honestly say that if I hadn't seen those videos, I probably wouldn't have dared to give it a try. They really show how easy it can be. With that said, I was still astounded when I tried his technique to solder the ULN2003 onto the board. So astounded that I grabbed my camera and shot some video of it being done:
Nice quick and short video. Once again shows just how small this board ended up, as my thumb dwarfs the thing.
Last shot of the board, this time fully assembled and populated. Not everything is perfectly square, having been hand soldered, but everything is electrically functional.
Next up, the temp sensor boards. Originally, I had just planned to hang a standard through hole TMP36 off the end of the cable. And that'd work, but now that I can make boards, I decided to put it on a board, it looks more professional. Again, I went for a small board. No point in showing the schematic or eagle board layout for this one. It's pretty simple. And again, if I had thought to google and look up how to put components on the back side of a board, this board could have been as small as the RJ9 jack. I had also originally planned on using the through hole version of the TMP36 sensor, but in the end I decided that the surface mount version would be more resistant to damage. Such as someone rubbing up against the board, which would snap off the sensor if it were sticking up and out of the board.
I used a bit too much flux when soldering these boards. It's easy enough to clean off afterwards. I don't currently have any pictures of these with the RJ9 jack soldered on. Not much different, so I'm going to wait until I post pictures of the installed around the house.
I had already done some tests with the steppers using the original control boards. I have used this page to get the steppers moving in Python. It's a pretty nice example program. Here's some video of it running:
Coming up next, I'll be installing the Pi around the house, and routing the cables to the temp sensors. Then I need to work on linking the steppers to the flaps in the heater registers. I'll post more when I have that done.