Mechanical Relay Logic That Was Snubbed For A Microcontroller

[Alex] was tasked with a control design problem for a set of motors. The application called for the back of a truck to open up, some 3D scanning equipment to rise from its enclosure, and finally the equipment needed to rotate into place. All of this needed to happen with one flip of a switch, then proceed in reverse when the switch was turned off. We can understand why the final design used a microcontroller, but we also think that [Alex’s] relay logic circuit is an eloquent way of doing things.

He uses limiting switches as the feedback loop for the logic. In the video after the break he walks us through the schematic. Each of the three motors has an up and down limiting switch. These control the three relays which switch power to the motors. We like the design because interrupting the movement mid-operation provides no problem for the system. The only real issue we see is that relays wear out, and the automotive application of the hardware may cause this to happen more quickly than normal.

You may recognize the clear gears used in the demo. [Alex] previously showed us how he makes those.

27 thoughts on “Mechanical Relay Logic That Was Snubbed For A Microcontroller

    1. +1 too

      Very rare to see HaD championing elegant and thoughtful design rather than throwing arduinos at the problem.

      Also good points in Joshua’s comment below. I’d go for the relay solution every time for real-world survivability.

    1. If you really want to get clever, you can put em all in a box similar to the one the truck already has :)

      Heck, there might even be enough room for one to put them in the same box!

    2. As an intern, I built a calibration device from old gold-plated telecom relays, after being told repeatedly by an older engineer that it had to be done solid state – as relays would never hold up – and that he would create the unit using a variety of technologies.

      I had gotten stuck hand calibrating these beasts to test prototypes, and after the third one, I decided I could automate it. Permission to automate the process was refused.

      The device required an 12 step calibration curve, and although a D/A unit could have done it, it was easier to simply switch .1% resistors in and out of the circuit. This was done at three temperature ranges (cold, hot and room) and the resulting data normalized through a table of quadratic math – and turned out to be accurate enough to vastly outperform the competition.

      It was budgeted to cost $3000 and take a month-
      So I just built it in a few hours (you know, I needed a test rig to develop software on…), using $25 worth of junk and a stupid arduino forerunner that spoke BASIC.

      I calibrated about a 100 units before they got wise to the existence of the device. I was off one day and the tech standing in for me could only calibrate one unit in the time it took me to do 10. Being older and wiser, he was suspicious that my units were being shoddily calibrated, so he had an emergency meeting and they pulled as many of the units back as they could.

      Everyone of them exceeded specs by a factor of 10, and that’s how they caught on. The whole device fit into a little box the size of a small cooler, since that’s what I used. You need to precisely control temperatures of resistors to within 1 degree in order to get that kind of accuracy. And humans would have to make one measurement a second or more to keep up with me.

      After the come-to-jesus meeting, It became sanctioned by consensus and calibrated about 185,000 units and outlived the company. It didn’t help my relationship with that engineer much.

      1. That’s really too bad. Unfortunately you sometimes end up in a position where you have someone managing you who simply is not qualified for their job. It will happen more and more as you get better at what you do, but it will bother you less because there is still usually a reason they are there.

        Also, you should have patented that thing and contacted them through a salesman you hired and charge them 20 grand for the unit plus “service”. You wouldn’t believe how much this happens.

  1. I design movable bridge (AKA drawbridge) control systems like that all day, every day, though we sketch them out in ladder logic form. And even if we use PLCs, we still write the program in ladder logic. When you consider the capabilities of the electricians maintaining the bridge on a regular basis, along with vibration from passing trucks and surges from lightning strikes, relays start to look like a pretty good option. Oh yeah, and you can always find replacement relays, whereas PLCs go out of production after a while.

  2. i would have kept all the relays, but i would have used an “output relay” for each motor connection and had the logic running in small low current relays.

    that way you can see (with extra lights) if the logic+switches are bad or just an output relay (arcing from motor kickback)…

    and seperate fuses and power buses clearly indicates failure of motor (short) or failure of other parts (shorted/incorrect switch wires)

    just my two cents


  3. I am worried about the relays wearing out but I also worry about the limit switches failing to detect a limit has been reached.

    In which case, NOTHING will stop the mechanical motion from potentially ripping something apart. With a microcontroller, at least you can setup a watchdog timer to STOP the thing if a set time period elapses when the limit switch really should have been triggered, in order to limit damage to the unit and also alert the operator of an error state and or automatically shut it down.

    1. At a company I worked for, we had some large rotation jigs that were designed with that in mind. It had 2 sets of switches. One set was just plain stop switches. Then there were failsafe endstop switches that tripped a separate emergency stop circuit. If the endstop switches were ever hit, we were required to halt all use of the machine until maintainence could determine why the endstop switches were hit.

    2. execpt maybe a fuse… and a “cotter pin”

      cotter pins are used in lawnmowers for when you hit a big rock or curb, the cotter pin snaps and the motor keeps on operating (after being re-started of course)

      otherwise you get a mashed up (or shattered) cam-shaft and engine block (completely and utterly destroyed engine)

      but of course theres still a 0.1% chance you might eject a piston and the engine block might actually survive, assuming you dont get hit with the piston, in which case you wont be around to repair said engine ;)

      PS: i heard its technically possible to re-build an engine failed in such a way, but reboring and custom cutting pistons costs more then a new engine (wer talking lawnmower here), so its only for hobbyists or special casees

      1. It’s not a “cotter” pin. It’s a shear pin, or a shear key used to prevent damage. Cotter pins are used for secure pins, nuts, bolts, etc. against loosening from vibration.

    3. Two limit switched in series, staggered even. Use highly rated parts.

      If you’re using a uC/SCR, how would you mitigate the latch-up problem when every element in the circuit can (in practice) start in an unknown state?

  4. Controls engineer here. First, relays wear out, yes. Some after a million cycles or better. They’ll never wear out in an application like this. Second, with relay ladder logic, the programming is in wires, not and/or/xor gates, so no mucking around with voltage regulation, capacitance, voltage spikes, reverse voltage polarity breaking something delicate, no interface circuitry for large loads, bla bla bla. There’s a reason relays have been used in industrial automation for decades. Because they work, work well, and are simple (K.I.S.S.). And about the limit switch issue. Use a normally closed limit switch mounted in an interference position, and when you get to the stop point, the limit switch contacts WILL break. It’s called fail safe engineering. A good idea even if you are using a micro and can use a watchdog. Micros latch up. Relays suffer from contact weld. Pick your poison. In this instance, my money is on relays.

  5. For sheer reliability in this kind of application, relays every time. This is very similar if not identical to what custom car audio installers have used for years for motorization for amp racks, monitors, etc. No need for anything more complicated. Talk to any seasoned installer as far on the spot hacks and we can take care of most anything with what we’ve got laying in the shop of which, on the electronic side, are relays, diodes, resistors, and some capacitors. When a customer is breathing down your neck for a solution, you go with what experience tells you what will work. Just today, we had to slap together an AV switcher with 6 relays and a toggle switch. Tested with no noticeable loss in quality from either source. I have started to delve into microcontrollers but a bit slowly but I’ll never abandon the good old Bosch relay.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.