PLC – Ethernet w/CAN & Serial

As I can’t get hold of the components I want and this becomes a prototype that will change I can as well start using both sides of the board. The SOP8 CAN tranceiver get a bit squeezed on the top layer so I can put it at bottom – in which case I can add an optional RS485 as well as a TTL UART because I have plenty of spare IO here. The advantage is that this makes this little board a stand-alone Ethernet, CAN to RS485 converter as well. This boards will need 4.5V to 5.5V input so I need an adapter with a 5V. BOM cost here is an issue, but I don’t want to dig to much into that on this prototype. The usage of both top- and bottom- side will in this case forece a minimum of 4 layers because we need to separate MCU signals and Tranceiver signals as they will be back to back.

In the example above I have added RS485 Tranceiver, CAN Tranceiver, 2-pin RS485 port, SPI FRAM and SPI Flash on the backside of the module. Adding a 2Mbyte SPI-Flash is something I need to consider because that might be needed for downloading new firmware from remote connection. The issue is that FW will by typically 64-124Kb and needs to be temporarely stored somewhere. FRAM on the other hand is handy for configuration parameters. I am however getting into a bit of trouble because I have more components that needs to be here and is running out of space fast.

Alternative positioning to optimize space. I will return to these once I have placed the mandatory components. But, as you can see we really could need SO-23 versions of these components. As for SPI Flash and FW download it is nothing preventing us from adding a disc module separately – a “disk” composed a larger Flash.

PLC – CAN Tranceiver

TI have made an excellent series of CAN-FD Tranceivers in SO23-8 format. All the rest is SOP8 and you can compare the two footprints below. The bugger is that I can get SOP8 versions, but I can not get any of the SO23-8 versions. So for now I have to accept added space here as well. TBH I am happy I could get some at all these days.

The Header Pwr & CAN will be mirrored on the other side and the bus will connect CAN. What I need to add is a 120 Ohm receiver and a NPN/PNP Switch in SO-23 form to switch terminal resiston on/off. But, those SO-23-8 CAN Tranceivers are high on my purchase list. That said, these are 5Mbps – I have also seen some advertizing 8Mbps.

For those new to CAN and CAN-FD. CAN is very attractive to use as interconnection between devices since everyone can transmit according to arbitration rules. CAN-FD have flexible datarate and 64 byte payload making it superior to the older CAN versions. 5Mbps on CAN equals ca 10Mbps Ethernet in a Network.

This last 3D image shows why size matters. I am using a SOP8 that is 4 x the size on a SO-23-8 and the chip ends up under the W5500 breakout. This will be tight. I ordered a few TJA1442 because they where the only 5Mbps CAN-FD I found – sadly these are 5V so I connect them to the 5V input source rather than 3,3V. RXD/TXD will handle 3.3V signal levels. But, both MCU and CAN Tranceiver will be swapped out later anyway – this is a prototype.

PLC – Ethernet Module Draft

The nice thing about KiCAD is that you find free 3D models for almost every package. Imported a Step file from GrabCAD, made my own footprint and voila. It is a bit space between the PCB’s as the header is not showing, but it gives a good impression of the result. If I want to use the space below the W5500 mini module I basically need to use the back side. In short I can probably add some optinal stuff here like SPI Flash and a serial port tranceiver.

This is with a LQFP64 version of STM32G491, so it will be tight. But, I have 20 of these and are unable to get hold of the smaller LQFP48 so I want to make an attempt at least. Would be nice to assemble these before x-mas. Give me a few hours and I will have the full module.

It’s been a while since I used KiCAD, but the interface have improved and it is nice to see that KiCAD more and more is on the list that is supported by vendors.

PLC – Ethernet to Serial Converter

The two first modules I will create is Ethernet and Serial (RS485 & RS232). I have several paths forward to create this, but the most obvious is to create two modules that can go back to back. To connect these two I use a small PCB connecting CAN on J2 – the four pins are 3.3V Power (or 5V ?) and the two CAN pins. The bus board can hold the PSU and lanes to interconnect CAN between boards. J2 is on the top at left side and bottom at right side.

