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!

DIY BrewPi Arduino shield

My DIY BrewPi Arduino shield sitting on my Arduino Leonardo

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.

Top view of the Arduino shield. The wires on top are the red wires in the Eagle files.

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.

Solder side of the BrewPi shield. Not my best work, but it might help you in soldering yours.

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.

What I usually do when soldering on proto board is to use some naked wire for long tracks and just solder it to the board. For very short connections, you can do it without a piece of wire: Set your soldering iron to a lower temperature, and first put some solder on both pads. Then put some solder on your iron and tip in between the pads. When you are lucky, you’ll connect them. It takes some practice but it is definitely easier at lower temperatures.

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.

I dealt with 90 degree angled headers to deal with the half grid offset of one of the Arduino connectors. Notice that the pads directly under the pins have been removed to prevent short circuits.

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.

Even with straight headers, it’s a bit tricky to solder them on the bottom. They are ‘floating’ to be able to solder them. The top doesn’t have copper pads.

The display and rotary encoder

Backside or the OLED display and rotary encoder. The OLED display has a quite large PCB unfortunately, so I had to make an enclosure for it. It didn’t fit in the small plastic top border of my fridge.

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.

9 pins of the display are connected. (4 data pins, Read/Write, Register Select, Enable, GND and VCC). I used a capacitor on the supply pins because the power wires were thin. It helped to reduce an occasional high pitch noise from the OLED driver.

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.

Small board to connect the rotary encoder to the header

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 🙂

You will have to figure this out for your fridge model. The two buttons on the bottom control the fridge (on-off) and the light.
I have cut a trace for both and rerouted the trace through an SSR.
The door switch is completely disconnected and is now connected directly to the Arduino shield.

The temperature sensor wires enter the fridge at the same place as the 230V cable for the light bulb.

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.

DIN connectors are great!

I am so happy with these new 3-pin DIN connectors for my sensors. Very sturdy, very cheap. The sensors wires run alongside the light bulb wire.

 

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.

6 Comments

  1. James Reedy on October 11, 2012 at 03:48

    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!



  2. Sam on October 16, 2012 at 01:39

    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?



    • Elco on October 16, 2012 at 02:08

      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.



  3. Sam on October 24, 2012 at 04:56

    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



  4. bw on November 20, 2012 at 15:22


    • Elco on November 25, 2012 at 15:46

      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.