2-speed windscreen wiper with one button

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).


Lots of good ideas posted here. I think all of them will work fine.


But I don't see a simple debounce on the input ... maybe I missed that? Mechanical switches bounce (make-break-make-break ...) before stablilizing ON


I think that is what is messing with your code. It just runs too fast.


I think your original code would work fine if you debounce your input for maybe 50 ms or 100 ms, then use the DONE output of the timer instead of the direct input for your logic.



As a rule of thumb, I debounce all inputs to internal storage once per scan, execute my logic based on the internal storage, generate outputs in storage, then copy the output storage to hard outputs once per scan


It makes a lot of gremlins disappear
 
I simulated this in PSuite, originally using the LSB of Wiper Stat as the contact but since I don't see a way to do that in Click I just used an extra math statement to % 2 and use the result to determine hi/low.

Wiper Flip Flop.jpg
 
Lots of good ideas posted here. I think all of them will work fine.


But I don't see a simple debounce on the input ... maybe I missed that? Mechanical switches bounce (make-break-make-break ...) before stablilizing ON


I think that is what is messing with your code. It just runs too fast.


I think your original code would work fine if you debounce your input for maybe 50 ms or 100 ms, then use the DONE output of the timer instead of the direct input for your logic.
...


I am not sure about that: whatever rising edge, switched or debounced, is used, it will always toggle the speed in one of the first two rungs of the OP program, even if it is held for 2s at which point it turns the wipers off.


That said, I agree that a debounce is a good idea, although it should be a TOF on the falling edge.
 
Thank you all! I chose the falling edge option as this leaves most of my own solution in place. At least for me, that is easier to grasp. Still learning and your help is speeding that up enormously.
 

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
88
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
152
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
128
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
121
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
921
Back
Top Bottom