UberFridge hardware and schematics

Posted on Jan 4, 2012 in Arduino, Beer, Electronics, UberFridge | 40 comments

I have grouped all the circuits used in my UberFridge project in this article. Schematics, a board layout and pictures.

A top view of the electronics in UberFridge. My fridge has an on/off button on the top, which made it very easy to reroute it via a relay. The boards at the bottom were already in the fridge.

I have encased most of the electronics for UberFridge in a small casing made from an Ikea box lid, see this article. The sensor wires go through the top of the fridge to the light bulb housing in the fridge. The relays are on a separate board. All other electronics are in a plywood casing, see the image below.

Inside the black box is an OLED display, the Arduino and 3 buttons.

The Arduino Board

I have made a small circuit board with headers for the Arduino Nano and headers for the display, buttons, sensors and relays. When I make a circuit on prototype board, I still like to make a board layout in Eagle to plan the tracks. I just set the grid to .1 inch so that the track distance corresponds the holes on prototype board. See the board layout below.

The buttons are debounced with a resistor and capacitor. They connect to analog pins 5-7. Because A6 and A7 are only connected to the A/D converter, the buttons cannot be read digitally, so they are read with AnalogRead().

The OLED display is connected in 4-bit mode.

The Arduino circuit board with connectors for buttons, sensors, display and relays

Schematic of the Arduino board

Arduino circuit board layout

Sensors

I use 2 LM35 temperature sensors, one in the fridge and one in the fermenting beer. Both sensors are detachable to make it easier to sanitize them. I use 3.5 mm stereo jack plugs to connect the sensors and I also used some jack plugs as sensor housing. The beer sensor housing is a male jack plug with the pin cut off and is filled with epoxy.

3.5mm female jack plugs for sensors

Sensors enter the fridge via the light bulb housing

The LM35 fits nicely inside a 3.5mm jack plug housing

The sensors don’t like a capacitive load, so I have given the outputs an RC-damper as the datasheet suggested. The output over the sensors is 40 mV – 300 mV, which is digitized by the A/D converter of the atmega328.

To prevent power supply disturbances on the sensors, the sensor supply voltage is decoupled from the main power line. The 100 Ohm resistor is also necessary to prevent a short circuit from 5V to ground when the jack plugs are inserted.

Actuators

To control the temperature in my Fridge I let the Arduino switch the compressor on when the temperature is too high. When the temperature is too low, I just turn on the light that was already in the fridge. It’s a 15W light bulb and it produces enough heat to get the fridge to 30 °C. I have rerouted the door switch that normally controls the light to the Arduino, so that it knows when the door is open. The compressor and light bulb are switched with two relays.

I have interrupted a few connections on the circuit board that was in the fridge and rerouted the signals through the relays. The relay board is powered by a separate adapter, because the relay current caused a 5 mV drop on the 5V line. This caused the sensors to have a 1 bit error, which is unacceptable for the control algorithm.

Fridge circuit board with on-off switch and door switch. The 4 connectors on top are to 230V, to potmeter for fridge setting, from potmeter and to light bulb.

Relay board that switches the compressor and light bulb.

Schematic of the relay board. The door switch controls the relay directly and is an input for Arduino. The relays are switched with BS170 N-FET’s and have the necessary bypass diode for induction currents.

