PLC program for motor control with 10 proximity sensors

nirmalbabu

Member
Join Date
Dec 2013
Location
Coimbatore
Posts
2
Hi,
Please help me with this PLC interview question. The logic conditions are

  1. if any 1 sensor turns on, motor1 turns on and other motors off
  2. if any 2 sensor turns on, motor2 turns on and other motors off
  3. if any 3 sensor turns on, motor3 turns on and other motors off
  4. if any 4 sensor turns on, motor4 turns on and other motors off
  5. if any 5 sensor turns on, motor5 turns on and other motors off
  6. Anything more than 5 sensor turns on, all 5 motors turns on.
Please give a simple PLC logic for this. Thank you
 
Nirmalbabu:
Welcome to the forum, please take into account that nobody is going to make or help with your homework until you show your efforts about it.
Try using AND logic for each one of your sentences, it's easy, just try to write it down.
Try using some kind of plc emulator, then send what you have done and surely a lot of people are going to help you.
 
Hi widelto,
I have already tried it with a counter and some comparators which seems to be not reliable. Im looking for some other logic.
Also please note that using AND logic for that much of combination will marginally increase the number of networks. Thank you
 
I would use a network that keep track of how many sensors is on. A memory variable and ADD and SUB would do the trick. Then use comparators for starting the motors.
 
first 5 lines are easy just type them as you have.
if sensor1 then motor1 true else motor1 false
now for the last line
set counter to 0
for sensor 0 to 10
if sensor true then counter+1
next sensor
if (counter >5) {motor1 true,motor2 true etc allrunning=true.
if allrunning true and counter <5 then stop motors.
 
first 5 lines are easy just type them as you have.
if sensor1 then motor1 true else motor1 false
now for the last line
set counter to 0
for sensor 0 to 10
if sensor true then counter+1
next sensor
if (counter >5) {motor1 true,motor2 true etc allrunning=true.
if allrunning true and counter <5 then stop motors.
Shooter,
I'm confused, OP says if any 1 sensor, then, any 2 sensor, etc, not sensor number 1 or sensor number 2 etc. Is this a simple language translation that is confusing me or does that make any difference?
 
Last edited:
Shooter,
OP says if any 1 sensor, not just sensor number 1. Does that make any difference?

It doesn't matter to me...

I've already seen too many poor PLC programmers without helping someone circumvent the process by helping him answer an interview question. If the OP can't figure this out, how can the OP possibly be qualified for the job?
 
I have already tried it with a counter and some comparators which seems to be not reliable. Im looking for some other logic.
Okay, on the counter, you need an UP/DOWN counter (which counts UP when any sensor goes ON, and counts DOWN when any sensor goes OFF).

For each sensor from 1 to 6 (yes you need 6 sensors to make your program work), use two rungs, first rung with a One-shot (goes ON one time when sensor goes from OFF to ON), and second rung with a One-Shot (goes ON one time when a sensor goes from ON to OFF).

Now use the Sensor One-Shot ON bits to trigger the COUNT UP.
Use the Sensor One-Shot OFF bits to trigger the COUNT DOWN.

Now use two comparision instructions (EQUAL to Sensor #, and GREATER THAN "5") to control each motor output.
 
Last edited:
I will post simple PLC logic for the first sensor and first motor of the problem. The rest should be easy.
 
Last edited:
Okay, on the counter, you need an UP/DOWN counter (which counts UP when any sensor goes ON, and counts DOWN when any sensor goes OFF).

For each sensor from 1 to 6 (yes you need 6 sensors to make your program work), use two rungs, first rung with a One-shot (goes ON one time when sensor goes from OFF to ON), and second rung with a One-Shot (goes ON one time when a sensor goes from ON to OFF).

Now use the Sensor One-Shot ON bits to trigger the COUNT UP.
Use the Sensor One-Shot OFF bits to trigger the COUNT DOWN.

Now use two comparision instructions (EQUAL to Sensor #, and GREATER THAN "5") to control each motor output.

I think it's better to use a variable and the instructions ADD and SUB to keep track of the number of sensors activated. This will remove the risk of two sensors that indicate on the same time, is just detected as one.
 
I think the counting of the sensors would be better done by clearing a count then having 10 rungs testing each sensor. If it is ON then add '1' to the count (no 'subtract' is necessry, the count is updated each scan). Follow that by the compare conditions for the 5 motors. It avoids any 'Turn On' or 'Turn Off' coincidence problems in counting.
 

Similar Topics

I've started writing a program and its a sequence of steps that it will go through. The sequence commands seemed a little complex to me so I opted...
Replies
7
Views
8,750
Can we use a Simotion D455 ethernet port x127 as a gate, to access S7-1500 plc Tia Portal program ? In the Simatic manager, we used Netpro to do...
Replies
2
Views
70
Posted this to Reddit with little success, so I figured I would share it here as well. Very new to PLCs, but figured I would give it a shot to...
Replies
0
Views
115
I'm a beginner in the automation field and I've set up an automation system connecting several devices (datalogger, radio, etc.) via Modbus RS485...
Replies
5
Views
211
Hi All, want to ask. I have PLC a programme to control the valve. The existing programme is to control valve A (Y22), and I want to change to...
Replies
2
Views
140
Back
Top Bottom