Arduino capability question

Hi

I'm new to arduino and I've tried out a few tutorials and am slowly getting the hang of it.

I'm trying to build a project and just wanted some advice on where to get started and whether it's even possible. It involves LEDs, timers and buttons.

I want to connect 9 LEDs and 10 buttons to my arduino.

The buttons will be labelled 1 - 8

When button 1 gets pressed, LED 1 turns on.
When button 2 gets pressed, LED 1 and 2 turn on.
When button 3 gets pressed, LED 1, 2 and 3 turn on.
When button 4 gets pressed, LED 1, 2, 3, and 4 turn on.
When button 5 gets pressed, LED 1, 2, 3, 4 and 5 turn on.
When button 6 gets pressed, LED 1, 2, 3, 4, 5 and 6 turn on.
When button 7 gets pressed, LED 1, 2, 3, 4, 5, 6 and 7 turn on.

These LEDs are indicators for number of days.

So, for instance, you press 2.
LED 1 and 2 turn on to indicate selection of 2 days.
After 24 hours, LED 2 will turn off and after a further 24 hours, LED 1 will turn off and LED 8 will then turn on to indicate that the timer has completed it's cycle and 2 days have elapsed.

The remaining button, 8 is used to reset the entire circuit and will light LED 9 to indicate that the circuit has been reset.

Is this at all possible to do?

Please advise, any help would be greatly appreciated.

Certainly it is possible. It's only software!

How accurate does the time have to be? If really accurate, you will need a real time clock board added to your list of stuff.

What about powering the device? If you use batteries, will they last until the times all expire?

You also need 8 220 Ohm resistors to limit current to the LEDs.

Paul

It doesn't need to be that accurate.

Losing a few seconds or even a minute per day isn't a problem.
I'll be powering my circuit with AC adapter.

I was concerned whether the Arduino would have enough pins to connect 19 items (LEDS and buttons)

Thanks for your assistance

pvanniekerk:
It doesn’t need to be that accurate.

Losing a few seconds or even a minute per day isn’t a problem.
I’ll be powering my circuit with AC adapter.

I was concerned whether the Arduino would have enough pins to connect 19 items (LEDS and buttons)

Thanks for your assistance

Are there 19 pins available on your Arduino?

Paul

An Uno has 13 digital pins, but it would be wise not to use pins 0 and 1 as they are used for communication with the PC. The 6 analog pins can also be used for digital I/O so you would have 17 pins conveniently available or 19 if you use pins 0 and 1.

You can get port-expander chips which allow (say) 3 Arduino pins to control 8 I/O pins

A Mega has about 60 I/O pins - and for a small extra cost may be simpler for a beginner.

...R

Paul_KD7HB:
Are there 19 pins available on your Arduino?

Paul

I have an UNO so only 14. Is there a way to "code" around this or am I limited by my hardware?

Goeie naand @pvanniekerk (ek neem aan engels is jou tweede taal...)

If you're looking at counting down days I would definitely look at getting a real time clock, they come with a small battery and you can tap the time whenever you like and figure out where you are in the cycle.

If for whatever reason your arduino crashes your millis() timer will reset so it'll have no idea where its at, time wise. I use the watch dog timer library - very very handy if you have a device that needs to keep itself awake and working.

So two things to look into - RTC and the watch dog timer for arduino.

RE the lights, that is fairly simple to achieve.

Hein

@OP

1. You have very clearly described using plain text the sequence of events that are going to take place. In fact, this is the very first step that is taught in a Programming Class -- describe your thoughts in plain English and in sequence.

2. Next step is to convert the sequence of the events of Step-1 into a Flow Chart (if possible for you!). A Flow Chart presents the the solution of a problem in 'visual form' using a set of pre-defined geometrical figures like -- oval (for start/stop, entry/exit, execute/halt), rectangle (ALU operation, initialization), parallelogram (data input/output), diamond (for taking decision), double-sided rectangle (to call a subroutine), arrow/flow line (to interconnect source and destination points).

3. Next step is to convert the Flow Chart of Step-2 into preliminary code using if-else structures.

4. Optimize codes of Step-3 using do-while or while-do or case-switch or for() structures or subroutines.

5. Connect 'basic (simple and elementary)' amount of hardware and the associated software; test it and check that you have achieved the expected result.

6. Add another incremental amount of hardware and software with the subsystem of Step-5. Test it to obtain the expected result.

7. Repeat Step-6 until the whole project is built and tested.

The methodology that has been described above is known as SSS (Small Start Strategy) Approach.

Goeie morê heinburgh

Ek bly hier in Seattle, WA.
Hoe is SA deesdae?

I'll definitely look into both of those,

I appreciate the help

SA nie so lekker nie :confused:

Ons bly in Zambia, heelwat beter.

Let us know how you get on.

pvanniekerk:
I have an UNO so only 14. Is there a way to "code" around this or am I limited by my hardware?

Sure, connect a number of pushbuttons as a voltage divider and read them through *one * analog input. It's been done before. Do a site search on 'analog pushbutton' or 'analog switch' for discussions of this topic.