2-speed windscreen wiper with one button

FrankBerends

Member
Join Date
Jan 2021
Location
Holland
Posts
9
For my boat I'm designing a whole new control panel. Every piece of equipment to be controlled with just one (flip-flop) button.

For the windscreen wiper, I'm almost there. Just one little annoying problem to solve. The way it should work:
Momentary Push Button x1,
push 1 -> starts with speed 1
push 2 -> toggles to speed 2
push 3 -> toggles to speed 1
push 4 -> toggles to speed 2
and so on, until it stops raining..:

keep push button pressed for 2 seconds -> wiper switches off

What I've done is almost good, but at that 2 seconds push, it instantly toggles speed before it switches off. I know why :), but I don't know how to prevent that last toggle. Anyone that has a solution?
I'm quite a novice with PLC, so my setup is very straightforward, but at least this is simple to understand (for me).

wiper.png
 
You could probably simplify this a lot by using a counter. So your pushbutton can increment the counter. It appears that odd number of pushes, you want speed 1, even number of pushes, you want speed 2.

One cool "feature" of integers is that the least significant bit will determine if the integer is odd or even.
 
Try using a falling edge one-shot instead of a rising edge one-shot. That way the change of speeds happens when the button goes from true to false (when you let go of the button).
 
Make pulse timer and bit from your button one shot (something like 1s pulse)


If you have shorter pulse on button press than 1 second pulse (oneshot and 1 second pulse is still on ) -> change speed


if your 2s timer time exprires, then reset everything.


It could be also little bit easier if you add counter on every press and look on bit level bits 0 and 1 of counted value.


Reset = bits 1 and 0 are off
speed 1 = bit0 is one
speed 2 = bit1 is one and bit0 is off.
 
@dmroeder and @Incandenza nailed it. The only thing to add is that the change to speed 1 or 2 should happen on a falling edge, that way the rising edge is ignored and the hold can drive the timer. the order may also matter, because when the hold is released when the timer expires, it needs to ignore that falling edge.


also, is the application married to SET and RST instructions for the transitions? the only behavior that changes is what happens when the PLC stops and restarts (power failure/restore or mode changes out of/into Run). This can be done with a lot less noise.


It also depends on how the timers behave in your particular brand and model of PLC: do they expire asynchronously with the I/O and program scans, or do they only change state across the TON instruction? For example, I think the following would work with Allen-Bradley, which is of the latter variety.


wiper_20200211.png
 
Last edited:
I already tried that change to falling edge for x1. That seems to be good, until that final action: when you push x1 for 2 secs, all switches off.... until you release button x1, then it activates rung 1 again.
 
You need to look if reset timer is elapsed and change speed only if isn't.
(Now it reset bits after 2 seconds, but when you release button it will set 1st speed as rung1 looks falling edge after reset timer.)
 
Here is another approach using

  • @dmroeder's idea of the integer steps,
  • integer bits,
  • and the falling edge.

In this approach, the falling edge of the push button triggers all state changes, even turning off (instead of being ignored) when the timer has expired, by subtracting N7:0 from 3, and then MOVing N7:0 value into N7:1, which latter's two low bits are used to assign low speed and high speed. So

  1. if N7:1 is 0, then both speeds are off (bits 0 and 1 are 0),
  2. if N7:1 is 1, then low speed is on (bit 0 is 1), high speed is off (bit 1 is 0)
  3. if N7:1 is 2, then low sped is off, (bit 0 is 0), high speed is on (bit 1 is 1)

The N7:1 value is MOVed to N7:0 at Rung 0000 if the timer is not completed, so if N7:1 is 1 or 2, then N7:0 is also 1 or 2, and (3 minus N7:0) is 2 or 1, respectively, which toggles N7:1 between cases 2 and 3 above.

The image below in the state where the button has been held past timer completion, so N7:0 is 3 (overridden from the N7:1 value by the completed timer on Rung 0001, because the [T4:0/DN done bit] is 1), so on the next falling edge, N7:1 will transition to 0 (= 3 minus N7:0 = 3 minus 3), so the next state change will be to both speeds off.

It's about 40% fewer instructions than the OP with the two [XIO T1] instructions added. although I thought it was going to be even less.

Finally note that if both speeds are off and the button is held through timer completion, the timer will not turn on. I think that behavior could be modified to come on at the slow speed, by using N7:1 in the EQU on Rung 0003.

MicroLogix 1100/RSLogix Micro Starter Lite.

wiper_ml1100_20210211.png
 
One more approach, using bit operations for the 0=>1<=>2 transitions, but still bit-wise XOR and MOV instructions on the integers; one less rung but no fewer instructions.


wiper_ml1100_20210211.png
 
Try using a falling edge one-shot instead of a rising edge one-shot. That way the change of speeds happens when the button goes from true to false (when you let go of the button).

Anyone remember HyperCard?
On MouseUp







HyperCard was a basic kind of program that came with the original Macintosh.
 

Similar Topics

Does anyone know what the data transfer rate for this series of CompactLogix PLC's? 1769-L24ER-QB1B to be exact. Cheers.
Replies
1
Views
97
Hello, I am trying to setup on plc so If I enter 60 jph (job per hour) it will send the vfd hertz based on what jph is entered by...
Replies
2
Views
155
Sigh, DeviceNet noob... I have a 1756-L55, with a DeviceNet module, and 10 PF700 all commanded with DeviceNet. One of the PF700's blew up...
Replies
3
Views
131
Do i have to use interrupt subroutine, or immediate read high speed input, for Unitronics Samba plc or reading only the correponding register in...
Replies
2
Views
124
Hi all, I'm having trouble solving a problem I've been working on for several months, and thought you might like a stab at it. The machine runs...
Replies
22
Views
947
Back
Top Bottom