Introduction: MCP3008 Raspberry Pi Breakout Hat
Howdy Y'all Back when I was working on the Raspberry Pi portable emulator that became the backseat system. I thought that I would want to use an analog joystick like several of the other builds. However I was trying to get it to work via the GPIO instead of USB bus.
Unfortunately mid build I decided that a dedicated USB controller would be better for my Emulator console. However I still tinkered with the analog to digital conversion circuit using the MCP3008. Although I never finished up the control interface for emulators perhaps someone would want to add a rheostat or a analog sensor for a robot circuit or a self watering plant or something.
I am going to take you through building the circuit on a breadboard. Give a quick overview of v1 on a prototype board. Finishing with the assembly of a version 2 of my breakout board design. Version 3 removed the resistor provision as it caused more problems than it was worth.
If you want to skip the breadboarding and prototype stage and get right to it, The PCB's are available on 123d circuits. Or you can use the attached gerber files to fabricate your own boards.
This is the link to version 3 of the board. on 123D Circuits.
Some notes on the design of my breakout board. Channels 0-7 are labeled as such on the solder mask. and I used the center rail as the jumper selectable power 3v3 or 5v. with Ground/negative on the far outside edge. The reasoning for this is like a RC servo Power is the center pin. The idea is if you wire your sensor into a 3 pin socket like cannot be plugged in backwards and fry your sensor.
This is a true open source project, share and share alike. If you make it into a viable product, groovy more power too ya. Just make sure to toss a nod out to the MoTinkerGNome when you make it big. I am compensated in no way by autodesk instructables or 123D Circuits. However in to have truth in disclosure 123D circuits did send me a T-shirt as a customer courtesy due to a issue in shipping, but that is neither here or there.
I am going to assume that you have the ability to solder.
I am also going to assume that you have the ability to program in C or Python
The difficulty of this project would be considered intermediate but the application of the final board would be considered advanced.
THIS IS NOT A BEGINNER PROJECT!
- Revision 2 or newer Raspberry Pi
- Stuff to make the pie work SD card, power supply etc etc.
- MCP3008 ADC chip https://www.adafruit.com/products/856 $3.75
- 26 pin Stacking header. https://www.adafruit.com/products/1112 $1.95
- Break away Pinheaders https://www.adafruit.com/products/392 $4.95
- 2 jumper shunts. . http://www.ebay.com/itm/50pcs-Computer-Mobo-CD-DVD... ( that listing is 50 fo$2.50)
Step 1: Breadboard the Circuit
Give a look through the following pages... Go ahead Ill wait...
Now you understand what is going on with what needs to happen.
- Activate SPI
- Install SPI-Dev
- assemble the breadboard circuit Like the first 2 tutorials.
I wired up my breadboard pretty much in the exact same manner as the second page on how to use a joystick with the pi. As you can see from my pictures This little one button joystick seemed to work well and I would have went with this for my handheld if I could have gotten it thin enough for a 4 yr old to hold.
For the first protoboard I basically copied the breadboard circuit directly over to a proto soldering board. The version 1 board shown is a MCP3008 hooked up to the Pi like on a breadboard in the tutorials. The first row of 8 pins along the bottom edge are Channels 0-7 with the ground rail.
I did not have a power rail at this point and while the resistor was a great idea for testing individual sensors when I used multiple sensors in version 2 my readings went haywire. Basically this picture is shown just to add more documentation to the project.
Step 2: Assembling the ADC Breakout.
- Soldering Iron
- Needle Nose Plyers
- Clamp tweezers
- Anti static wrist strap.
- Small wire cutters.
- electronics vise (panavise, dremel vise, 3rd hands)
As you can note in the second picture I pretty much layed out an exploded view of the components. instead of the resistor the first thing I did was hard wire a jumper for the ground rail. If you are using a V3 board from 123dCircuits you may omit that part. I am taking into account some of the things I learned soldering this one up so you may notice things seem out of order from the pictures.
- Solder a jumper wire in place of the pulldown resistor Indicated on the v2 board. (skipped if v3)
- Place the stacking header in your vise/3rd hands.
- Place the board over the stacking header mask side up and solder each of the 26 pins.
- Place the 3 pins for the Channel select jumper next to the pass through header and solder on the bottom side.
- Place the MCP3008 with the notch for pin 1 facing towards pin 1 on the 26 pin header. (or channel 0 on the mask)
- Solder the 3 sets of 8 pins for analog input channels 0-7 The positive rail, then the negative rail.
- Solder the final 3 pins for the power select jumper.
- After everything is cooled down. Place the Jumper Shunts on Ch 0 for the SPI bus and 3v3 to power the 3v center power rail.
- Experiment and teach others.