Category Archives: STM32 Development

Universal Motor Controller – Actuator Control System

I have a few electronic designs that annoy me simply because I lack time to work on them. The reason is simply to much happening in RL with projects (have to pay the bills) + focus on Software. This one is the worst. It is actually one of my most advanced designs and a very capable Actuator Control System.

I started this partly because I wanted to make my own 3-phase motor controller. But, as I did the design I also added a 4th Half-Bridge, Hall Sensors, Temperature Sensors, End point Sensors, Resolver input as well as the RS-X port. It is much better 3-phase motor controllers than this around, but that’s the point – this is not a motor controller it is a scalable Actuator Control System.

I

I blogged a lot about MicroPLC/Home Automation lately, and this design fit’s right into this scheme. We can’t use long wires with actuators involved as they need to be close to the objects they control (high currents). A centralized PLC design is not optional in a home that actually need distributed unit’s like this.

I will get down to it, but for now I want to focus on getting the HMI running. One of the first projects will be test applications for these devices.

The concept I will use is that the HMI Browser contact this device and upload the HMI. So all you install on the desktop, phone or tablet is a HMI Browser. This is similar to things you know from classic Web Browsers and HTML5, but the main difference is that we operate on a closed, industrial network consisting of a combination of technologies.

One aspect of easyIPC that I have not mentioned is that you have a set of HMI & devices that actually are a closed, industrial loop. It is not connected or available to internet or the outside world unless you want it to. Neither will you be able to connect any phone or tablet if it is on Wifi – the devices will need to be enabled from inside (white listed).

PLC/Home Automation HMI

I have been thinking a bit about creating a stand-alone HMI component. Basically a terminal with a touch display and optional keyboard, mouse and customized input equipment. The key principle would be that we use a Ethernet/RSX as bacbone for data traffic, while the HMI takes care of graphics, input etc.

This is just some random GIF I found on the net, but an HMI app could consist of a set of standard components where layout is controlled by XML files that are uploaded from the device. Communication could be Ethernet/RSX. Equiped with a Plain VM this could be an interesting concept where HMI logic is executed on the HMI unit and only events/data transferred to/from the rest of the system.

Making the app above might seem complicated, but it’s nothing I have not done before from scratch in C/C++. I am thinking more and more about creating a standard HMI app in Qt since that can run on Windows, Linux, Android, OsX etc. I need to check around for options.

<—->

Since we are talking about a network of stand-alone units we could create a full control center as well.

CubeMX

This picture is from CubeMX, just a few clicks and I have assigned 6 x UART’s, 3xSPI ports, crystal, SWD + added USB – the IO capabilities on the F405 never stop to amaze me + you gotta love CubeMX. Be a bit on your watch because not every possibility is available through CubeMX. Another tool I like is the 3D Paint version in Windows.

This is for the RS-X Switch.

Active RS485 Switch

I still got a few components to make\upgrade before I have a full Home Automation network. The CCM and RSX module allows me to create a central, but I need sensors and I need to feed the sensors power. One solution to this is to create an active RSX Switch with power output on each network.

The RS-X Switch as drawn here will take 2 x Ethernet or 2 x RS-X (M1 & M2) input and provide 4 x RS-X output with power. Each of RS-X E1,E2,E3 & E4 can be switched on/off separately and be used for networks or 1:1 with sensors/actuators.

The functionality in the switch is simple message switching. The idea of having 2 x Ethernet and 2 x RS-X Input is redundancy, but I realise this might be a bit tight to achieve so will see what pins & space I have available.

This module will also be a great RS485 Hub used stand-alone.

3 port Galvanic RS-X Module

3D of a 3-port RS485 GW. This actually have 5 RS485 (or RS-X). 2 on the backbone bus running high speed, and 3 isolated with lower speeds in front. These can be used Standard RS485, RSX or even Profibus/485.

The MCU is actually capable of running 3 port Profibus using UART’s saving the need for specialised hardware.

This module do not have the Raspberry PI Zero W add-on option. The reason is because the connector would conflict with the isolation area.

16 x Servo PLC Module

Added 2 coils on the 16 x Servo Module as well. On this I have plenty of space. I should have moved the MCU a bit down, but I will leave it for now.

This module provide output only, meaning it can not do generic IO as my previous 32xServo/IO could. The limitator is the opto couplers providing a full galvanic isolation.  It can still do digital output and low frequency PWM (< 100Khz) in addition to Servo signals.

Servo PSU is selectable from 5, 12 & 24V by jumper. Signal is also selectable from 5, 12 & 24V by Jumpers. The MCU 5V is separate from the Signal/Servo 5V etc.

It is also has a 4 pin HMI – the same as on the CCM board. I simply did not see any point in removing it + might be cool for demo/testing.

Doing 16 channel Servo on a STM32F405RG is well, the reason I use a M4 is the speed of the backbone bus.

CCM/PLC Module PSU Coils

Not very exiting – just added the 3 extra 15uH coil options I mentioned earlier on the back. As mentioned these are added because I suspect I need them to separate 5V PSU to different high frequency modules. The issue, as we learned earlier is that these freuencies interact. The coils here simply let 5V through but stop higher frequencies – it cost me little to just add the space for these on the back side.

I have a weird package error on the 25 Mhz crystal that I need to check, otherwise this is ready to go.

Also starting to use “CCM” (Communication Central Module) as name on this because it contains  Ethernet, GSM, GPRS, GPS, WIFI, Bluetooth,  USB++

PLC Modules

I updated the module list again – don’t worry – this will not be the last change here.

CCM (Communication Central Module) is the new name for the combined Ethernet, Wifi, Bluetooth, GSM/GPRS, GPS, RPI Module. I packed so much into this that it covered 3 planned modules.

Servo Controller Module was illustrated earlier.

I need to work on PSU/Battery.

3 x RS-X Module comping up.

8 x Analogue Input Module coming up.

PWM Output Module coming up.

Digital Input Module coming up.

DC/Stepper Controlles – we probably talk several modules here.

Sound I/O – now this becomes interesting. We have so far talked about a PLC that control robotics, but we could easily talk about a system that also does sound processing… I am very, very thin on analogue electronics, but some interesting options here.

Analogue Input Modules

These two diagrams show drafts of analogue data acquisition modules. The first is a 8 channel 24bit @30Ksps while 2nd is a 16 channel 12bit at 2,5Msps.

The ADS1256 is available for ca 5.- USD and provide 8 channels with 24 bit resolution at a sampling speed of ca 30ksps. This is very good for an ADC with this high resolution.

The faster ADC technique is achieved by using the ADC’s integrated in STM32 directly. These are 12 bits, but have a much higher sampling rate capability (2,4Msps).

I am not sure if I want to make both boards + I need to dig in a bit on analogue scaling & calibration options. I also need opto isolators that have limitations of their own. I also have the issue that the higher frequency of the 12 bit is of little usage + 12 bit resolution is a bit low for sufficient accuracy. Assuming I have space I could actually extend the 24 bit board with a few faster 12 bit channels as well.

All-In-One Home Central

This is a block diagram of the All-In-One Home Central. This is basically a merge between two PLC cards to create a smaller, mobile bread & butter node. I am not going to do anything on this yet – I simply want the MicroPLC modules up running first since this  is re-use of the same technology.

This also provide a full wireless RS-X switch as an alternative to the low cost wired one. The RPI module have sufficient juice for a secure wireless connection.