PLC – 2xDC/Stepper/PWM

This is a very powerfully PWM Output Module with Encoder input. It is capable of 4 independant Half H-Bride, 2 x DC Motors or a full Stepper at 10A/24V. At least the electronics will manage a lot, but supply limitations and pin limitations means it will be a bit more limited, but yet. The primary usage is Stepper+encoder or DC Motor + encoder. The module also contains current sensor and i fully isolated.

The target motor shown below it is a small, powerfully DC Motor with a 90 degree hear and encoder that I want to try out on a 4×4 robot. This is low cost component and I believe it has sufficient torque and accuracy. Using a modular PLC concept I will then have a 4(5) slot box with 1 CAN port, 1 power input port, 1 DC motor with encoder and 1 Power Servo driver. I don’t need 4 channels PWM in this setting, but one option is to upgrade to a Nema17 based solution I tested earlier. Nema17 with 90 degree gear works, but it is a bit noisy + expensive. The connector is a 8 pin M12 using 4 pins to encoder and 4 PWM output channels.

My 3 slot CCU is overkill on this ECU, so I will make a single slot CAN port or maybe a 2 slot CAN + PSU – lets see. The PSU in this case will be a 18V 4AH battery.

PLC – Vibration concerns

Looking at my CCU board I have 4 components that are of concern related to vibrations! Top-Left I have a USB connector, but this is for development only so it will not be mounted in production. Top-Right I have DC/DC and connectors that might need support. And in the midle I have done a mistake as I added an old 32Khz crystal for RTC just because I had it in numbers – this is a hole through and the body/legs will be exposed – this I will replace with a SMD component. As for the connector and DC/DC I might need to add glue or supporting mass as I expect that long term exposure to vibration might cause issues.

The next question is if I can use a large speaker and create my own test bench for vibrations?

Problems and solutions

In my last entry I wrote about challenges with sizes on opto-couplers. I have since discovered  isolated digital IO modules with twice the density compared to opto couplers. They also offer 100Mbps speed and bi-directional solutions.

I recently used a version of this motor/gear with a Nema17 tor run the wheel on my mobile CNC machines and while it works fine it creates a problem : sound!

The printed plastic parts are hollow and a stepper motor vibrate a lot as it steps. This creates an unexpected load sound. The solution is a classic DC motor with an encoder (above) – I hope. Either that or see if I can mount some sound isolaters on the Nema17. I like the DC brush onces above thought because they are also smaller and more cost effective, the issue is if I have sufficient control of movement as with a Nema17. We will see.

Annoying Issue

One repetive issue I face is number of signals from MCU to/from IO that can be isolated. The the case below I want 7 digital signals and an isolated current sensor back, but I lack space for the 7th signal since one module is 25mm in width. One solution is to mount components on the back side, but I prefer to avoid that for a specific reason. Another solution is to make the isolation barrier different or simply ditch one of the signals… I am looking for opto couplers that use less width as well…

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.