Pages: [1]   Go Down
Author Topic: Light switches - Doable?  (Read 751 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good afternoon all.

I have a Arduino Uno and for my final year project at Uni I want to use it again.

I want to use about 30 household light switches and when you turn them on each one plays a different sound loop.

What I want to know is if its possible to connect a normal light switch to Arduino and if it is, is it possible to have that many light switches connected to it?

Also, if it can be done how would I even go about doing it?

Cheers!
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 553
Posts: 46286
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What I want to know is if its possible to connect a normal light switch to Arduino
Yes, but, not while it is wired to mains.

Quote
and if it is, is it possible to have that many light switches connected to it?
On a Mega, yes.

Quote
Also, if it can be done how would I even go about doing it?
One switch at a time.
Logged

Idaho, US
Offline Offline
God Member
*****
Karma: 19
Posts: 859
Special User
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also, if it can be done how would I even go about doing it?
If you want to use a regular Arduino instead of the Mega, you could use PISO shift registers or an I2C I/O expander.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the replies.

Would any of you kind folk know how to wire the light switch, so it connects to the Arduino or a website or something that will show me.

Cheers.
Logged

Offline Offline
Edison Member
*
Karma: 23
Posts: 1173
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Take a look at this example and this example.

The examples use momentary pushbutton switches, but a toggle switch would be wired the same way.

BTW -  A regular light swith is a SPST (single-pole, single-throw) on-off switch.  It has two terminals and works like any other SPST switch.

A "3-way" switch (like when you have one switch at the top of the stairs and another at the bottom) is a SPDT (single-pole, double-throw "on-on" switch with 3 terminals.    You can use a SPTD switch in plqace of an SPST switch if you leave one wire/terminal disconnected.  (But, "3-Way" light switches are more expensive.)
« Last Edit: October 22, 2012, 12:49:18 pm by DVDdoug » Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 50
Posts: 1767
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ordinary light switches should be do-able unless they have so much resistance that it wouldn't pass the smaller direct current that the Arduino puts out.

However, you won't be able to connect 30 light switches to an Uno or Leonardo without additional hardware, since those boards don't have 30 pins you can attach things to.  The Mega and Due do have 54 digital pins.  Bear in that 30 regular light switches will take up a large amount of room, plus the amount of wires, etc. you will need to hook all of these up.

If I were doing it, I would think about alternative inputs.  Perhaps a potentiometer or a rotary encoder that the user could have one control and dial to the 30 different inputs.  Or perhaps 3 4x4 membrane keyboards that would give you 36 keys.  Or perhaps a USB host shield and plug in a USB keyboard, and each key would be a different sound.

If you still want to do something like light switches, consider getting toggle switches that are much smaller than light switches, and can fit in breadboards, such as: https://www.sparkfun.com/search/results?term=toggle+switch&what=products.

You need to figure out what should be done, if the user presses 2 or more buttons at the same time.

In order to play sounds you will need a sound shield or something similar.  With AVR based arduinos, you probably won't have enough memory to hold 30 different sound samples, and you will need to think about  having a SD card to hold the sounds.  I think with the DUE that was officially announced today, that is less of an issue.  Here is the sparcfun audio shield: https://www.sparkfun.com/products/10628.

I would recommend, starting small, and concentrate on having only 2-3 keys at first, and then as you scale up, you may need to go to beefier hardware to handle that many inputs.
Logged

Pages: [1]   Go Up
Jump to: