Board logo

Controlling lights etc with momentary switches
flak monkey - 6/10/10 at 07:45 PM

One for the electrical wizards....

I ideally want to control all the lights on my bike with momentary push button switches on the handle bars, including the indicators.

Basically I want them to work so that you push the button once to turn the lights on, then again to turn it off.

Will a latching relay do this? Or do I need to look for something different or a different way of doing it? If its too complicated then I will start looking for compact latching push button switches


Davegtst - 6/10/10 at 07:49 PM

Yep a latching relay will do this.


flak monkey - 6/10/10 at 07:55 PM

Are there different types of latching relay? I see that some require 12v to another coil to change switch 'off' the relay which would need another switch to cancel?


Davegtst - 6/10/10 at 08:01 PM

This should do.
http://www.cbsonline.co.uk/latching-change-over-relay-rly6lat-3594-p.asp


MakeEverything - 6/10/10 at 08:14 PM

You want a Press to make Press to break relay. As dave suggests, one like the changeover relay that CBS offer.


flak monkey - 6/10/10 at 08:31 PM

Thanks

Just need to find some compact push button switches that look ok now


40inches - 6/10/10 at 08:38 PM

quote:
Originally posted by flak monkey
Thanks

Just need to find some compact push button switches that look ok now

Something like these?


owelly - 6/10/10 at 08:45 PM

I did a similar thing but used push to make to switch on and push to break to switch off. I used normal relays with the switched output looped through the push to break switch back into the coil. When you pushed the PTM switch, it triggered the relay and it stayed on because of the output being connected to the coil until you hit the PTB which released it. Probably a very complicated of doing somehting simple but thats what tedious nightshifts do to you...


tony-devon - 6/10/10 at 09:20 PM

I normally use a volvo car headlight relay

with the lights off pressing it flashes full beam, with lights on, it toggles between hi and lo, and its just one wire to the switch

I normally build with fat bars and drill and tap them, then fit a microswitch, failing that theres some great bar mounting switch housings on britchopper


Madinventions - 7/10/10 at 12:35 AM

At the risk of becoming slightly more complicated...

If there are several circuits to include it might be worth considering using a small microcontroller to handle the switches and control some standard (ie cheaper) relays? Almost certainly the way I'd do it, but then microcontrollers are my 'thing'. It'd let you do all sorts of odd things if buttons are held down or pressed briefly (ie flash indicator 3 times after a brief push, etc?)
Ed.



[Edited on 7/10/10 by Madinventions]


flak monkey - 7/10/10 at 06:41 AM

quote:
Originally posted by Madinventions
At the risk of becoming slightly more complicated...

If there are several circuits to include it might be worth considering using a small microcontroller to handle the switches and control some standard (ie cheaper) relays? Almost certainly the way I'd do it, but then microcontrollers are my 'thing'. It'd let you do all sorts of odd things if buttons are held down or pressed briefly (ie flash indicator 3 times after a brief push, etc?)
Ed.



Sounds clever Ed, always willing to learn something new

If you are at Diss on sunday I'll catch up with you there


BenB - 7/10/10 at 11:56 AM

It would indeed be a PoP with a nice little PIC. The only issue would be debouncing the switch either electronically or in software but that's hardly an untrodden path.


Madinventions - 7/10/10 at 12:43 PM

Debouncing in software is relatively simple. You just need to check the condition of the switch every few milliseconds via an interrupt loop. If the contacts are made, then increment a counter. If the contacts are open then decrement the counter. If the counter=0 then consider the button as not pressed. If the counter is greater than a certain number then it means that the switch has been pressed for a given duration. This makes it easy to check for short/long presses and even 'double clicks' given an extra bit of code.

Of course, it's only relatively simple because I do quite a lot of it. On the other hand, you should see my welding... Bloomin' awful!


I'd love to be able to help if I can Flak. See you Sunday.
Ed.