PLC – All In One Home Central

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.

PLC Backbone Block Diagram

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.

PLC Module – Mechanic scetch

I am toying with using my 3D printer to (1) print a module box and (2) to print PCB holders as illustrated above. This was an early draft – the idea is that you push the module in and use a screwdriver to mount it – I need to look for low cost alternatives here and have a concept before I order the backbone.

New Micro PLC Backbone

My previous backbone board had to little space between connectors + no connection for PSU & communication – this one has 10mm between connectors which is more realistic – thought I still expect one Add-On board to use ca 20mm width. The total width “as is” is 100mm, so it is still very small.

I actually need to find a solution on the mechanical boxing before I finish this one + this is still only an idea draft that need to mature. I probably should add bias and terminator for RS485 on the backbone. Have some spare space on right.

As for add-on boards I am toying around with the following ideas;

  • An Ethernet connectivity board.
  • An RS-X connectivity board.
  • An Raspberry PI connectivity board.
  • An analogue input board.
  • A PWM channel board.
  • A camera input board.
  • A voice & mic board.
  • A DC-/Stepper- Motor board.
  • A 3-Phase motor board.
  • A GSM/3G/4G Board.

We can have a lot of fun here, but I will let these ideas mature a bit…

SMD versus Hole Through

This came as a surprise to me – it is only 1,5 years ago I started doing SMD electronics. My previous experience had only been hole through technology. But, as hole through have so many limitations I decided to jump in and give it a try – the first component I tried was a LQFP48 – a STM32F103CB. After watching some Youtube movies I picked up a trick and soldered it with an ordinary soldering iron – it worked. I started with 1205 components, but won’t use anything larger than 0603 these days.

As I now do a hole through project it serve to remind me of how much easier it is to work with SMD than hole through:

  • To solder a hole through you need to hold the PCB up-side down struggling with components falling off.
  • You have the same issue as you remove them.
  • Components that are easy to remove with Hot air on SMD is a paint on hole through.
  • The largest surprise was however in the EDA – your selection of components and technology is suddenly very limited.

The one advantage that Hole Through have is that things are larger and more people feel comfortable working on it – SMD do require some practice to get right, but it is seriously worth mastering. In sum – SMD is much easier to solder and work with than Hole Through IMO.

Lab PSU 0-30V /10A – Part 12

The good thing about a blog is that it is excellent for notes – if I make my work-notes here they are called “documentation” 🙂

The following are programming notes for the PSU Control Board:

PA10 – GPIO J1-4 Relay 1 – Connect extra 12V – 36V If Relay 2 is On.
PA9 – GPIO J1-5 Relay 2 – Connect extra 12V – 24V
PB1 – GPIO J1-6 Relay 3 – Switch On/Off Output from regulator.
PA7 – ADC J1-7 Temperature 3
PA6 – ADC J1-8 Temperature 2
PA5 – ADC J1-9 Temperature 1
PA4 – GPIO J1-10 Fan 3
PA3 – UART1 J1-11 RX
PA2 – UART1 J1-12 TX
PA1 – ADC J1-13 V Out. Measure Out Voltage in a split 10:1
PA0 – ADC J1-14 CSense Out. Measure Voltage in a split 10:1 before current shunt. CSense – V Out = shunt voltage.

Current Out = Shunt Voltage / (0.47R / 2)

PF0 – GPIO J2-6 Fan 2
PF1 – GPIO J2-7 Fan 1

Note 1: A 12 bit ADC scaled for 30V (30/4096) will detect ca 7mV changes in voltage drop over the shunt. Given a shunt resistor of 0.235 Ohm (0.007V / 0.235R) that gives a resolution on ca 31mA on the current calculations. This is a little less than I hoped for, but the alternative is to use an external current sensor to increase accuracy – I need to work on this a bit.

Lab PSU 0-30V /10A – Part 11