40 Comments

  1. Thos project looks great! Unfortunately the project pages seem to be behind htaccess and therefore out of reach atm. Maybe this is a temporary glitch?

    • Thanks for alerting me!

  2. Great project…I have started ordering components and was wondering what gauge wire you are using for the connections too and from the arduino?

    • I am using this, but I don’t think it really matters.

      I used a wider flat cable for the display.

  3. How have you dealt with compressor minimum on/off time limitations? I’ve heard something like 4-5 minutes minimum between cycles to avoid prematurely burning up your compressor. How long are your on/off cycles typically?

  4. hi, great project.
    i’am rebuild it, but i don’t understand the Pin Numbers of the OLED in your schematic. You numbered it from 1 to 9 my LCD has 1 to 16.
    Question: are the pgm changes smal to use 1Wire ( DS18s20) instead of LM 35.

    thanks

    • Hi Remo,

      I actually recommend using the DS18B20′s instead of the LM35′s. I will switch soon and update the project. You should replace the readTemperature(int pin) function in readSensors.pde to read the digital sensors instead of the analog ones. The filters don’t need to be as slow as they are now with the digital sensors, but you can leave them unchanged and it will work.

      The pin assignments for the LCD are:
      Arduino pins: 3, 4, 5, 6, 7, 8, 9
      LCD pins: rs, rw, enable, d4, d5, d6, d7

      When I receive my Raspberry Pi the project will get a big update.

      • thank you for the answer
        1. the lcd works. i changed the init values for a none OLED LCD
        2. do you have the code to change to 1-wire allready avaiable?

        thanks

        remo

        • Right now UberFridge is fermenting my Irish Coffee Stout. When that moves to secondary I will swap the LM35′s for DS18B20′s, update to Arduino 1.0 and update the repository.

      • Would the change be as simple as changing “int value = analogRead(sensorpin);” to “int value = digitalRead(sensorpin);” ?

        • Haha no, you need the DS18B20 library and OneWire library :)

          • I know you need the actual digital sensors, just trying to figure out what changes overall are required, i don’t want to build it only to find you release an update next week haha. And in regards to the circuit board itself would you then need to move the connections from A0/A1 to D0/D1 for digital reading?

          • You might want to wait a bit then, check this out: http://brewpi.com/survey/index.php?sid=72293&lang=en

          • That project looks awesome! I completed the survey and am definitely interested. However i already have a HP Micro Server next to my beer fridge and was going to just plug this project into it instead of a DDWRT router. I have the web interface and all the scripts ready to run, i am just after the arduino and electronics. I would still be interested in an all in one unit if us aussies can get our hands on a Rasbery Pi (not looking good).

          • Should be no problem to use your micro server. It’s just a web site and Python script, so it should run on almost any Linux box.

  5. Hi, i’m very impressed by the project so far and is thinking about duplicating it(but with some ds18b20 most likely). I got intrigued by the raspberry pi you mentioned, will it in some way be incorporated into the uberfridge or does it have other purposes?

    • I want to use a raspberry pi to run the python script and web interface and get rid of the router. Any Linux system will do, but the raspberry pi gives the most performance per buck. I want to keep the low level temperature control on the Arduino, because it will keep running when the operating system crashes.

  6. Hey Elco, fantastic project! I hope to find time to build one in the next year. One comment, I highly recommend replacing the analog LM35′s with digital DS18S20′s. Same package size, cheap, and can string a ton of them on a single digital pin. With these, you won’t have to worry about noise as you do with the analog sensors. Here’s the data sheet, and you can find these little guys easily online.
    Cheers, keep building great projects!
    http://datasheets.maxim-ic.com/en/ds/DS18S20.pdf

    • Thanks and I know about the DS18B20′s, I have them laying around and will swap the LM35′s before my next brew.

  7. Awesome. This is a great project, and thank you very much for being generous and making your code open source!

  8. Hello, again great project! I’m having a problem with the door switch. I have re built the circuit several times and this keeps happening. When the switch is in the closed position ( door open) the arduino board becomes super hot and the oled loses power. Do you have any idea where i should start troubleshooting

    • Hi Ryan,

      It sounds like your short circuiting the 5V voltage regulator on the Arduino board, or at least drawing way to much current from it.

      My first guess is: you replaced the transistor with a BJT transistor instead of a FET, but did not add a base resistor. FET’s are voltage driven and have a very high input impedance. A BJT is current driven and without a base transistor, the base-emitter current is not limited and can be over 1A. If you add a base resistor to limit this current, the transistor will still be fully open.

      Second guess:
      You put the diode in backwards. It’s purpose is to protect the transistor from back emf of the relay coil. It should conduct current for a very short moment after switching and should block in normal operation.

      Those are already pretty detailed guesses, because after building it a few times I suppose you have already ruled out the simple reasons. If it’s not one of those, let me know.

  9. Any update on the DS18B20′s?

    • Hi Darryn, sorry I have to let you wait this long. I am about to release a high power LED driver for ShiftPWM which takes up all my free time. I think I can find some time next week..

    • Hi Elco,

      Thanks for sharing this great project. I have my fridge just about completed, but like others here I am struggling to get the DS18B20′s working properly. Not to be pushy, but — any news yet? :) Thanks again!

      • Hi Ryan, I do have some news! Check this out: http://brewpi.com/survey/index.php?sid=72293&lang=en

        That is the reason you have been waiting so long. Sorry!

        • Hy Elco
          do you still working on the DS1920 implementation, because my fridge is waiting for controling.

          in the new project i’am verry intrested.
          thanks remo

  10. What relays (part number and/or specs) did you use to control the light and compressor? Do you know how much current your compressor motor draws?

    • I don’t know. I just used some relays I had lying around. I would just divide the compressor power by your mains voltage and take a relay that is rated a bit higher.

  11. Elco, nice project!

    I was wondering, did you consider controlling the expansion valve and the compressor rather than the compressor and the light bulb?

    I am considering this as a control centered experiment to run at a polytechnic as part of a measurement and control class…

    • I did not look into controlling the valve. I don’t think it is easy to get access to it, but I am not a fridge expert. Please enlighten me if you have an interesting idea for it.

  12. Chuck, fridge compressors don’t usually draw more than 2-3 amps, so a 5A relay would probably be plenty, but you can check, power requirements are usually given on a plate at the back of the fridge. You can buy ready-made relays for arduino from ebay which you just connect to a digital pin. I’m using 4 relays, 2 fridges, with heating and cooling so rather than having lots of wires, you can make it a one-wire device buy using a ds2408 chip, requiring just one cable.

  13. did you use any particular type of cable since it will be sitting in beer?

    also, where did you find the metallic covering for the temperature sensor?  I saw it in the demo video but didn’t see it mentioned anywhere else.

    *

    • I used a 3.5mm jack plug, cut off the jack and filled it with glue. But you can get DS18B20 sensors with a waterproof cable on eBay or at SparkFun.

  14. *Have anyone tweaked the code to make it work with a normal lcd and the ds18b20?

    • DS18B20 is coming up in the first release, probably next week. Will start debugging tomorrow.
      Normal LCD should be very similar. This LCD just had some specific requirements for the reset routine. It is an adoptation of the normal LiquidCrystal library for Arduino.

  15. Any updates for UberFridge with the DS18B20 sensors? It sounds like there are a few people looking for help with them. I currently have the whole fridge assembled and running with the exception of the sensors.

    If the code is no longer maintained, am I sort-of screwed? I can switch over to BrewPi but that would involve rebuilding the whole setup (it took a few weeks :P ). Can the BrewPi code be adapted for the “older” router setup?

    • I fixed all things that I thought where wrong with UberFridge in BrewPi, so I really recommend upgrading. You should be able to run all BrewPi code with your existing setup. You might need to make some changes to make it work with your hardware, but UberFridge will not be supported anymore, it’s not worth it. I won’t say you are screwed. You are getting the DS18B20 upgrade AND 10 other improvements ;)

  16. Thanks for the quick reply. :) I will try and move forward either to BrewPi or to back-porting the software to the router setup. Cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>