This is the 3-port RS-485 Hat with full isolation. Kind of cool with a black PCB. I have an earlier 5 port (3 x RS485 + 2 x CAN), but decided I needed a isolated version for RS-X since I plan to deploy it with long wires.
This illustrate the Raspberry PI connectivity board. The PSU on top can be switched on/off so we can reboot RPI. The actual RPI will connect using a 40 pin Connector. I am not sure about the mechanics yet, but I am considering mounting it so it’s Ethernet and USB sticks out in front. The adapter board will as far as RPI goes be a Hat using Smart SPI. Basically a Hat with a 40 pin for backbone + the standard PI 40 pin. This Hat should have fixed address 0 and optionally be able to use a higher speed on the SPI.
Expected usage of this is that we use this for cryptic internet access, to provide web servers, complex HMI or simply heavy math. A M4 is fast, but it is no comparison with it’s a Quad 64-bit 1Ghz bigger ARM Brother. I am also considering phone and Speech services that require this grade of Computing Power. It is a lot of Things that is much easier to do on a PI than on an embedded computer.
A Modular PLC system will have some size & cost, and as a home central should be small, easy to hide and low cost it might be wise to produce a specialized “All In One” solution. The diagram above illustrate the content with “backbone” replaced by a MCU. The C firmware will basically only be a simplified version of what we use on the modular system. The content focus on communication only since we expect distributed nodes communicating through RS-X to perform the sensor/actuator parts.
Using STM32F405RG on everything is an overkill, but I can always consider dropping down to STM32F105RB/C later. This M4 gives us a powerfully MCU on each module capable of truly distributed processing as we are promoting in Plain.
Ethernet Module is what I have started on now. This will host a STM32F405RG, 2 RS-485’s for the backbone, a W5500 based Ethernet and optionally a ESP-12 module for wireless. I am also adding RTC battery, SPI flash and a SWD connector. I need to see what space I have available, but as with my previous Raspberry PI Hat’s I intend to re-use much of the MCU related design on every Board if pins & space allow it.
RS-X Module connect the 2 backbone lines to 3-4 isolated network lines. I want isolation on anything in & out of the PLC.
Mobile Phone module is for internet connectivity on remote places or as a secondary backup should a primary internet be cut. It exist so many small, low cost modules these days that we just grab one of those.
Battery Control Module is so we can connect a LIPO package to operate if mains fall out. This should also include charging and monitoring of the battery.
PSU Mains Module is basically PSU modules needed for 5V, 12V, 24V &48V.
Raspberry PI Module will allow us to interconnect with a Raspberry PI for computing, Ethernet, Wifi, USB, Bluetooth etc. The target here is Raspberry PI 2, 3 or Zero W.
Analogue Input Module is a x channel 16 or 24 bit ADC input module. This allow us to read analogue sensors with some accuracy. We need more than the internal 12 bit ADC, so I am thinking maybe a low cost 12 bit board and a bit more expensive 24bit board.
PWM Module is a x channel PWM output, each channel formed as a Half H-Bridge and supporting 2A continuous current. We probably should manage 8 channels – not shure.
Composite Camera Module. I am not sure about this board as I am tempted to use H.264 camera’s only in which case I will ditch this module.
Sound In/Out Module is basically targeting doorbell, but I am open for the possibility to provide a multi-channel music mixer as well. I need to consult with friends in the London music industry a bit, and it is possible this actually will be several boards to adapt to a stage show.
DC/Stepper Module will basically be very similar to the PWM module, but I probably need various currents & voltages for different motors. I am thinking only of small motors supported directly because I expect separate controllers for the larger motors.
3-Phase Motor controller – well, the name say it all, but I am not sure I want to make this board. The reason is because a 3-phase motor usually require some power that is better handled on a separate controller on the other side of an isolated RS-X. Let’s see…
Servo Controller is probably a 16 channel controller like we created before on a Hat, but I will be using Timer’s for PWM this time to get a 16-bit resolution on the PWM duty out.
As mentioned a few times before – this is an idea draft and I write it down to let it mature – plans will change.
I used a little trick on the 3-port Galvanic RSX as I connect to ground through the ground layer on layer 0. If you look at the area marked in green this is part of the ground, but the EDA don’t warn me that this is an iceland isolated from actual ground. I added a connection (in yellow circle) to fix the issue.
Just a reminder that an EDA is only a tool. It might contain snags so it’s up to yourself to actually check what it is doing.
I made a 5 port (3 port RS485 and 2 port CAN) earlier that is great, but I want a version that is galvanic isolated for solutions that require wiring around a house or more hash environments. ADM2582E is a “All-In-One” package for this, so using 3 of these I get a 3-port RS485 will full isolation. This will cost ca 15.- USD more than the plain one due to the more expensive isolation chips, but those bucks are worth it.
The 3D model above is a bit premature, but it gives you an idea of how the Hat will look like. I have also included a snip of the PCB to illustrate the galvanic isolation.
I have not connected the 3 ports to the MCU yet as I basically wanted to see if I could achieve 3 ports with proper spacing. I am actually quite happy with the result. The 4 red areas are ground. As we have isolation it means that each port have it’s own isolated ground completely separate.
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 🙂
I have so far designed 3 Hat’s that I have produced, and a few others in draft versions. Looking at my older picktures I seem to have uploaded 3D models, but not so many Pictures of the actual Boards – probably lost some Pictures on the old blog – I will fix that.
This is just a summary.
I have shown 3D models of other Hat’s that still are work in progress – including some for Zero. I initially froze the Zero Hat’s because my full size Hat’s can also be used for Zero. With the new Zero W it actually is more attractive to use Zero for Wifi connection, so I might update some of my old Zero designs.
I have loads of design ideas I would like to work on, but I am a bit short of time.
New 3D model showing the right angle connectors and the updated “Servo” that now is renamed to 32 x IO Hat. I have done some mechanical changes and added a lot of protection electronics. As mentioned earlier this is my test ground for the VM and each channel have multiple capabilities – hence the “IO” rather than Servo.
- 32 channel Servo Controller
- 32 channel digital in
- 32 channel digital out
- 32 channel low resolution PWM
- 2 channel analogue out
- 12 channel analogue in
- or any combination of the above
I have three Hat’s that will stack nicely
- 16/32 channel IO (shown here)
- 8x H-Bridge + 8 x IO
- 5 port RS-485/CAN
I do in addition have the 7 x Stepper, but I am not happy with the connectors on that one. The 28BYJ-48 stepper motors comes with a 5-pin connector that is nice and exist as right-angle, but I can only manage 3 of these in stacked position – To be honest I am considering ditching this Hat design.
As we move forward I will add more hat’s and more distributed sensors and controllers to allow larger and more complex systems to be created. I want to create a few robots + I want to automate my home for the fun of it. But, all of this is worthless without an easier way to apply Distributed logic so I will continue to dig into the PLAIN concept for now.