Hi guys! So, i managed to turn the relays connected to my Arduino Uno fine. But i used the normal push buttons to do it. What i would like to know is if it's possible to use those default switch buttons (the ones used to turn the lights on and off) to switch the relays on and off. I don't like the push buttons and i REALLY need those switch buttons on my project...
Push buttons come in all shapes and sizes.
There could be a normal pushbutton behind that wall plate.
But it could also be an on/off switch.
For the Arduino it's the same difference.
You might have to change your button detect code.
Leo..
Wawa:
Push buttons come in all shapes and sizes.
There could be a normal pushbutton behind that wall plate.
But it could also be an on/off switch.
For the Arduino it's the same difference.
You might have to change your button detect code.
Leo..
If there is an on/off switch behind the wall plate, what difference would it make in the code?
I would like to use that switch to turn the lights on and off using an arduino relay.
I'm new to Arduino, if possible i would like some advices.
eziosama:
If there is an on/off switch behind the wall plate, what difference would it make in the code?
I would like to use that switch to turn the lights on and off using an arduino relay.
I'm new to Arduino, if possible i would like some advices.
Thanks! (And sorry for my bad english)
Pretty good english, actually!
As for using the switch, I don't see why not. Most regular switches don't have voltage requirements except the capacity of the wire/metal they use, so feel free to wire up a switch to your relay. It won't affect anything code-wise, but no voltage can get through when it's OFF, obviously.
Digitalis:
Pretty good english, actually!
As for using the switch, I don't see why not. Most regular switches don't have voltage requirements except the capacity of the wire/metal they use, so feel free to wire up a switch to your relay. It won't affect anything code-wise, but no voltage can get through when it's OFF, obviously.
But should i connect the switch button to the arduino in the same way i connect the normal push button?
However, because we haven't seen the OP's code - we don't know if a regular switch will cause problems, versus a pushbutton (which itself may or may not be momentary, because the OP hasn't said).
You have given us a classic "x/y problem" - those don't work too well on forums.
Please tell us -exactly- what you are using - plus your code, plus your schematic, etc - and what you are trying to accomplish (not "will this work for my project" - because we don't know what your project is, what you are trying to do, etc).
post a link to where we can buy one of these switch buttons because it has a picture of a bell on it and it looks like a door bell so I can only presume its a door bell and that's probably not a switch.
with the link we can work out what kind of contacts it has.
If there is an on/off switch behind the wall plate, what difference would it make in the code?
I would like to use that switch to turn the lights on and off using an arduino relay.
I'm at a loss for why the arduino is needed in this circuit. If you're using a standard household switch to turn on lights, why do you need the arduino?
the item you're controlling is then only on or off while the button is pressed or not. You don't want to run a motor for an hour by having your finger on the button the whole time. Or...
you have to detect the state change and control the device when the button became pressed as on, and became pressed again to turn it off
Whereas a switch that stays on or off when you let go, is, well, on or off and that's the same as a push button that's held down.
In that respect there are three sort of switch:-
A momentary switch where theco facts are made as long as you hold down the switch and a hange over switch.
A change over switch when the contacts stay put until you switch it the other way.
A push on push off switch where the contacts make or break on alternat pushes.
These are normal domestic switches Avaliable from any electrical retailer in a mall close to you.
I'm at a loss for why the arduino is needed in this circuit. If you're using a standard household switch to turn on lights, why do you need the arduino?
Well one reason could be the Arduino needs to know if this switch is on off to start a timer etc.
But without more information, we will never know.
To answer your OP question, Are pushbuttons the only option? No. You could use a toggle switch, a pushbutton, a pot, all sorts of things that slightly change their electrical state when you touch or interact with them. It's up to your imagination and your level of google-fu. If you want to use your doorbell to turn on lights, something like this example might be helpful.