Mobile PLC – CCU

CCU (Central Control Unit) is the name I give units that contain the core “brain” and only communication IO. The module below is an example of the core of a CCU with 3 external CAN ports, 8 internal module ports and 2 external Links. This is a fast MCU with a decent amount of speed, SRAM and Flash + it has it’s own SPI Flash + a USB for debug only. The CAN ports are standard M12-5 A Code and wired according to a de-factor standard. These will be used for CAN and for RS485. Possible I can use B or D-code for RS485.

Links can be used for modules as well, but they are designed to be links to different CCU’s allowing them to be connected in series to extend the CCU or linked up as a redundant unit. The unit above takes 5V in, so it is dependant on a 24V PSU unit.

The board above can be used alone or connected to a range of IO modules with different capabilities to form a larger CCU or even a ECU (Electronic Control Unit). A system will usually have one CCU and multiple ECU’s, actuators and sensors. As a rule we use CAN on everything and only RS485 or Ethernet as an exception. We can also use RS232 and other techniques as needed.

Each module is 70x25mm in size. The CPU module occupy 3 slots and each module can occupy as many slots as needed + they can double length to 140mm or even larger with special cabinets. The core is small project boxes that can be filled with modules as per need to form a custom PLC.

I use the term “PLC” because a modern PLC is mostly the same as above with specialized SW. My PLC languages will include C++, C#, Rust and Python + it will be supported by BSA. In reality I will be coding drivers in C++ and logic in PLD, but that is my choises – it should not limit you. The objctives is small size, plug and play and low development cost. In short you pay a few bucks for a few HW units, connect them together and will be up running in no time with a prototype or completed project.

This block diagram illustrate a CCU. A minimal CCU is only PSU + CPU module with 3 x CAN. A maximized box can contain up to 8 modules and as the MCU itself can act as a module it is basically no limit on how much you can put into a box.

CCU – Central Control Unit. Basically system level logic and communication.

ECU – Electronic Control Unit. Basically a box with a CAN connected to a CCU controlling electronics directly.

Servo Position Feedback

As we move a servo it would be more than nice to have a position feedback! The servo itself have a potentiometer telling the absolute position, but a standard Servo only have a 3 pin interface Power and Position setting – it gives no feedback. This is a common issue with many available actuators – lack of feedback.

In my case I want to use a power servo to turn four wheels and without position feedback I will be part blind as I drive. Or am I? I do not have the actuator position, but I have current feedback and know that high current usage is an error situation. Secondly I have GPS, accelerometers, magnetometers that will tell me if the vehicle is moving as expected then I drive.

That said – I am considering adding position feedback on the steering as well, but I will return to that later.

BSA Power Servo

Creating a module that can control a PowerServo is fine, but what about using it from BSA? What do we need to do? From a user perspective very little. In this example I just created a PLD State Diagram block with 3 input methods and one output method. It is this simple once the underlaying library is set up. It is simple and fast.

Comparing to some classic PLC systems BSA is a dream to work with in development speed, but BSA target far more than these old systems as well.

The only limitation in this case has to do with the servo – normal servoes allows you to set a position, but they give no feedback as to what the actual position is. You do however get the current usage as feedback and we know that if current usage is high it means the servo struggle to reach or hold the set position – this is thanks to the added current sensor on the servo modul.

In a final version we just add the servo modul as a library component that will pop up at left as if it was a build in tool. As we code we will drag lets say 4 servoes into a diagram and code their behaviour. As we deploy the code we need to associate those 4 servo blocks with physical servoes in the config. The servo modules will pop up as unallocated resources and we just need to tell the system what component they are in our diagram. The rest is magic plug & play.

PLC Power Servo

I am quite found of using 60 to 150Kg Servo units, but driving those units is an issue as I need a RF Signal and a 12V PSU capable of 5A. The example board below contains a separate DC/DC so I can deliver 8V and 12V with a single cable for those larger servo’es – it also contains an on/off switch and current sensor so I can monitor how they behave.

As always in this new series of modules – full galvanic isolation. The picture below (borrowed from AliExpress) show  typical target servo. These are a bit difficult to drive if you have several of them as a they use a bit of current and the worst one is as you switch power on. With the driver board above I can create a start sequence and monitor their power usage. The module can be used on smaller Servo’s needing 5V as well.

PLC Main Module

The “Main” or Central Computer if you like is basically a large MCU with 3 x CAN ports and 10 x Modul links. It only need a 5V PSU and can be used stand-alone or combined with other modules to form a larger entity. The central computer controls the entire system of both internal and external units. This board is a big waste land as the modul size dictate the actual size. I might add more to this board later.

The 10 connectors at right are communication links to modules and to an redundant unit if redundancy is required.

PLC Power Modul

This is the 24V power modul. It uses a 3rd party isolated DC/DC to support 24V “as is” and 5V isolated. It has protective diodes and capacitance for the 24V side. I could have needed more connectors for power distribution, but these boards are very small. As this is a PLC design we use. This should work on 12-24V and should be fine on the 18V batteries I use.

