5 buttons 16 led's

Hello,

I am just starting with arduino and programming. Reason why is , my brother ask me would be possible to make his house lighting smart. So I started google it and I found lots of very expensive sollutions like KNX or EIB witch we couldn't afford simply because of the price. Than I found arduino. I like the idea and I would like to lern the coding an more about the electronics which I will do.

At the moment my brother has to start doing a wiring and we are bit under the pressure. Idea is just for start to control 16 outputs using just 5 push buttons. I have everything connected on my bradboard.

I have 3,2-3,5V LED on 5V outputs, I have counted that 850 resitors should be used. I have used 1k resistor for each LED

buttons have 5V on one leg and inputs to the arduino wit 10k pull down resistor each on other leg of the pushbutton.

Is it possible to switch one button betwen let say 3 outputs? I was thinking to use buttonPushCounter and button Status. I don't know yet how to make the buttonPushCounter for more than on button.

Hope it is understandable what I was trying to explain. I am sorry for my writng I am not English

Thank you for any suggestionss.

Chris

5 buttons 16 leds...

850 1k resistors?

1kohm=1000 led is a bit dimm but that is not the point for me is close enough. it is only for testing

Yes, you can control 3 outputs with one button with a counter that counts say 1-3. Do more then one output need to be on at one time?

yes, let say there is a 1 swich in a room with 3 diferent groups of ligths controled by this swich, I would like to be able to switch on or of one of the groups using just one swich. example: I swich on group one and it stays on than I will swich off second group and switch on 3th . Than I am comming back to the room to swich off 1st group sitch on 2nd and swich off 3th. Normallu you would have 3 swiches for each group off lights I was thing to find a way to change a swich over let say 3 groups to make them on or off and let them stay in that state until next command from the swiich.

Hope it make sens.

You can use a 3 bit binary counter. say 0 = all off, 1 = 1 on. 2= 2 on, 3 = 1&2 on, 4 = 3 on, 5 = 3&1 on, 6 = 3&2 on, 7 = 3&2&1 on.
Only you will have to push the button 8 times to cycle through all combinations.

how is it work if I would use second swich button used only to swich the groups ? let say: 1 button to oprate a 3 groups of lights and one just to change over the groups?

make sens?

steinie44:
You can use a 3 bit binary counter. say 0 = all off, 1 = 1 on. 2= 2 on, 3 = 1&2 on, 4 = 3 on, 5 = 3&1 on, 6 = 3&2 on, 7 = 3&2&1 on.
Only you will have to push the button 8 times to cycle through all combinations.

can I use buttonPushCounter combine with led which turns on whe counter counts 8 times with let say 200ms delay.

I press the button and wait 8x200ms after that led will indicate tha 8xpushes state and turns on letting me know which group off lghts i will operate now.?
is that make sens?

That should work OK, only 200ms delay sounds a bit short. Easy to change if that's the case.

can I get any help how to program it with 3 bit binary counter?

I have used 1k resistor for each LED

The typical value is 220 ohms. In order to know what value is the correct value you need the forward voltage and forward current.
You can measure this using a 220 ohm resistor and then recalculate for the correct value.
ie: if the forward voltage is 2.2V , the forward current would be 12.7 mA using a 220 ohm resistor.
In general you can use anything from 100 ohm to 330 ohm before it starts looking dimmer.
ie:

Then RDropping = (VIn-VLoad)/ I Load= (5V-2.2V)/ 0.020 A = 140 ohms

raschemmel:

I have used 1k resistor for each LED

The typical value is 220 ohms. In order to know what value is the correct value you need the forward voltage and forward current.
You can measure this using a 220 ohm resistor and then recalculate for the correct value.
ie: if the forward voltage is 2.2V , the forward current would be 12.7 mA using a 220 ohm resistor.
In general you can use anything from 100 ohm to 330 ohm before it starts looking dimmer.
ie:

Then RDropping = (VIn-VLoad)/ I Load= (5V-2.2V)/ 0.020 A = 140 ohms

LED’s i have used are 3,2-3,5 20mA max 30mA
Then RDropping = (VIn-VLoad)/ I Load=(5V-3,2)/0,02=90ohms

my mystake i do not know how I count 900ohms… thank you

one more think, how to make button pushCounter reset every let say 1 min and can I use it to swich diferent LED's let say:

2 pushes LED 1 on 4 pushes LED2 on 6 pushes LED3 on after one min buttonPushCounter will reset and start count from begining and I could use it again for swiching the LED off: than next time it Will work oposite: 2 pushes LED 1 off 4 pushes LED2 off 6 pushes LED'3 off.

Is that possible? any help with the code would be nice bit if not just want to know can I do it, if yes I will dig and make it working

thank you

instead of doing up to 8 presses for different modes, I would suggest doing 3 presses, either short or long. a short press indicates off, a long press indicates on. The click sequence have to be completed within a set time, say 5 seconds, before it resets. so for example: press long press press Turns on led 2, and 1 and 3 is turned off

long press long press press turns 1 on and 2 and 3 off

3 quick presses switches all lights off

this should be easy to code, and you can set the timings for the long and short delays to something that feels natural to you and the button you are using.

I have used 1k resistor for each LED

So have I at times. I'm not blind, and sometimes I just want an indicator. Not light up the whole room.

my mystake i do not know how I count 900ohms.... thank you

When in doubt, measure the resistor with a DMM on Ohms scale.

TRex:
instead of doing up to 8 presses for different modes, I would suggest doing 3 presses, either short or long. a short press indicates off, a long press indicates on. The click sequence have to be completed within a set time, say 5 seconds, before it resets.
so for example:
press
long press
press
Turns on led 2, and 1 and 3 is turned off

long press
long press
press
turns 1 on and 2 and 3 off

3 quick presses switches all lights off

this should be easy to code, and you can set the timings for the long and short delays to something that feels natural to you and the button you are using.

any suggestions about the code itself. I am not asking about a ready to past code just what tools, liberys etc I should use.
Like I said I am very new to this.
Thank you

how to make button pushCounter reset every let say 1 min and can I use it to swich diferent LED's let say:

2 pushes LED 1 on 4 pushes LED2 on 6 pushes LED3 on after one min buttonPushCounter will reset and start count from begining and I could use it again for swiching the LED off: than next time it Will work oposite: 2 pushes LED 1 off 4 pushes LED2 off 6 pushes LED'3 off.

Is that possible? any help with the code would be nice bit if not just want to know can I do it, if yes I will dig and make it working

You need to develop the software for the button presses first using ordinary leds driven by individual outputs. Start with this and get this working first . Then modify it to do the above. http://www.arduino.cc/en/Tutorial/Switch