Do-It-Yourself BrewPi Arduino Shield
Let me start this post by saying the response to my first post has been fantastic. I had 50.000 page views last week and was featured by RaspberryPi.org, Wired.com, Adafruit, Hackaday and Slashdot. There are now 64 registered forum users and 158 twitter followers. Looks like a lot of brewers can’t wait to start building. I hope this post will help with that.
I actually wanted to start my first brew with BrewPi today, but unfortunately my yeast died on me. The Wyeast (Weihenstephaner) 3068 smack pack had been sitting in the fridge since February, because I had been so busy with BrewPi and some other projects. I tried to make a starter anyway, but no luck. So “Raspbian Wheaty” “will have to wait until tomorrow.
I have also ordered some Better-Bottles all the way from Sweden (hard to get around here) and started adding sensors to them. I will post some brewing setup pictures later. This post is about soldering your own BrewPi Arduino Shield!
Do-It-Yourself or buy fully assembled.
I have started a thread on the forum to check for interest in a fully assembled Arduino shield. There seemed to be enough interest to do a small production run. So if you suck with a soldering iron or simply don’t have the time to build the shield yourself, you will be able to buy one soon. I think it will take at least 3 weeks, so if you want to get started right now, you will have to build one yourself.
You will be able to buy the shield with all components soldered or just the surface mount parts. The shield will also have a thermocouple interface and I will use a shift register for the LCD to free up some additional pins. So for the coffee roasters out there that would melt DS18B20’s, this would be better for you.
You can discuss the desired features for the Arduino shield in this forum topic. Eventually I would like to use an ARM processor, but that will probably take months. So to get you started soon, I’ll make some Arduino shields. All other components (sensors, SSR’s, display, rotary encoder) will stay the same. So if you want to upgrade later it will not be expensive.
Shopping list
The shopping list for the BrewPi shield can be found on the wiki. I want to keep it there, so all of you can add links to sellers.
BrewPi Shield layout for the Arduino Leonardo
I am using an Arduino Leonardo with my BrewPi shield and they layout I posted in the first blog post is only suitable for the Leonardo. The photo’s in this article will be for the Leonardo shield! If you are using an Arduino Uno, check the differences at the bottom of this article.
You can download the Arduino shield layout in a PDF document (schematic, top view, bottom view), or as Eagle files. This layout uses 0.1 inch pitch so you can translate it directly to a perf board layout. I think this document should be your guide when soldering, but below are some more pictures to clarify some details on how to do it.
As you can see in the photo above, the shield is mostly just connectors. If you are not planning to use JTAG (you need an AVR Dragon for that) you don’t need the bottom connector.
Here is a view from the bottom, but please use the PDF document to see what you should connect.
So lets talk about how to create tracks like this. I have used perf board with round connectors, because that was what I had lying around. Rectangular pads are easier to solder together to create tracks.
Now some basic notes on soldering:
- Don’t set the temperature too high and work as quick as you can. Solder contains flux to make it flow easily. The moment you start heating it, this flux will evaporate. With flux, the solder automatically flows to the copper. Without it it will get pointy and hard to handle. If your connections look dull, you worked too slow. So always first apply heat to both the pad and the pin and then add solder. Don’t add solder directly on the tip of your soldering iron: the flux will evaporate before you start.
- For short tracks, you can solder pads together. To do this, set your iron to a lower temperature. Then add a blob of solder to both pads. Next put a bit of solder on the tip and directly touch in between the pads. If you are lucky they will melt together. It takes some practice to get it right.
- For longer tracks (>3 pads) you should use a stripped piece of wire to make the connection. You can solder it to the board on the bottom side.
Dealing with the Arduino headers
The makers of the Arduino thought it was a good idea to give one of the headers a half pitch offset instead of aligning it to the grid. It probably prevents some wrong insertions, but it’s a bitch when you are using proto board. I dealt with that issue by using 90 degree angled headers. You can use some pliers to twist them just enough to bridge the half pitch offset.
To prevent a short circuit under the header pin, I removed the copper pad there. This is very easy to do by setting your soldering iron to 400 degrees and touching the pad. It will fall right off. That’s the only advantage of the often crappy quality of these boards.
For the other headers, you can use normal straight headers. You do have to solder them to the bottom, unlike all other components. Because you probably only have copper pads on the bottom, you will have to float them above the board a bit to be able to solder them to the bottom pads.
The display and rotary encoder
I used a 10 wire flat cable to connect my display. I removed one wire because I only needed 9. This OLED display has solder jumpers on the board to set it to maximum brightness. For other displays might need to connect pin 3 for the contrast adjustment.
I soldered the flatcable directly to the display and added a 100uF capacitor on the power supply.
For the rotary encoder I used a small board to connect it to a male header. I used a 4-pin MOLEX connector for the cable.
If you have to choose a rotary encoder, two things are important:
- Get one with a built in switch
- Get one with detents. Detents are clicks you can feel when turning the knob. It is easier to set a temperature with this feedback.
Note that the display and rotary encoder are optional. You can control BrewPi from just the web interface.
On the other hand you can also control BrewPi from just the display and rotary encoder. The basic functions (everything displayed on the menu) can be set with the rotary encoder. To configure your setup (PID parameters, all advanced settings) you send settings over the serial port.
Hacking your fridge
What I did to give the Arduino control of the fridge temperature is to cut one of the power wires to the compressor and to the light bulb. With a knife you can cut through the PCB track and get underneath the cut part to completely remove it. Next you can scrape of a bit of solder mask to be able to solder a wire to both sides of your newly created gap. These wires will be rerouted through a relay that is controlled by the Arduino.
I completely removed all connections from the door switch to the 230V fridge circuit. The door switch is now an Arduino input and the Arduino turns on the light when needed. I have done this to be able to see when the door is open and because for now I use the light bulb as a heater. I still have to find out whether the light of the incandescent light bulb skunks the beer. Some people say it does a little, other say it doesn’t. Fluorescent lighting is very bad, incandescent not so much. Of course you can always wrap your fermenter in a t-shirt, but I bought transparent better-bottles to be able to watch my beer ferment. I just bought a webcam for inside the fridge too 🙂
And here is a picture again of the DIN connectors I used to be able to disconnect the temperature sensors when I want. DIN connectors are very cheap and very robust, because they are an industry standard.
A shield for the Arduino Uno
There is a small difference between the Uno and the Leonardo that makes the Leonardo shield incompatible with the Arduino Uno.
The Leonardo has an Atmega32u4, which has USB built in. The Arduino Uno is based on the Atmega328 and uses an Atmega8u2 for the serial to USB conversion. But the serial pins of the Atmega328 are also connected to pin 0 and 1, so it is best to avoid using these pins when you are using the serial port. This means the rotary encoder has to move.
The Uno does not have JTAG, so the rotary encoder can move to the analog pins. I do have an Arduino Uno and will add a version of the rotary encoder source files that will work with the Uno. I have created a new branch in the GitHub brewpi-avr project for the Atmega328.
I can also do a quick reroute of the Eagle files for an Arduino Uno shield. I have not had the time to do it, but I will make sure to post it this week.
The assembled version of the Arduino shield will be compatible with both Arduino variants.
Good luck with your build!
So that’s about it for this update. I hope this somewhat more detailed build log will help you in building your own BrewPi fridge. If you have any questions, post them in the comments or on the forum.
Excellent work Elco! I think doing a shield is an excellent idea, especially for those not so skilled at doing vector board type constructions. Not to mention for those of use who are able some would prefer not to spend the time. Depending on your layout I very well might just buy one. I would also suggest that when you panelize the board you make an encoder PCB as a break-away board. I doubt many people will configure the system in such a way the arduino is flipped on its back such that a shield mounted encoder would work well.
For whatever it’s worth I also think adding a header for a piezo buzzer would also be nice so that you can have both tactile and audio feedback. Maybe as a configurable option, small ticks or beeps at the encoder detents, double beep to confirm encoder presses. If this seems tacky I think it’s still good for alerts and such. I’ve got one of those STC-1000 aquarium deals modified to run SSR’s and such, inside I noticed it has a beeper. It warns you for instance if the sensor (NTC) comes undone etc.
As for your comment on skunking, I think the bulb is a bad idea especially for glass carboys. I personally use a heater called cozy legs in my setup it’s 150W (far more than adequate) and fairly compact. I’d have used this http://www.williamsbrewing.com/BREWERS-EDGE-SPACE-HEATER-P518.aspx but they’re only available seasonally and when I setup my fermenter Williams Brewing was out of these. Honestly I’d have preferred the simplicity of a stick on lower powered heater like this one to what I went with. I measured the Cozy Legs with a FLIR camera here at work and at least confirmed that the surface doesn’t get anywhere near hot enough to be dangerous. It’s certainly safer than the missuses hair dryer or an electric space heater or the light bulb in a paint can setup I see so many people using.
I had a quick look in your code at one point and it seems you’re reading the state of the fridge switch. I believe in part to turn the light on when the door opens because it’s in part used for the heater. For those of us who have no internal light (I use a 7cu/ft chest freezer) is there any implication? For instance does the code behave differently in terms of its attempts to regulate temperature if it sees that the door has been opened?
Thanks again for all your hard work…I’m slowly gathering the pieces. I now have my New Haven Display, The Leonardo (I only had Uno before, now I see you’re supporting that) and the WiFi dongle which was amazingly had for $9.99 shipped!
I noticed that in the linked PDF docuemnt ( http://wwwdev.brewpi.com/wp-content/uploads/2012/09/BrewPi-Arduino-Shield.pdf) the Arduino is labled as an Uno R3, but the write up is for the Leonardo. Is the wireing shown n the PDF document the same for both?
The wiring is indeed for the Leonardo!
The Arduino is labeled as Uno, because the AdaFruit library only had the Uno.
It’s a bit confusing, I have to admit.
FYI, for anyone building this, Adafruit sells a DIY shield for Arduino with “a magical 8-pin header that has been bent so that you can plug it into the ‘not-quite-0.1″-spacing” arduino headers”
http://adafruit.com/products/187
Can this be combined with this project in any way ?
http://www.kickstarter.com/projects/fairduino/smartduino-open-system-by-former-arduinos-manufact
I don’t really see the benefit of combining it. They have just designed a new breakout board for Arduino.
I will release an Arduino shield soon and it will only be compatible with a normal Arduino. With their breakout adapter you can make the projects compatible.