Tag Archives: PLC

PLC Simulator

After playing with a Programmable Logic Controller (PLC) to operate my radio mast, I decided to build a simulator in order to better understand the capabilities of the EASY PR-18DC-DA-R.

I wanted the simulator to have 16 inputs, either momentary or switched and the ability to import signals including an embedded 4 – 20mA current.

I had a sloped project enclosure already, so I made a dimensioned drilling template.

Drilling Template

Once the template was stuck down, the pilot holes were drilled, template removed and holes opened to the right sizes.

Drilled Case

The template was created in Visio and I used layers, one of the layers was for switch position drilling and alignment cross-hairs, turning that layer off (missed one in I8!), allowed me to print on  self-adhesive sticky Matte White Vinyl.

Blank template

Using a sharp knife, I cut though the Vinyl and started fitting the switches, buttons, Output indication LEDs and 4 – 20mA injector.

Terminals to go in

Terminal posts next.

Switches going in

Front panel populated.

Lidded

Wiring started.

Pre-wire

After a couple of changes, the internal wiring is completed and loomed in.

Wired

The simulator uses 24v DC, I used a small 1.5A output switched mode PSU for this, fed via a chassis fuse holder with the supply from an IEC male socket, the output from the PSU is fused separately.

PSU 24v

PLC simulator all powered up, the program in the PLC was legacy from my mast control project, this will be overwritten by downloading revised programs from xLogicsoft software.

Finished PLC

To complement the PLC simulator I bought a4-20mA Current Signal Generator 0-10V Voltage Generator Transducer Simulator for £19.00.

simulator

Injector resolution precision:

  • Current 0-20mA 0.001 0.1mA
  • Voltage 0-10V 0.001 0.1V
injector
Boxed injector

testrig

 

 

 

 

 

 

 

Completed test setup.

 

Radio Mast Automation – Part 5: Control Modification

Updated 29 September 2023

Since my last blog on Mast Automation when I thought I’d finished the project, I have made some changes to my weather station which means I no longer have an output to the mast controller, this output used to trigger the mast to lower when the wind speed hits 30 mph.

I decided to update the discontinued version of my Programmable Logic Controller (PLC) with a Rievtech PR-18DC-DA-R from Audon Ltd, this unit is a direct replacement for my old PLC and has 12 Inputs and 6 relay Outputs.

Rievtech PLC