Another option is to use the space under the Ethernet Module (or back side) to have a serial out through a low profile mini-connector directly on the Ethernet module. This will make a very small all-in one PCB. Yet another option is to use an UART TTL back to back. The UART is nice for debugging, but could also connect directly between two boards with a jumper. I need to actually make these boards to see how much space I have.

The advantage with the Bus board is that I can put PSU here – the alternative is to put PSU on each board – which can be assembled on the back.

The main drawback right now is that I only have LQFP64 MCU’s in stock – I managed to buy some a bit earlier, but getting hold of any STM32 these days is difficult. That also goes for semiconductors in general andit seems as we will see 2024 before this get easier 🙂

PLC – Ethernet Module

My KiCAD skills are coming back – just a quick check on the Ethernet module. I reduced MCU to LQFP48 and used a W5500 module through headers. I moved drill holes to the corner. The J45 in the middle is just for show. This is a 25mm x 45mm module and I will have plenty with space by the looks of it. This is good news. I need to squeeze in a x-tal, SWD connector, CAN Tranceiver and connector, but that’s doable. To squeeze in FRAM – not sure, in which case I store config on an internal flash page. My Ethernet to Serial modules from AliExpress are smaller than this, but I got a STM32 I can program and mounting holes 🙂

I will make one module using the W5500 adapter shown above – hence the pin header. On a later module I will use a low profile RJ45 and W5500 or W6100 chip directly – or I could use a MCU with an Ethernet interface. W5500 will give a max of 15Mbps speed. With a backbone bus of 5Mbps that is more than sufficient.

Above is a comparizon of some of the PCB sizes I can use. On top the Ethernet Module with the size of a LQFP64 outlined outside the LQFP48 footprint. In middle a dual width (90mm) module  and at bottom a dual height (50mm) module. This is just to give a brief idea of how much space that is available for IO. And the beauty of this system is that I can continue to scale up.

BSA – Using the PLC

BSA will see the PLC modules as a named tree and the diagrams send/receive messages using those names as addresses. You will have the option to design and/or detect a tree.

easyIPC contains a config system allowing new, unknow modules to be reported and the user can then assign that module to a named position in the system. To do this the new module must fit the spesification for the designed system module.

Modules can communicate with eachother, but by default they will not. The config will need to set up the system diagram where selected messages from Module1 is read by Module2 as an example. Configuration here is done in two steps – first you create a system in code, secondly you assign modules to take up positions in the network.

 

 

 

 

Modular PLC – Part 3

This just a mock-up of an actual module assembled from 7 IO modules using the later design. Size is just illustrative as I play around with ideas. I am waiting on project boxes and will adjust everuthing to that.

So far I have only draftet connectors as 5P headers. I am thinking about doing CAN only and maybe let each board have one connector that plug into a adapter board at bottom that fit into the project box. This would be a PCB only to create a backbone bus with Power and CAN-FD. The entire PLC will be flat, low profile. Using this system we can deliver modules that is 45 or 90mm wide and 25,50, 75, 100 aso in Height. CAN-FD interconnect within a box and from box to box.

It is possible, but I need to think about the mechanical solution here. An Alternative to having a Bus-board at button is to create a cable-PCB and soldier a specialized interconnect cable for each box. The advantage is lower profile, the disadvantage is more manual work. Cost wise it is more elegant to just plug things together.

Modular PLC – Part 2

Sadly the headers occupy ca 10mm of 25mm, so to get Ethernet RJ45 fixed I needed 35mm width on the modules. The MCU module will be fine, but having two IO modules will require more space. 10mm extra is not the end of the world, but the design draft is also 4 PCB’s per module, so I wonder if I could get cost and size down by making modules with MCU on as follows:

