Friday, December 30, 2016

More Adventures With My Freezer

Last post I described how I managed to screw up my freezer defrost controller <link>. This is the latest chapter in that escapade.

I started up Eagle and created a board to hold a higher power relay and XBee to overcome the problems with the small relays that are generally available for Arduinos. The board got overly complicated and the cost of the various parts got to the point where it was just silly to continue. Then I got a brainstorm: why not just use a relay board as a module similar to what I did with the XBee.

I started up Eagle again and took that tactic; it worked really well --- at least on paper. Here's the schematic I came up with:

For those of you that aren't used to Eagle schematics, each of the signal lines has a name and you just match up the names to see where things hook together. It makes for a really simple looking schematic that is a bit hard to follow. The idea is that the set of plugs on the right are the pins on an Arduino, the two modules in the middle are an XBee and a relay module that is readily available all over the place:
These little boards are available for less than $5.00 and can handle motors. It should be exactly what I need for this project. Where I ran into trouble was all the parts necessary to support one of the relays. Things like buffer transistors, optoisolators, LEDs and such are a real pain to keep stock of and you can't really order just a couple. I'd have parts piled all over the place if I tried to build up everything necessary; so I took the easy way out and just mounted the relay on a board I designed along with the pins for the temperature sensor, XBee, some lights and some buttons. Basically, my new board would be a holding device for the stuff I needed for this project.

Cool huh? This is the board layout I came up with:

I added some LEDs at the front of the board so I could see that it was alive at a glance, matched holes on the board to the holes on the relay module and added a couple of buttons to control reset and defrost for testing. Heck, I even put a Saguaro cactus on it as a kind of indicator that it was designed by me.

I sent the gerber files to Seeed Fusion because I haven't used them before. About 4 weeks later the boards arrived. I say boards because you get 10 of them for the same price, but the shipping was high. To offset the shipping I included the rest of the temperature sensors I need for my house monitoring project. So, for around $38 I got ten of the defrost controller boards and ten more of the room sensor boards for later.

Here's what the boards look like:

I chose yellow because I've never messed with a yellow board before. I labeled every stinking thing because I can't ever remember where stuff goes after a few weeks of not looking at it. I also stuck the LEDs on the front of the board so they could be seen by peeking through a vent area on the freezer. My way of showing off that I modified the freezer.

Here's the board assembled:

I pulled the screw connectors for the digital signals off the board and replaced them with pins so I could plug the relay module into the board. I bent the LEDs over for that day when I actually make an enclosure for the board. I used Arduino-like pins for connecting to an Arduino, but that was a mistake. Somehow I thought I might someday mount something above this board. Notice that's not possible. Oh well, they may serve as test points some day.

Here it is mounted to the Arduino:

Yep, it's bigger than the Arduino. I considered using one of the really tiny Arduino devices and just having a board that connects the various modules together, but decided to just use what I already had. It won't matter when I get it into an enclosure because only the wires going in and the LEDs will be visible.

I powered it up and everything worked first try. Amazing. I actually got something like this to work without another hitch.

Some tricks you can use if you decide to do something like this: Print the board on paper and try the various parts on the paper. This is how I managed to get the holes for mounting the relay module in the right spot. First I measured them as close as I could, then I printed the board and put the module on top of it to be sure the holes lined up correctly; they didn't. I was a tenth of an inch off. A little moving of stuff and they lined up perfectly. I did the same thing for the pins for the digital signals to the relay module also. I used the same technique to be sure the Arduino pins lined up as well. When I got the boards in I was almost afraid to try it out for real, but it worked perfectly.

Lining up something like this is a real pain, but using the printed version of the board takes almost all of the anxiety out of the process. Another trick is to label every thing in sight. The values of the components, the direction things point, which way a diode goes in, these are the things you forget while you wait for the board to arrive. Just label them in the silk screen so you don't have to wonder what goes in that hole and which way it points.

This is the third board I've had made for one of my projects and I think I'll do more over time. It's just too easy to mess up a tiny wire from one component to another and it makes the end result very fragile. The other thing I learned is just using the inexpensive components that are available to us for projects. I could use multiple relay modules like this in a project and have a board made to mount and wire all of them making the end result pretty and easier to work with. It should make troubleshooting easier as well; I won't have to follow a wire from place to place to see what went wrong.

Now to install it and watch it work for a while. I also have to figure out what to do with the other nine boards I don't really need.

Edit: After it was installed and tested once, it failed. Seems the relay wouldn't close; it got the signal to close just fine, but the relay just wouldn't activate. I chased the problem to the power line going from the wall wart to the Arduino, and changing that cord fixed the problem.

A lot of us have encountered this problem. We get a USB cable from somewhere and they use tiny wires that can't even carry a half amp three feet; it can drive you nuts trying to troubleshoot the problem because it looks just fine until you try to drive a relay or a set of LEDs. When you try and pull power, the voltage drop through the cable shuts things down.

Anyway, it's working just fine now and the stupid cable has been labeled so I'll know next time.


  1. Dave, you know of course, since you didn't label which direction the Xbee is to be inserted (unless that straight line across the headers is your orientation marker), a few months/years from now you're gonna put one in backwards :) I've had to update more than a few PCB's with a Sharpie to keep me from repeating a mistake.

    1. Actually, I did ... sorta. There's a line representing one flat side and a shorter line for the sort of pointed end where the antenna is. Where I messed it up is that the short line runs right across the 4.7K resistor for the temp sensor.

      I suspect I'll forget that in a year or so.

  2. Keep up the great work Dave.
    I just passed on your site to a guy in Australia (ForwardComputing).
    I admire your enthusiasm.
    I really must get to grips with Eagle, then the XY ink etch resist and drill machine. No time for crossword puzzles. This is one great hobby.
    All the best from the UK

    1. I (very) briefly thought about making the board myself. Naw, just send off for it.

  3. Hey Dave....
    Are you still there? We miss you! ..guy from TX

    1. Yep, I'm still alive. I've gotten myself stuck though; started so many projects and have a literal ton of things going on around the house that I can't actually accomplish anything. I just keep wandering from one part of something to part of something else never actually accomplishing anything.

      We've all been there.

      One of the things I did to force me to actually finish something was I forbade myself from getting a 3D printer until I:

      1) had enough reward points on my credit card to buy it.
      2) finished a particular set of projects around the house.

      I've got the points now and only one project left on the list, so that may happen soon.

      I've been working on the big tractor on and off for months. It actually works pretty well, but the list of projects for it to do, once all the pieces work well and don't leak all over the place, is pretty long. It also has been eating up a lot of money for parts and such.

      So, things like fixing the roof on the trailer, hunting down a hydraulic leak, pulling weeds from around the trees, waging war on woodpeckers, really don't make for a good blog entry...

      I have managed to keep the spam off the blog though. Man that's a pain. I get several spam comments a day sometimes. Darn bots.

  4. It was such an amazing post and I really enjoyed reading this. Keep sharing in future also.