Make an interface board to connect industrial controllers and FischerTechnic construction set - for education and fun!

Have you ever seen an industrial programmer? Those half-gods who write programs for PLCs (industrial controllers, in short) and turn lifeless heaps of relays, controllers, motors and sensors into working factories, pump stations and other industrial objects?

Those fortunate enough to see them doing their job probably wondered how they acquire their most vital trade skill - avoiding bugs in code. While a bug in code written by a conventional software developer could lead to system freeze-up or, worst case, loss of data, only one incorrect bit set by an industrial programmer in his code could send a gantry crane hook crashing into some really costly equipment (that's not a real-world example, I swear) or even harm people directly. Yeah, we all know that most mistakes in any equipment that interacts with outside world through something other than mouse and a keyboard do not come cheap.

The truth is, in most cases a newly hatched industrial programmer can't simply start working with real equipment. You have to let them either watch their experienced colleagues work for a while or train on something that's much cheaper and simpler than a factory, but at the same time emulates a manufacturing process.


Real-world automation

To understand how to make something that emulates the whole factory, let's start by looking at how it works in real world.

Each industrial object that employs automation aims to replace human labor, which is expensive and prone to errors, with control systems (cheap to use, quite pricey to buy and install) to operate equipment. To understand what's going on out there and react to it, we connect various sensors and actuators to our control system. In the heart of any industrial control system is one or more steel cabinets that hold all the power and control electronics. That's what a typical Siemens-based cabinet looks like:

Top part of the cabinet
... and the bottom part.

Out of this assorted bunch of hardware, what really matters in terms of programmer's education is presence of PLC. Some IDEs for industrial controllers offer simulators, but that's only good for simple POC code, not complex systems where number of used I/O ports can exceed 100.

That's what coding looks like in IDE for Siemens controllers called TIA Portal.

Oh, and quite obviously any PLC only works when it's powered up. Most frequently PLCs are powered from either AC mains or 24VDC (latter is an industry standart - that's why it's not 12 or 5V)

Sensors and actuators, from a programmer's standpoint, are divided into digital (0 and 1) and analog (0...MAX_VAL). There's lots and lots of different sensors and actuators out there, but what makes them useful to programmer is their involvement into manufacturing process.

Thus, this arrangement is more educational than just any optical sensor dangling from a wire and pointing anywhere:



Let's summarize what kind of equipment we need to hone industry involved programmer's skills:
  • Not prohibitively expensive - not any university can buy PLCs for each student in class, fewer still can provide them with expensive industry-grade sensors and actuators. As an alternative, there are some factory simulation software suites like Plant Simulation - they cost money too, besides, no program can be more visual and educational than a real piece of hardware in front of you.
  • Easy to fix if broken.
  • Involves a real PLC.
  • Sensors and actuators are embedded in some sort of manufacturing process.

Solution

Here's the solution they came up with in my university: real PLCs  in conjunction with toy control objects. FischerTechnic was the toy of choice: they conveniently offer these training models - ready-made control objects, essentially.
Controllers they bought for educational purposes

Some of our mock control objects - assembly line and robotic manipulator


FischerTechnics really make excellent sets for every conceivable purpose -  sets include motors for vehicles, air compressors, valves and pistons for pneumatic contraptions, all kinds of sensors:


All electric connections are made with a peculiar type of barrel connector. While it is easy to crimp (strip a wire, plug a wire into a barrel, tighten a screw) it's way too uncommon.
It should also be noted that of all this assortment, only switches are indifferent to voltage applied to them,  for the rest of them you need some kind of level shifting between 24V and 9V.

Now, I'm not the only one to try and tackle the problem of connecting toy contruction sets to industrial controllers (big surprise for me). While I managed to google 2 stores that sold relevant boards ( German store IKHDS here and Russian Pacpac here ), all ready-made solution seemed to lack one or 2 features I really needed.


Digital input interface board from IKHDS, nothing more that a board with connectors
Digital output interface board from PacPac. This one's even got LED indication! Still only four channels...

So, in order to solve this problem, I set out to make an interface board that could bridge the gap between an industrial controller and child's toy. I'll be sharing with you some build pictures of the 2 versions of this board, as well as Kicad files and BOMs for both of them.

Build (version) 1


Requirements for this board were determined by PLCs we bought - it was Siemens S7-1200 with 10 digital outputs, 14 digital inputs and 2 analog inputs (0-10V), enhanced by 1 analog output module (0-10V as well). People with microcontroller background will be surprised to learn that even though there are microcontrollers inside any PLC, PLCs themselves can only have ports that are either input or output, not both.

Since motors usually need to be operated in both directions, I arranged digital outputs in pairs in H-bridge set-up. Thus, any given pair of digital outputs can act as a driver for either 2 separate loads (valves, unidirectional motors etc.) or 1 bidirectional load such as a motor.

What did I use for Fischer barrel connectors? After hours of lurking through local shops and markets, I found something that easily accepted a Fischer barrel - 9mm hollow rivets for clothes:


Having bought a few of them, I tried to solder them and it turns out they are solderable (some metals like aluminum are a pain in the ass to solder with a conventional soldering iron+rosin+Pb solder) and conductive - a perfect match for my barrels!

Features of this version:
  • Can drive either 10 loads in ON-OFF mode or 5 loads in polarity-switch mode (or any combination of thereof e.g. 2 bidirectional motors + 6 valves). Voltage level on each output is 0-9V.
  • 14 digital inputs where you can connect a switch or a phototransistor.
  • 2 analog inputs with 10V power supply terminals.
  • 1 analog output configured as a 9V PWM signal.
  • All inputs and outputs have LED indication.
Here's some 3D renders of the first attempt:

Top side
Bottom side

It seemed good enough for a first try and I ordered 5 boards at PCBWay.com - i found it via PCB Shopper service. This service allows you to enter your board's specs and shows you how much it will cost in each fab house from quite an extensive list. I went for the cheapest this time and here's what the cheapest PCB 5-pack looks like:

They even add some tiny breadboards to your order for free!

Top side
Bottom side
Soldering everyting to your board costs extra money, besides, what kind of electronics enthusiast would voluntary relinquish the joys of hand-soldering each individual part? 😀

There's a couple of shots of soldered board (not finished yet though):

Top side
Bottom side
As usual, there were lots of bugs in this first revision of board. Some were due to my lack of attention while committing Gerbers to fab house (that's how I ended up without mounting holes in boards's corners - just forgot to save changes in layout), some due to blatant lack of knowledge in electronics. Anyway, someone had to fix that, that's why I had to reroute some stuff here and there, getting a Frankenstein PCB as a result:

That's a completely fixed PCB. Doesn't look as pristine as it did before, right?
Some morbid closeup shots:



I didn't even think about the fact that analog sensors needed 10 volts to have an output range 0..10V, that's why there's a 7805 on the bottom of all first revision boards now!


Eventually all 5 boards were ready to go into testing phase:

Yeah, for some reason I took a picture of 4 out of 5.
Board already hooked up to some assembly line

Quality control line to the left (sorts the mock wares into 2 chutes - good and reject)


Clothing rivets turned out to be a perfectly acceptable replacement for real connectors
I'm attaching Kicad files, PDF schematic and gerbers for this build. Some ugly stuff has been fixed in this revision, but the analog input part is still whack...

Preliminary second revision fixed most bugs in schematic, but then I had to convert the board to smaller relays and different connectors, therefore it's completely different layout, parts etc...

Preliminary second version of board before drastic changes, nothing from it survived but this 3D render.

Only grab this if you'd rather build a board with Fischer connectors - second revision of my board completely eliminates them. In this case you should look at rev.2 schematic (it's much better) and fix this revision.

