Category Archives: PLC

Micro PLC – New format

These are just drawings of my new Micro PLC formats. I am considering 20x50mm, 30x50mm and 50x50mm formats. This discussion started as I received my previous PLC bus design and realized the actual size of it. The reality is that I need things much, much smaller and having a big backbone bus is very expensive.

As I accidentally made some 20×50 boards and by pure accident stacked them together I also make the observation that it would be easy to actually use that format as I can fit a stack almost everywhere, But, ok – 20×50 is a bit tight, so maybe 30×50, 40×50 or 50×50? Or maybe all of them as per need?

The way I want to stack them is with a bus cable and connectors. This way I can create a stack or simply mount them Distributed.

New Micro PLC design

I have done a few PLC system drafts – one based on Raspberry PI, a second larger one and a 3rd based on distributed components. The pure PLC system was “ok”, but it was a bit larger with the bus than I expected. Looking at some of my 50x20mm designs I wanted to try a 50 x 50 mm design where we plug in a CAN/RS485 bus. The objective is to make a component based system that is very small.

The idea for this came as I stacked my CANUsb adapter and small motor controller (50x20mm) together for fun – I might even use that small format, but I think 50×50 is better. Worth a try.

As

PLC Assembled – 1st test

Been a lot of motor controllers lately so I finally decided to assemble part of my PLC system. What you see here is the motherboard with a simple RS-X module connected. Not all components are assembled yet, but processor is alive. This board have 3 x fully galvanic isolated RS485 circuits and a 2 x 10Mbps backbone. It was selected because it’s a good, simple starting point for SW development.

The STM32F405RG is excellent for Plain. With it’s 1Mb Flash and 196Kb SRAM it is an excellent test bench. I need to make a similar module for CAN, but that can wait.

I must admit it is a bit of nostalgia to work with something that looks like one of the computers I assembled in the 80ts.

I only ordered one module because I want to play with the mechanical design a bit before I start adding modules. I notice far more issues with a physical module than with a 3D module.

The MCU is currently ticking on 8Mhz using the internal RC, so it will be interesting to see if I got this right and are able to tick the MCU at 168Mhz with 3 x 180Mhz DC/DC converters on the same module.

PLC – 24 Channel PWM Driver

This show DRV8313 used as a PWM driver on a PLC Module. This way I can get from 12 to 24 PWM channels with up to 60V @ 2A each. This gives an insane combination of 8 x BLDC Motors, 6 stepper motors, 12 DC Motors and 24 Solenoids. I need to think about this one.

In comparison with my previous module with 8 channels this will be limited to 2A, while the other can support far higher currents. But, the reality is that most stuff is below 2A and this is far more usable (assuming we can put on 6-8 x DRV8313). I do however have a problem with 24 current sensors, so I probably need to install a current sensor on the board or one per DRV8313 – lets see. I am not sure I want to make this module, but I admit that it is very tempting.

Just a quick mockup of a PCB with main components and possible connectors just to illustrate that this is very possible. Another option is that I add 12 PWM channels at top and 16 or so Analogue channels at bottom on a combined card.

PLC-PWM Module

This is an old PWM Module drawing. The idea is to create a PLC module that can handle 4,6 or 8 PWM channels with 12/24V and up to 3A. I know from testing of MC4X15A that this is very doable as soon as I solve the current sensor on the channels.

The usage here is to drive solenoids, dc-motors, even stepper motors. An old hydraulic actuator will typically be driven by 2 x 24V PWM signals pulsing at very slow rates using ca 1A per channel. And yes, I can drive 2 x 3 phase motors as well since I will be using the 2 Advanced timers With 4 PWM channels each. Using the same design as on MC4X15A I actually have an option for higher currents, but this needs to come from a singlle PSU Source and I believe a max rating of 10A in total is reasonable and doable. For higher currents we need to consider specialized designs. 

I have a few advantages compared to the motor controller as I have no usage of the BEMF signal and “only” need 8 PWM signals and 8 ADC signals as interface. IR2103 can combine H&L since L input is inverted and as such be driven by a single PWM pulse. I am, not able to offer 5V PWM since the gate drivers and MOSFET design requires a minimum of 10-12V to work.  