The PLC accepts a number of input types, in my application I’m simply switching a voltage state with the exception of one of the inputs which is configured as an Analogue input, to which I have connected my mast mounted Anemometer (https://www.mouser.co.uk/ProductDetail/485-1733?R=1733virtualkey54950000virtualkey485-1733) as a means to trigger mast lowering during unsafe wind conditions.

1733

Adafruit 1733

TECHNICAL DETAILS

Dimensions:

  • Height (base to center): 105mm / 4.1″
  • Center out to Cup: 102mm / 4″
  • Arm Length: 70mm / 2.8″
  • Weight: 111.8g

Wire Dimensions:

  • Wire Length: 99cm / 39″
  • Plug Length: 30mm / 1.2″
  • Diameter (thickness): 4.8mm / 0.2″

Specifications

  • Output: 0.4V to 2V
  • Testing Range: 0.5m/s to 50m/s (111.8 mph)
  • Start wind speed: 0.2 m/s
  • Resolution: 0.1m/s
  • Accuracy: Worst case 1 meter/s
  • Max Wind Speed: 70m/s (156.5 mph)
  • Connector details: Pin 1 – Power (brown wire), Pin 2 – Ground (black wire), Pin 3 – Signal (blue wire), Pin 4 not connected

I tested the output  with help from my better half by driving at steady speed and monitoring the output from the anemometer:

  • 0 mph = 0.40  mV
  • 25 mph = 0.75 – 79 mV
  • 30 mph = 80 mV
  • 31 mph = 81 – 88 mV
Anemometer
Anemometer mounted on 2m/70cm H/V relay switch box

I mounted the anemometer to the top of my mast to get a representative wind speed, the next job was to strip out the old PLC from the control cabinet.

Mods
Starting mods, (hand held winch controller on top of cabinet)

I needed to make several changes from the original design in order to free up one of the PLC’s inputs, also out of the 16 Inputs only the first 6 allow analogue inputs, so some moving of inputs was needed along with some minor works to the LED voltages and override/luffing switch.

PLC
Completed Cabinet

All went back together quite nicely but an intermittent problem remained after the PLC replacement in that when the mast completed the mast raise cycle, the motor would immediately reverse and the mast would lower.

Hooking up the laptop to to the PLC, I selected ‘live monitoring’, this displayed the input and output condition, this showed that after operating the ‘raise’ toggle switch (centre bias On – Off – On centre off), the ‘lower’ switch input also went and remained high. This output to the PLC caused the motor to immediately  change direction and lower the moment the mast raised sensor was triggered.

To reduce the chance of a repeat problem occurring, I modified the replacement DPDT switch wiring so that both poles need to switch in order for a signal to pass.

switch wiring

Prior to starting the upgrade works I had the programmed PLC on the bench and I thoroughly tested all control permutations by simulation using the software from Audon Ltd to ensure correct operation.

v3
PLC Modified block diagram (Program File for use with xLogicsoft)

As you can see, the logic has grown with the project, I’m sure this could be significantly simplified, however, it works for me.

Mast Control Logic

Pressing the Emergency Stop button will inhibit any operation and reset any timers which are running, also a message is displayed ‘*warning* E-STOP operated’

Raising the Mast

Conditions –

  • E Stop not pressed. (Input 1004).
  • Top Securing mast pin IN. (Input 1008).
  • Mast in the lowered position. (Input 1006).

Trigger –          Switch input momentary high. (Input 1003).

Action –

  • Lower switch inhibited.
  • Switch input via wiping relay with a 1 second ON timer to ensure momentary trigger to the next stage.
  • 36 second up timer start to operate Up relay (fail mechanism in case the ‘raised’ sensor fails).
  • Up relay closes to energize motor drive. (Q002).
  • After expiry of Up timer or on activation of the Up sensor, Up relay opens.
  • Mast raised output relay energizes. (Q003).
  • Message displayed ‘up motor running’ then ‘mast fully raised’.

Lowering the Mast

Conditions –

  • E Stop not pressed. (Input 1004).
  • Top Securing mast pin IN. (Input 1008).
  • Mast in the raised position. (Input 100C).

Trigger –          Switch input momentary high. (Input 1005).

Action –

  • Raise switch inhibited.
  •  Switch input via wiping relay with a 1 second ON timer to ensure momentary trigger to the next stage.
  • 39 second down timer starts to operate Down relay (fail mechanism in case the ‘lowered’ sensor fails).
  • Down relay closes to energize motor drive. (Q001).
  • After expiry of Down timer or on activation of the Down sensor, run on timer operates for 0.15 seconds to take slack off winch cable.
  •  After expiry of run-on timer, Down relay opens.
  • Mast lowered output relay energizes. (Q004).
  • Message displayed ‘down motor running’ then ‘mast fully lowered’.

Wind Speed Triggered Auto Lower

Conditions –

  • E Stop not pressed. (Input 1004).
  • Top Securing mast pin IN. (Input 1008).
  • Mast in the raised position. (Input 100C).

Trigger –           Wind measured via Anemometer at 28 mph for 15 seconds. (Input A1001).

Action –

  • 0.4 – 2v Anemometer to Analogue Threshold Trigger output set go high at 80 mV and off at 76mV, these values equate to ~28 mph and ~24 mph respectively.
  •  ‘On Delay’ timer from analogue threshold trigger set for a sustained output of 15 seconds duration before the next stage is enabled in order to reject gusts.
  •  ‘Off Delay’ timer set to 10 minutes, if no input from the ‘On Delay’,  ‘Off Delay’ resets.
  • Whilst the ‘Off Delay’ timer is running, the WX Amber LED is lit. (Q005).
  • Output from ‘Off Delay’ to wiping relay timer set to 1 second to ensure a momentary output to the next stage.
  • 39 second down timer starts to operate Down relay (fail mechanism in case ‘lowered’ sensor fails).
  • Down relay closes to energize motor drive. (Q001).
  • After expiry of Down timer or on activation of the Down sensor, run on timer operates for 0.15 seconds to take slack off winch cable.
  •  After expiry of run-on timer, Down relay opens.
  • Mast lowered output relay energizes. (Q004).
  • Message displayed ‘high wind trigger auto-lower active’.
Amber LED indicating high wind has triggered lowering the mast and inhibiting it from raising whilst lit.

Battery Charging Process

The winch has 3000lb capacity from Winch-It and is powered by a 12v car battery with a capacity of 45Ah – 360cca.

Normal Operation –    25w solar panel connected to the battery via CMP Solar Charge Controller.

Automatic Operation –

Trigger –       After 4 operations of the motors (raise & lower twice) or Weekly – Sunday 01.00.

Action –

  • Multi-pole relay energizes after a 2 second delay via Q006, this:
  • Disconnects the solar panel.
  • Applies mains to a 4A output battery charger (charger sized for Ah of battery).
  • Connects the battery charger output to the battery.
  • Message displayed ‘battery charging’.

Charging ceases when:

  • Battery terminal voltage reaches 14.14v (Over-voltage detection module to Input 100A).
  • 8-hour battery run timer expires.

Manual Operation –

Charging Start – Push button in control cabinet (Input 100B).

Charging Stop – Cursor key on PLC (C3).

Notes-

  1. If the battery charging cycle has started and the motor (either up or down) is operated, charging will cease and resume after a delay of 2 seconds after the motor has stopped.
  2. Up-Counter resets to zero when the charger is ON.

Luffing the Mast

Conditions –

  • E Stop not pressed. (Input 1004).
  • Top Securing mast pin Out. (Input 1008).
  • Bottom Securing mast pin In (Input 1002).
  • Mast in the lowered position. (Input 1006).
  • Luffing switch set to On (Input 1007).

Trigger –           Momentary switch (raise or lower) (Inputs 1003 or 1005).

Action –            Operating the Luffing switch supplies power to the wireless receiver and manual switch which came with the Winch-It kit via a relay , the supply for this is taken from the Luffing/Override indicator LED, (the Luffing switch is a Double Pole Double Throw On – Off – On, the LED is fed from one side of the switch).

A further change to the control is to from latching to momentary switch operation allowing the motor to be ‘inched’ via the wireless handset or panel switches in the control cabinet.

Using the handset allows the mast to be walked down whilst lowering or the reverse when reinstating the mast to the vertical.

Message displayed ‘mast switched to luff’.

Override

Operating the Override switch bypass all limit switches and enables momentary manual control.

Message displayed ‘ override switch on’.

Other Alert/Warning Messages

Top pin in, message displayed ‘top mast securing pin in’.

Bottom pin in, displayed message ‘bottom securing pin in’.

Both top and bottom pins in, message displayed ‘both mast securing pins in’.

Update

After breaking the winch cable and managing to replace it, (see HERE), I’ve added motor overcurrent detection to halt any process which is taking too much power.

Radio Mast Automation: Controller Wiring – Part 2

Continuing on with the radio mast automation, this blog shows how I have wired the controller. (Part 1 is HERE)

The external enclosure for the automation equipment has a plywood back board which is removable, it is to this I have mounted all the necessary bits of kit, I have loomed all the cables in with waxed lacing cord and given each conductor a unique ident for ease of fault finding.

To allow the back board to fit back into the enclosure I will have to strip everything of the board first, the 24v DC transformer and PLC are mounted on ‘top hat’ rail for ease of removal, the solar charge  limiter and main control unit are held in place with wood screws.

20160522_165331 (Medium)

The PLC controller is powered using 24v DC, I did try it on 12v but the output relays seemed sluggish when activated, the proximity sensors I’m using have a wide operating voltage range (9v – 30v) so these will be fed at 24v, due to the wide voltage tolerance, voltage drop will not be an issue considering the maximum cable run is 7 metres, (I’m using 8 core 7/0.2mm CSA).

The input to the PLC will be a switched high of 24v with the exception of the battery fully charged input (the board for this is affixed to the lid of the enclosure), when a charging voltage of 14.14v is reached, this will switch the battery voltage to the PLC input via a relay to cancel mains powered battery charging (link to blog on voltage relay HERE).

All cables have been marked up to aid fault finding or making additions to the control system should I need it, the image shows cables marked and ready for looming.

20160524_172213 (Medium)

Cables loomed up with waxed lacing cord and powered up ready for bench testing.

20160524_172130 (Medium)

Slight tweak to the PLC program to invert the Hall Effect limit switches, for testing purposes the run on timers were set at 5 seconds, after timing the raising and lowering of the mast with a fully charged battery, the correct timings have now been uploaded.

20160524_172714 (Medium)

Phew!, the lid fits on the controller 🙂 and everything seems to work!

30 May 16 – I decided to use the enclosure which houses my Easy Rotor Control as the place to fit the indicators and remote switches to control the mast from the shack as it had plenty of room.

20160530_165914

From Left to Right  –  The main On/Off switch is the first switch, in the ON position a small LED to the left of the switch will be lit, turning the switch OFF acts an Emergency Stop to the PLC

The Green LED is for mast fully lowered, the Amber LED is lit when an output from the weather station is active (next picture) and the Red LED is for mast fully raised, the switch on the right is momentary operation, non latching center off and is used to send a positive input to the PLC to either lift or lower the mast if the correct logic is satisfied.

20160530_175157

The weather station interface is a HobbyBoard 8 channel relay unit (unfortunately these are no longer available from HobbyBoard), this is linked to Weather Display software to control the output relays when certain pre-configured thresholds are met.

I have wired the internal relays in parallel so if any relay operates it will send a positive voltage to the PLC weather input (WX) which in turn will lower the mast if raised.

I have set the mast to lower should the wind speed exceed 30MPH and if 8 strikes of lightning within 1 minute are detected, these values may well change in future as experience grows.

The next stage is to mount the external enclosure on the wall and strip down the existing control circuit and replace it with the PLC control, this will mean adding new cables to the mast to pick up the additional proximity sensors and a multicore cable to the shack to the control box, the wireless handsets I currently use will then only be used as I’m luffing the mast.

Please see Part 3 HERE.