This pic shows my analogue regulator. You can see the 2 transistors and a fan in the back and my DIY load array on top left. I am actually quite happy with this after I mounted it on a proper PSU source in. The only things left is to get the current regulator working, but I am a bit handicapped in testing before I get a proper heatsink mounted. I have so far only tested 5A for a short period and had to abort as transistors started to overheat.

This shows my Control board. I have done more mistakes on this than I like to admit. The red PCB on left is the MCU – had to mount an adapter to allow for SWD connection so I can program it. Will start working on this a bit later. From my previous test I notice that the analogue regulator need ca 4V to work on, so I need to connect the 2nd PSU at 8V and the 3rd at ca 20V.

A few things to work on:

  • Need to get current regulator working.
  • Need to verify 10A continuous.
  • Connected GND rather than 12V on FAN output’s.
  • Forgot pull-up’s into ULN 2003 so relay’s hit in at random before MCU take control.

ZHAOXIN KXN-305D Review

I purchased this Lab PSU 0-30V /5A from ZHAOXIN a few years back, but I have not really been using it much. What I discovered as I started using it was very dissapointing.

This Lab PSY from ZHAOXIN is far from cheap – it usually cost 80ich USD + 50ich P&P as well as ca 30ich in customs fee – so the real cost is close to 170.- USD if you import one to Norway.

I discovered that it’s out voltage drop under load and decided to do some testing. Adding a resistor array and measuring out with amultimeter I get the following table:

Display Out Current Multimeter Measure
12.3V 0A 12.3V
12.3V 2.1A 8.2V
12.3V 3.2A 6.1V

I actually like this PSU due to it’s cute design & look. As the picture above show it also have a nice, switched design on the inside. But, looking at the table above it is quite clear why I have been having some problems with applications earlier. I can sadly not recommend that anyone spend their money on this one!

 

Lab PSU 0-30V /10A – Part 10

These cost almost nothing, so I bought a few and plan to use them on my Lab PSU. They have separate PSU and measurement cables – so initially I connected the PSU to the same PSU as I use – the result was that Voltage increased as Ampere increased. Realising the mistake I connected a separate PSU to power the meter and voila – the difference between my meter and multimeter is constant.

It shows that as I increase load and current the out voltage will drop ca 10mV from 0A to 4A – compared to the ZHAOXIN PSU this is great news. The meters above have calibration points on the back. The most important is that the way I mount them is guaranteed to show actual values out – not some fictional setting values.

Lab PSU 0-30V /10A – Part 9

One important issue is that we maintain stable out voltage during changing load. The diagram above show my current test setup using a cheap lab PSU from ZHAOXIN. To be honest this cost ca 60.- USD and the same in P&P to Norway.

The Thaoxin is set to Output 12.3V. The BasicPI Analogue Regulator is set to 5V. The variable load is a homemade resistor array build by 5W 0.47R Cement resistors ranging from 0.47R to 8×0.47R.

To assist on heat dissipation I mounted a 12V fan a few cm from the TIP3055’s and wow – this soundless fan do it’s job well. But as I increased load current I noticed that it dropped in speed. I also note that the Voltage out on the Analogue regulator vary with +/- 0.5V. But the display on the Zhaoxin still show 12.3V – so I mounted a voltmeter to check.

What I see annoy me – the Zhaoxin PSU is not reliable – as soon as I apply ca 4R load (current ca 1.6A) it drops to ca 9V. My own analogue regulator hold it’s ground better by increasing the voltage a little. If I increase further the Thaoxin continues to drop it’s voltage.

The display still show 12.3V giving no indication that the voltage out actually have dropped to 8ich V out. ZHAOXIN Lab PSU is not very reliable – firstly it drops With load and secondly it show an incorrect out voltage under load.

As for my own voltage out I also notice that I have a calibration issue – my Multimeter show that my own voltage out is far more stable than my mounted V/A meter indicate. I also have an issue that as the Input voltage drop to 7ich Voltage the regulator need ca 4V of it’s own. The encouraging part here is that I thought this Lab PSU would compete to much with cheap Asian one’s, but looking at the result I realize that my own will hold it’s ground much better under load – wow!