The remaining challenge is that the next modul is a Power Servo that require 8V or 12V depending on model. Even small, miniature Servo’s are a pain to switch on so these bigs ones will be a real issue. Learning from experience I believe it is wise to have a On/Off on the power to each servo as well as a current sensor and monitoring – which means I need to involve a MCU to do power management. This is all doable, but it add complexity/size.

The Power Modul above is the same as on the top, but without the isolated modul and with less internal power connectors. I can replace the Waterproof connector with an internal connector on 24V and adjust voltage out from 5 to 22V with 5A in peak, continious current. The DC/DC have a on/off switch, so all I need is to add a current sensor and an internal connector to a MCU board monitoring the PSU. This was a quick draft, so the modul is not ready. One issue here is that I use the same connectors for multiple things – that is OK’ich as we use TTL (5V), but it is very bad then we mix 5V, 8V, 12V and 24V – så I need to deal with that by using different connectors that cannot be intermixed by accident.

Protecting PSU’s from Motors are a big issue. I believe that the best protection is if the PSU have a fast, analogue trip that disconnect the PSU on over-voltage and -current. I can do thos in SW, but in this case I would like a analogue HW trip that need to be switched back on by SW. SW will be to slow for switching off. A misbehaving motor controller will typically trip and release the motor causing a break that release energy back on the 24V. This often result in a pulse that can break a few things. The PSU itself is the worst because as currend drop from xx to 0 it jump up in Voltage and uses a few “cycles” before it regulate it’s output at the same time as the Motor or coils misbehave. This needs to b experimental, but I think it will make the system safer.

PLC Ethernet Modul

Picture below is an Ethernet modul. It connect to the PLC on the left side and have a waterproof Ethernet connector on the right side. Again I have replaced the SWD connector at left bottom with TC2030. I don’t expect to be using so many of these since CAN/CAN-FD is the primary link technology, but having Ethernet capability is a must.

The connector used is a M12 waterproof connector. I was considering using GX16, but decided not to due to lack of IP67 support + M12 have more combinations and is a bit smaller as a GX16 uses ca 8 mm more PCB space.

New Modular Control System

I have done several experimental modular control systems that was scalable, small in size and based on MCU’s. My first experiment was with Basic PI Hats and I later did a smaller, modular system illustrated below. The system below was actually a great success. Specially the keyed connectors worked well. What did not work so well was the size, components on both sides, mixture of CAN/RS485, lack of galvanic isolation and lack of waterproof design. Using this on a mobile vehicle proved to be a challenge as I needed to create a larger, waterproof box around the cards. It become clear that I needed to address these issues and modify the system a bit.

The first change was to avoid duplication of CAN/RS485.

The second change was to replace LQFP64 with LQFP48 on MCU for the smallest modules.

The third change was full galvanic issolation on everything.

The fourth change was waterproof connectors and waterproof box design. Rather than using a random box I create my own.

The fifth change was to avoid two PCB’s on top of each other to get a lower design and avoid extra PCB assembly cost.

The result is still work in progress, but it is a flat, small, modular, waterproof control system that I can just mount directly on any vehicle and connect with plug & play cabling. The project boxes will vary and the Powerpoint illustration below is only a concept draft. The box is flat with connectors on two sides and mounting brackets on the others. Boxes can be designed to fit content – number of modules. The idea is that you have minimum wiring and only use communication & power until you are close to the actuator/sensor.

I divide units into two categories : CCU (Central Control Unit) and ECU (Electronic Control Unit). CCU is basically the core of a system, while ECU interface actuators and sensors.

My main challenge so far has been to decide on size, design and connectors. The module below illustrate the challenge:

This example module is 25 x 70mm in size and contains MCU, PWM channels, full galvanic isolation and waterproof connector so it can be connected directly to the panel wall. As you can see space is an issue. In my previous experiment I put components on both sides, but I decided to use only one side this time. One argument is lower assembly cost, but more important is the cooling system that the modules mount on to.

Someone will also notice that I have replaced the SWD connector I have used for years with a minimum TC2030 connector (left bottom corner J2). The cable cost ca 50.- USD, but as you have no component on the PCB it saves cost. I have seen these in use, but I have no previous experience with them myself yet.

GX16-8 Footprint and 3D

I created the footprint for GX16-8 and updated the 3D with a few details. I will see if I can add the thread as well. I quite like these connectors, but I am a bit concerned that I only find them on one source on Aliexpress + I realized that these connectors have a different pin position than the “normal” ones. The later means I have no source for waterproof plugs as is. We will see what I do, but I will stick with these for now.

Below is an example of GX16-8 in use on an Ethernet module. The 3D model only lack the threads, but I will see if I can add those. These pictures are from KiCAD and the way I have set the projects up means I do a change, press a few update buttons and voila. And as said earlier – a 3D package on a electronic part don’t need to be perfect as long as the importamt parts are correct. FreeCAD and KiCAD both require some training and patience, but they both work great.