Build 2 


Tester guys from university, apart from finding a couple of bugs in rev. 1, didn't like using barrel connectors at all. Wires kept falling out of them when people didn't tighten screws enough and snapping when they tried too hard. Oh, and they look way too bulky and outdated, so I've been asked to find a way to eliminate them altogether.

Here's what I managed to devise second time:

Rev. 2 rendered in Kicad
 Notice some vital features I added/changed:
  •  Barrel receptables dropped in favor of spring cage terminals - you can just plug the bare wire directly to the board now.
  • Separate fused connection for lamps (optocouplers need them to detect a broken beam of light when something passes a particular point on a conveyor for instance).
  • PTC fuses on each digital output - now careless freshmen can short-circuit anything they like without burning my board!
  • Silkscreen is more informative now - it's possible to assemble the board without its schematic as all the values are printed directly in silk. Now I can hand over the assembly part to undergrad students and rest assured they won't mess it up (or at least be more sure than usual...)
  • Smaller relays.
  • You can pick PWM voltage between 9 and 24V.
  • 10V output to power analog sensors.
  • Smoothing capacitors on 24V, 10V and 9V power rails.
  • Power indication on 9V input.
  • LEDs are surface mount now except 9V power indication.
  • Stand-offs were added around 40-pin and 10-pin IDC connectors to prevent board bending and snapping while plugging male connectors.
Now, some pictures of the build as usual...

Top side
Bottom side

Board were ordered from PCBWay again (I'm not affiliated with them, it's just they offered the cheapest quote for this revision of the board, too).

Top side
Bottom side with plastic standoffs

Even a couple of vanity shots. She looks beautiful, doesn't she?
  

Board being used - now connecting a peripheral device is as simple as pressing a terminal's fin with a screwdriver and plugging in your wire.



All 5 boards assembled and ready to go.

Here's the link to all the sources of this board.

A little extra


As a bonus, I designed this little contraption to mount my rev. 2 board on a DIN rail, which is an industry standard too BTW.


Now this can go in a real control cabinet together with PLCs and relays.
I'm feeling generous today with models any modeling newbie can design in a matter of minutes, so I'm sharing this too. It was made with Autodesk Inventor.

The result


I wouldn't start and proceed through this great undertaking if it wasn't for my overwhelming desire to see the fruits of my work.

Alma-mater used those boards not only to teach some bright minds to become undustry-affiliated programmers one day, but also to organize a region-wide contest in PLC programming.

I'll now indulge myself in uploading numerous pictures of my boards being used in this contest and in process of teaching. One picture is worth a thousand words, so what comes next could probably populate a skinny paperback book. 😀








Here's even a video:


Comments