The issue is that getting rid of the headers and reducing from four to two boards are fine, but with the target height of 25mm I still use up to much on the mounting holes.. M2 Mounting holes with 1 mm clearing is 4 mm. I also only gain 5 mm on width while I suddenly have to find space for the MCU. I can use a smaller 48 pin MCU rather than a 64 pin, but the saved space is scarse.

The disadvantage of doing this is that 25mm height will only serve the smallest modules. Another disadvantage is that we add a MCU on each module doubling MCU cost. And I don’t realy have a solution to interconnect boards here yet.

The advantage is that we reduce from 4 PCB’s down to 2. Interconnecting two modules are done elegantly on back to back using a UART TTL since you will automatically cross Rx/Tx. Another advantage is that we in case of space starvation simly can customize the module by (1) using 50mm Height or the full 90mm Width. Below are illustrations showing 90 x 25mm and 50x90mm.

I was thinking of using a TTL Uart between two modules mounted back to back, while I still use CAN for modules in general. Using a TTL UART is free – no space except for a back to back connecter. But, CAN-FD is also extremely small size with SO23 package Tranceiver so I could use CAN-FD on everything. All IO between MCU and IO is now custom. To faciliate Ethernet and Wifi I could sacrifice one mounting hole, but with scalability in Height/Width I am not stuck to the minimum size.

As mentioned before 90mm is selected because we can use standard PLC Boxes where you can have connectors on both sides.

A word about KiCad and why I do the mock-up in PowerPoint: I just upgraded to KiCad 6.08 and it’s been a while since I used KiCad so I need to re-learn the PCB tricks. KiCad is great then you know it and use it often. I will return later with more accurate mock-up’s on the mechanical design.

Modular PLC

I was recently asked to create a PLC in the form of a cable and the resulted draft is quite awesome. The design size I decided on was 90 mm x 25mm x 25mm. The reason for the 90 mm is tto have a fit for standard PLC boxes. 25 x 25 is a reasonable target. This led me to create a motherboard with 1 x IPC connector and 2 x IO modules

The Motherboard uses 70mm leaving 10mm each end for full height connectors. The total length then become 90 mm as we adapt IO modules. Counting a reasonable pin excanche I settled on a 40 pin 2.54 pitch header supported by screw terminals for now. The connectors are mirrored so that modules can be mounted on either side.

The small 1cm connector in the middle is an IPC adapter allowing me to connect MCU boards together. And this means I can scale as much as I want. I drafted a 2 x 5P x pin header for now. I might add a screw hole. But, I might also mount the IPC directly on the motherboard.

The Block diagram is below. I have already tested pin layout in Cube, but it will be some tricky PCB routing here so I expect 6-8 layers on the MCU board to achieve signal integrity.

As for IO Modules I decided on a few issues that still is on draft leve:

  • Connectors are identical and mirrored, so a module can be added on either side.
  • Key is X pins that identify the sub-connector. I would like to have this, but I am running out of pins so will have to work on this.
  • 1 x CAN-FD TTL on each side. And a 3rd on IPC to interconnect several boards as one solution.
  • 1 x UART on each side.
  • 1 x SPI on each side.
  • I have not considered I2C yet.
  • 8 Analogue and/or digital pins – these are common for both sides.
  • USB pins connected to each side – not sure if I want to add an optional USB connector on the MCU as well.
  • 8 PWM signals supported by a Motor Control Timer.
  • I also added an SPI based FRAM w/32Kb for config. This is more elegant than using Internal Flash for config.

IO Modules – the list can be as long as you want:

  1. Ethernet Adapter.
  2. Wifi Adapter.
  3. Disk.
  4. Display/Keyboard Interface.
  5. RaspberryPI IO.
  6. RS232.
  7. RS485.
  8. CAN (FD, HS, FT)
  9. Analogue modules.
  10. PWM Modules.
  11. Digital IO modules.
  12. 3-P Motor
  13. DC Motor
  14. Stepper Motor
  15. Sensors.
  16. never ending story…

More to come…