Now you're thinking with relays
lcamtuf.substack.com
lcamtuf.substack.com
For controls guys who had dealt with relays for most of their professional lives, that relay-oriented logic flow made sense. A typical computer science student's idea of boolean logic gates and procedural control flow just wasn't part of their lexicon.
We also offered a graphical, procedural programming language (imagine Scratch except it controls part of a factory). You could teach it to them, and they'd understand it, but many of them never used it. They just wanted relays.
Yes, the IEC 61131 languages. AWL is a crippled assembler language, ST is a crippled Pascal.
Industrial automation is for masochists. The usual explanation is that the PLCs need to be programmed by electricians without any college degree, but (a) are electricians not stupid and (b) would better languages not need to be more complicated.
Despite the masochism, it was a fun field to work in for a time. Since the industry demands these shitty esoteric programming languages, you end up with all these small companies writing their own compilers and runtimes. It's a unique opportunity to do real-life compiler development from the ground up.
Our experience was not that companies think electricians are stupid, but that they're electricians: they know electrical stuff, not computer programming. A ladder diagram is immediately recognizable to an electrician or technician who needs to diagnose an equipment failure and wasn't involved in writing the program.
FWIW if you're building something at a certain small scope ladder is perfectly serviceable.
Anywho, cool, robust, reliable things still got made, you just had to think differently. It was very interesting to think about those programs and their relative programming simplicity when compared to complex, modern C++ that is running in other codebases I've seen since then.
Sorry it’s desktop only for now. I never got around to figuring out how to make the drag and drop interface work well on mobile screens, although I’d love to.
Ladder logic is based on ladder control schematics. They were used for machine control circuits to present the circuit as a series of rungs running from left to right, the left side representing a connection to the control power supply hot or positive line and the right represented the control power supply return or negative. Each rung is a circuit that handles some logic. eg you have a laser machine with three doors and two access panels each holding a normally open switch closed to complete the circuit - when all the doors are closed the output is signal is high which you can use to ensure the doors are closed so no one gets melted. The sequence reads top to bottom so when you trouble shoot you walk down the steps checking each right hand output device and if it didn't work, work your ways backwards through the rung with a volt meter.
Way back I got to fix an old Marvell power feed metal cutting band saw. All relay logic and the saw would run one cycle, retract and do nothing. So I grabbed a meter and the ladder diagram and worked my way down until I found a rung with no output. Turns out the saw carriage return limit switch bracket came loose and the return switch was never pressed which would reset another rung to restart the cycle again.
> A typical computer science student's idea of boolean logic gates and procedural control flow just wasn't part of their lexicon.
Nonsense. I was exposed to industrial automation in high school where I was preparing to become an electrician via a robotic manufacturing system from eshed robotec. I really liked computers but was never interested in programming them at that point even though I knew some gw basic and the robots were programmed in basic. Then I wound up taking an AP c++ programming class and it clicked.
To me ladder is a great language and perfect for representing the boolean data flow through sensors and switches to visually group functions into rungs. It's so much faster to visually parse a rung vs a block of text. It's the default on every controller for a reason.
Though I'll say this: automation software sucks shit through a straw. So much of it was designed on Windows while riding the 90s OOP hype train. And the design by committee with languages and standards baked into iec/iso standards is depressing. 61131-3 defines a crappy Pascal like language called "structured text" but everyone bolts on their own oop extensions to the language in various proprietary ways. And you don't want to begin to fuck with the absolute dog shit Byzantine garbage fires that are PLC IDEs. They're so invasive that everyone in the biz runs then in VMs so they don't bork the OS.
You are 100% correct about the tooling being crap and ladder representation being useful as a visual mapping.
[0] https://library.automationdirect.com/wp-content/uploads/2013...
[1] https://multilinedesigns.com/wp-content/uploads/2018/02/IEC-...
I'm not against st or c or whatever, I've done control programs in all of them. To me, Debugging ladder is awesome as most IDEs give you a live view of the io state and it's great to sit the laptop or computer cart by the machine and begin pressing switches and wiggling wiring/connectors to see what is not working and the ladder contacts light up when they go high. Simple fast visual debugging.
We've incorporated some flow chart and ladder like io debug screens on our hmi's. Pop open the debug screen and see what isn't on and the association of inputs and the output condition they set. Mostly eliminates the need to drag around the computer.
They used relay logic because it's what they knew: some of them had backgrounds in industrial control. The small company I worked for sold single board computers and the group leader knew that there had to be a better, more modern method of building their simulators, so they asked to have someone sent down to educate them. That someone was me. I probably did a piss-poor job of it (no experience or aptitude for training at the time) but I hope it at least set them on the right path.
Weren’t early MIT based SWE also model railroaders? I think there is some connection there between model railroad switching, relays and logic.
1958 FACOM 128B Japanese Relay Computer - https://www.youtube.com/watch?v=_j544ELauus
The sound of that relay computer churning away dang
Now that I know what a relay is, I can't unhear it. When I plug in my EV for charging, I hear the solid click of a (probably quite large) relay. When my coffee maker cycles on or off, I hear a relay. I don't particularly like it.
edit: Replies have pointed out that they sometimes do "snap", so i guess i'm wrong there. I'm still pretty sure anything in a kettle/coffee pot/toaster etc would be a relay to avoid arcing
edit 2: i'm just going to shut up now
https://www.c3controls.com/white-paper/what-is-overload-prot...
Mouser (a general electric/electronic component distributor in the USA) has 'em on the shelf rated for 600 V, 50 A.
I'm sure that specialty distributors offer a much wider range.
You'd be wrong again. The Bi-Metal strip switches the current directly.
No small 100nF capacitors. Only a bulk 1uF and 10uF capacitor inches away. Very inefficient layout. Is that just a 10 Ohm resistor connected to a physical switch to control the backlight? DC-DC module? He's got a PCB on there already, it shouldn't be that much harder to slap down a Buck converter himself.
What size components are those? Far larger than 0805, they might actually be like 2012 (inch) components.
Good grief. I guess Microchip / Atmel chips are legendary for this reason: they always were considered braindead easy to boot. But this is the higher-end Cortex-M7 series chips, I'd imagine that you'd need at least a _bit_ more care with regards to decoupling and power-delivery to achieve reliability than what he did here!
No seriously. A 300MHz processor with _NO_ local decoupling capacitors? Is he mad?
------------
But then again, I guess there's something to be said about making a board "easier" and through less effort. I guess there's no reason to be a masochist with 0603 (or smaller) parts when prototyping.
Also the device worked even when it was on a breadboard, suggesting he made reasonable technical decisions regarding placebo capacitors.
This other post (https://lcamtuf.substack.com/p/mcu-land-part-3-baby-steps-wi...) has more information with his experiments with SAMS70, suggesting experimentation with a breakout board. So same same overall but...
He's upgraded to the SAMS70 which is 300MHz. Its a totally different class of processor.
> Also the device worked even when it was on a breadboard, suggesting he made reasonable technical decisions regarding placebo capacitors.
I dunno. PDN (power-delivery network) issues are really complex. You solve a lot of headaches with a 1-penny 100nF capacitor here and there.
I'm very curious what the SAMS70's onboard capacitance is. I'm wondering if Microchip/Atmel goes overboard on onboard capacitance or something.
In any case: the documentation from Microchip is clear about this. 100nF capacitors on every input pin. I don't see any reason to stray from this, its not like 100nF capacitors are expensive, or even difficult to solder.
The DC-DC module also seems like a sensible choice for hand assembly. These things cost about a buck or two these days.
This board is clearly meant to display the electronic components in plain view and be easy to solder at home.
The Microchip documentation for the SAMS70 literally recommends 15x 100nF capacitors, as well as a 4.7uF capacitor for the buck converter, and a second 4.7uF bulk decoupling capacitor.
That's 17x capacitors if you're just following the manufacturer's recommendation.
https://onlinedocs.microchip.com/oxy/GUID-174CB4CE-C435-49E8...
The board as shown in that blog has ZERO of them. Madness. Each 100nF capacitor "should" be directly adjacent to the power-pin its decoupling, fractions of a mm away. And to make sure there's enough room for everything to go on (fractions of a mm is very small), you want to use 0603, or 0402, or smaller parts just for convenience.
But 0603 is already troublesome for hand-placing IMO. (though the even smaller 0402 is still possible in my experience). So as I said, it starts to get masochistic with these sizes IMO. But still, I'd personally try to get at least a decoupling capacitor on each power-pin as the documents recommend (even if its a larger 0805 or bigger).
In any case, the ~4 capacitors that he places is very much on the low-end compared to the ~17 recommended.
-------------
> They are more cost-efficient, but they're more work to solder by hand.
These are all surface mount parts, which means you're soldering using frying-pan and/or toaster-oven at this point.
Or at least, you _SHOULD_ be doing that (or maybe get a real hotplate, lol. But my pancake electric griddle works perfect). Its way more convenient.
You apply the solder paste. Then you drop the capacitor into place with tweezers, and the solder-paste is sticky enough to "grab" the capacitor. You then place all other components. Easy-peasy.
Heat the entire board to 330F (assuming low-melt lead-free solder) using the frying pan for 10-seconds and done. Some people like adding a 1/4" aluminum plate to make the heat more consistently applied.
Components are designed for 500F for 10 seconds btw (aka: standard lead-free solder). So you have a lot of leeway with regards to the frying pan method in practice. But you should keep a strict timer as some parts are really sensitive to that "for 10 seconds" requirement. A proper reflow oven and/or hotplate obviously does the job better with automatic controls, but this is all slow enough that you can do it by hand by just turning the dial up/down with a stopwatch in your hands.
If you want more household relays to notice, it's common to find them in digital thermostats for central HVAC control signaling. I've also found them inside of ovens, and cars also have lots of them for things like the starter and headlights (although maybe not the latter in newer cars.)
So, they have bigger contacts to handle the current and strong springs and a powerful solenoid to open/close the contacts quickly and extinguish an arc before it has time to melt anything.
The noise you're hearing is from the contacts opening and closing.
It's like the difference between a pickup truck with a ball hitch & a class 8 semi-truck with a fifth wheel coupling for a 53' trailer. Both are just vehicles that tow a trailer, but the physical details of how they do that are different in important ways.
Now I'll never be able to unhear it either!
There is a type of logic using Micromachined Silicon cantilever switches, operated by static voltages, capable of operation for sustained periods. They don't seem to have achieved fully non-volatile operation, but you can spend a lot of money to have a relay of this type, if you want.[1]
At one point I was hopeful this would replace relay logic, and be even lower power than CMOS.
i.e. https://www.digikey.com/en/products/filter/signal-relays-up-... has 811 hits.
According to the datasheets:
Typical applications Industrial sewing/stitching machines, fitness, elevators, pumps, robotics, solar panels
I wonder if optical or solid state relays can speed it up, at least if normally closed ones exist
So the 4K memory is on a chip, right? (understandable!)
Just kidding. Maybe Game of Life ? Minimal arithmetic
You could make an awesome sorting demonstrator with it where the data items themselves move around in the memory.
Also just so nobody misses it in the description, there's a whole page with many photos and an additional 1 hour video going into more details than the video on YouTube: http://web.cecs.pdx.edu/~harry/Relay/index.html
I also added an LED board that was an array of LEDs, one LED per relay, attached to it's coil. This way you could see the states of the calculator flash by as it computed, akin to those old blinking button boards of retro sci-fi. Really neat project!
https://hackaday.com/2017/09/18/single-board-relay-computer/
I especially like that it has some relay outputs so you can short basically any electrical item, possibly even an AC mains cable :) and it has numerous inputs and LED display of the internal program counter. I even spent a few hours making a simple drum machine in it once!
When I was younger straight out of college I designed a digital clock that was relay-based. I made a 0-16 counter circuit on one board and a 10-reset circuit on another board. I didn't have 4 pole relays, just 2 pole, but I did try to make use of a mix of normally open (N.O.) and normally closed (N.C.) to keep the parts count low. The binary-to-7 segment logic was to be implemented using a diode ROM.
I had the same idea about using clear relays--so you could see the parts working, but I couldn't find those at the local electrics shop, so I instead just took the plastic housings off of standard relays.
You can have all the puzzley fun of it without any soldering etc.
If you want to design boards with curved traces, paying several hundred bucks for DipTrace is almost certainly a better route.