Another advantage is that 12 & 24V is provided directly on the backbone, so I don’t need any PSU logic on the Board (except a bit of protection logic). I need to look into routing Power from the backbone to the MOSFET’s and I need to squeeze each channel into 40mm x 6mm to achieve 8. But, it’s no disaster if I reduce to 4 channels. In fact I actually consider making the PWM channel an click-on sub-board – not sure.

I will start on this as soon as I have a solution to current sensing that I like. The advantage with the PLC is that we also have 5V available and loads of the attractive sensor chips need 5V. One I would like to test is MAX9918 because it can handle -20 – +75 Voltage making it attractive for a 60V BLDC Controller later. But, I have not given up on the INA210, INA213, INA214 family yet. The INA family is ranged 26V so they are attractive for a 24V design. Their size is a pain in manual assembling, but it is a blessing in design – if I can get them to work.

The interesting part here is that we take the driver from a BLDC motor, simplify it and re-use it. The result is a very advanced and capable PWM channel.

PLC – Connectivity Module

Still an early draft, but show the 8 RS-485 connectors at top/bottom. I only use right angle headers in the 3D, but they are 2.54 pich so they can be replaced with other connectors.

I still have a few loose ends. RS485 circuit can be switched off into 3-state by setting RE High and DE Low (Neither receiving or sending). I need a similar way for the ESP32 to switch off the STM32F405RG so we can go low power. I also want a 3.7V Battery connected on the back.

I should have plenty with spare pins so we can add a few more leds etc. I do however need to solder up a RS485 (or find a breakout) and test that I can get UARTS where I want on ESP32.

PLC – Connectors Top/Bottom

This new Connectivity Module have 8 x RS485 connectors. I use the front for the antenna and USB, while top/bottom for connectors that most likely will be permanently wired.

Some users would probably request both 4-wire RS422 and RS232 and I will make a board for those later. I also need a CAN board.

As for MCU power – The MCU’s above have too much/too little. For most of the things I do they are an absolute overkill. The exception is math algorithm’s where we would need the stronger Raspberry PI. The only reason I need the STM32F405 here is because of it’s 2x10Mbps UART’s used as backbone.

Just for the record – the 3D model above is just an early draft to illustrate our options. I use those right angle headers on the 3D model, but the real can be fitted with a variety of 2.54 pitch connectors.

PLC System

 

One of the challenges I have is the size of connectors in front of the modules. I am actually considering using Top and Bottom on the modules to increase connector space. Another issue is that the screw connectors used on the RS485 board below is not really operational from front alone. Looking at the Servo Controller I could probably add another 16 inputs of which many would be analogue.

The GSM Module above can go as is. I am however considering replacing both SIM808, W5500 and Raspberry PI. SIM808 was chosen because it has digital voice interface, but it also cost 10.- USD and occupy a lot of space. W5500 and Raspberry PI can be replaced with ESP32.

 

PLC-Connectivity Module

This draft will give me 6 (8) RS-X ports. 6 if I use the backbone and 8 if I use this stand-alone. In addition Ethernet, Wifi and Bluetooth as well as USB.

RS-X Port is 4 pins with 12V and RS485 differential signalling. Basically it feeds 12V Power to the RS-X devices. I like playing with this idea a bit. This would be a very interesting RS-X router. It’s Wifi/RS-X capability makes it an ideal bridge between Wifi and Wired networks.

 

This next diagram show the ESP32 Connectivity capabilities stand-alone with USB, Ethernet, RS-X, CAN, Wifi and Bluetooth. I definitely want to make this module as it will be small. I wonder if I should make this as and add-one to the STM32 based PLC board?

PLC – Connectivity Module

I drafted a GSM/Ethernet module as well as a 3xGalvanic RS485 earlier, but I am toying with the idea of attempting a PLC Module with STM32F405 using ESP32 for Ethernet/Wifi and 4-6 RS-X ports. 4 if used as PLC-module, 6 if used stand-alone. I have also 2 CAN ports if I can find space/pins for them and I actually have CAN/UART’s on ESP32 as well.

I could connect ESP32 to the backbone as illustrated below, but I have little data on it’s UART speed yet. It’s just an idea for now.

I have not made a move on my PLC concept yet for the simple reason that I have far to many designs/PCB’s that I need to work on and too little time as is. But, still fun to toy with ideas. ESP32 basically cost the same as a W5500 and can do both Ethernet, Bluetooth and Wifi. It will however need an external Phy for Ethernet.