The last I need is yet another board without code, but I like to draft some PLC boards. This is a com adapter connecting the backbone to Ethernet and external RS-X lines. The code will be a variant of what I will make for the com adapter.
I have worked far to long with 19″ cabinets and things you mount from front, so what I am thinking is a micro-version of a rack system. We box each electronic module with a backbone plug and custom front connectors. We then plug them in, wire using standard wiring (that we probably have to create) in front – no wiring in the back.
These boxes are simple and can easily be printed on a 3D printer. They will also allow us to mount more electronics tighter to address the total size.
A classic PLC uses 2 wires for a 24V pulse signal – we can typically standardize these so that we apply standard, plug & play cables and avoid as much custom wiring as possible. The top front is after all for wiring to equipment, not for internal wiring that is already done in the back-plane. I think this can work, but I need to talk it through with professional automation engineers – luckily I have access to them in numbers.
One drawback I can see straight away is vibration. I was planning to make this so small that it could fit mobile Equipment, but mobile Equipment vibrate a lot. We will need an outer box and holding mechanism that tolerate very high vibration – or more correctly reduce vibration.
PLC (Programmable Logic Controllers) have been around for years. It usually is a modular system of electronic boxes with IO capabilities that can be assembled into a system for automation purposes. PLC have 5 “standard” languages that are not really that much standard. The standards tend to serve as minimum list of features, but as the vendors add much proprietary stuff the PLC applications end up being very proprietary. Plain have a much higher possibility of actually being portable.
A PLC system cost a lot of money, but as making custom electronics and writing code in C/C++ cost more the vendors get away with high pricing on electronics, tools and HMI. Also – the hard fact is that it is not much I can do with a professional PLC that I can’t do better, faster and with less cost using Arduino or Raspberry PI these days.
I have briefly mentioned HMI – I will return to that later. But, my Raspberry PI Hat’s and RS-X modules powered by Plain is an excellent PLC substitute. I do however fancy a more dedicated, modular system that can compete with classic PLC in a smaller space. My Hat’s are great, but it’s limited what I can create on the size of a Hat + the Raspberry PI is often not needed. I want to keep the option to add a RPI module with a Hat, but I want a new system.
Using Ethernet as backbone I would like to create a motherboard that control 4 x IO modules. Using RS-X as bus allows me to use the modules stand-alone or plugged them into a assembled system. Adding more motherboards I can scale up with 4+4+4+ modules as much as I have space. I believe I can do this on very small Space.
The major restriction I have on the Hat’s is connector space. I want to use standard connectors with standard cabling to avoid the need for custom cabling as much as possible. My “PLC” language will obviously be Plain.
What needs to be different from what I have done so far is Galvanic Isolation on all communication to limit the chain reaction if something backfires – because it will!
The added work-load on coding does not worry me because we can re-use things that I am in the process of creating anyway + I think this will be fun. 10 x 10 cm comes to mind as a size factor. It is easy to create modules that are 5 x 10, 10 x 5 or 10 x 10 to be mounted as part of the same system so it gives us freedom. It is also easy to create a 10×10 carrier module for Raspberry PI so a RPI+ Hat’s can become a module. But, I will look for standard, low cost project boxes before I decide on size.
It will be fun if nothing else and thats why I am here in the first place, so lets crack on with an open source, home made, low cost PLC system. My home is an excellent testing ground – assuming it don’t burn to the ground in the process 🙂
This board uses a LQFP48 because I needed more pins and it extended the size to 50 x 15 mm to get everything in. It contains 2 x Stepper Motor Drivers and 2 x end point connections. This can operate 2 x 5-wire or 4-wire stepper motors. I have not decided on MCU yet. I used STM32F103CB on the schematics, but I know that STM32F303Cx can be used and I will check if the same is the case for the M0 series in LQFP48 package. All of these MCU’s are an overkill for what we do here.
I target 28BYJ-48 or similar stepper motors that can operate on < 0.5A current. Having two steppers rather than one is because it often is required to operate two steppers in parallel. I use two ULN2003 drivers mounted back to back on each side, meaning I have 6 spare PWM signals and plenty of spare pins on the MCU. I only need to expand the PCB Space for Connectors to have a full 3-axis driver. This is just an early draft where I focused on size only, so will see where I go next.
The beauty with the RS-X based micro modules is that you can just add on modules by connecting them to the network and locate them as an extension of cabling on the robot or in your house etc. We still need a more intelligent unit like a Raspberry PI in centre, but it expands our scalability to easily build more complex systems.
I am quite found of these small boards so I reuse the MCU and RS485 interface on various designs. This one uses a ULN2003 to provide 7 PWM ports with up to 16V and 0,5A each. I use a 8 pin 1.27pitch connector. the 8th pin is V+, while the second row is all GND. This allows the board to be used for driving steppers, LED’s or small solenoid style actuators.
ULN2003 can actually handle 50V, but the regulator on the back is LM1117 that only handle 16V. I am actually only planning a 12V system so it will do.
These boards all have a 120 Ohm terminating resistor mounted. In real life this resistor will not be mounted as I expect to deploy a lot of these boards in the same RS-X network. This one is tagged for Christmas lights, but with two months to go I will need a bit of luck to get the PCB’s in time.
As you deploy RS485 (or CAN) on larger distances you will need to increase cable quality and lower baudrate. For 15 meter I don’t fuzz, I just twist a pair of cables and hook them up. A good advice is to have standard colours for A+ and B-. For better cable quality you can use a shielded solution like illustrated above.
Twisted pair Shielded cable is quite common and don’t cost to much. Just remember that the shield should be connected to ground only on one side of a cable to avoid creating a ground loop.
This is a simple, passive switch anyone can wire on a vero-board. It just connect 8 ports in parrallell. “GBA+” is easy to remember and means Ground, B(-), A(+) and Power. You use one port as input and 7 as output in a classic star network.
The only thing you need in addition are 120 Ohm terminators at the optional place. I introduced 120 Ohm terminators on every module, but I either need to not mount them or add a jumper. The same goes for this circuit as it need a 120Ohm resistor with a jumper.
The illustration above shows a classic star wiring using these switches. In reality you can cover quite some distance with only passive switches like this. I am not worried about short distances like 10-15 meters, but as the network gets longer we need to take more care.
Needless to say, this is 50 x 12mm in size and you can use the switch as a cable extender or T point as well. The mounting holes are M2.