Suitable first project?

Hi there

Heads up: I am very bad with electronics, but good with programming.

Ok, now we have that out of the way.

I am looking for a little project, to give me an excuse to buy and play with an Arduino. It needs to be suitable for a first time Arduino’er.

My two daughters love to be asked quizes, so I thought maybe I could do something where I attach two buttons (one for each of them), when I ask the question I press my button, and then the first one of them to press their buttons lights up a led.

Is this do-able on the Arduino? Would it be too difficult as a first project?

Once I had done this I was thinking of adding a timer, and a scorekeeper led display also. Is this do-able to?

Let me know if I am being too ambitious first time out.

regards

Wongdai
Perth, Western Australia

I think this is a quite reasonable first project, if you’re confortable with programming already. It will require very few knowledge of electronics, so you’ll probably be easily successful with it, and it might lead you on the tracks for more complicated and ambitious projects for the next time :slight_smile:

Don’t hesitate anyway to try out the sample projects on the Arduino documentation, just to get a basic understanding on the way the I/O works.

Have fun :slight_smile:

I think this is a good entry level project.

Two very importatnt things to take into acount with this project is switch debouncing and pull up / down resistors.

A VERY good place to start understanding and handeling that, is to read lady Ada’s Arduino tutorial on using switches with Arduino.

It’s good to know about pull-up and pull-down resistors, but for this project you won’t need them. Instead, you can use the internal pull-ups that are on all of the mega168’s digital I/O lines. These internal pull-ups can be controlled in software. As far as debouncing goes, just realize that mechanical components physically bounce over very short timescales when two parts first make contact. What this means is that the signal from your button will rapidly alternate between high and low for a little while after the button is pressed. If your code isn’t careful, it might interpret this as many button presses rather than just one. The simplest way to deal with this bouncing is to insert a delay of perhaps around 10 ms after you first detect a change in the signal from the button. For example, in pseudocode:

// wait for button 1 to be pressed
while (button 1 signal is high)
  ;

// if we get here, button 1 has been pressed
// wait for 10 ms so the button can finish bouncing
delay(10);

// react to the button press

Ladyada’s button tutorial for some reason doesn’t mention the AVR’s internal pull-ups and instead, in my opinion, makes things more complicated than they need to be by implying that you need an external resistor in your circuit. Actually, it implies you need two external resistors, but if you’re careful not to use your input pin as an output in your code you can just connect a button or switch to ground on one side and directly to your I/O pin on the other. This can simplify things a lot.

  • Ben

Wow. Thanks for those great responses. I will order my Arduino on the weekend.

About the debouncing. I understand what you are saying, but surely, if the object of the device is to detect who presses their key first, then debouncing won’t be necessary. In other words, once I detect a keypress, all future keypresses (be they keybounce fake keypresses or not) will be ignored by the device (by my code) until I hit the reset switch for the next question.

Or am I being dumb?

Regards

Wongdai

No i don’t think you are being dumb :slight_smile:

The good thing about this project is that you can start easy and grow it.

For example by adding a few LEDs you can have a countdown bar after which it times out and maybe sounds a different sort of sounder.
Getting more complex you could extend this to a 7 segment display count down.

The important thing is to start simple and look at other designs and tutorials, as Tom Lehrer said plagiarise, plagiarise , plagiarise but always please to call it research.

About the debouncing. I understand what you are saying, but surely, if the object of the device is to detect who presses their key first, then debouncing won’t be necessary. In other words, once I detect a keypress, all future keypresses (be they keybounce fake keypresses or not) will be ignored by the device (by my code) until I hit the reset switch for the next question.

If the application itself makes impossible for you to detect multiple presses during the bouncing period, then no, you don’t need debouncing. However, it’s definitely a good thing to be thinking about as you write your code. A 10ms delay after your button processing won’t be perceivable to the user, so it won’t cost you anything, but the benefit it adds is that if you change around your code or try to reuse the button portion of your sketch in another sketch, bouncing won’t break things.

  • Ben

This is a very good first project idea because while it does start out fairly simple and with minimum hardware, you can evolve and make it a lot more complex as your skill and confidence improves.

Another idea for expanding it eventually could be a scorekeeper with 7-segment LEDs, but for now just get the basics working.

One project I’m working on now is similar to what you’re doing but I’m making it wireless using the six remote controls from a “Remote Possibilities” game.

Good s/w, no h/w.
To get a gentle introduction to hardware, a ‘Fun way into Electronics’ kit from your local DSE shop would be a good start. I bought mine yesterday, I’m in similar circumstances [but without the girls].
Don’t they know that D**k is a perfectly legal contraction of Richard? Took me a while to work out who ‘thingy Smith’ was, after which I changed it to DSE

Don’t they know that D**k is a perfectly legal contraction of Richard? Took me a while to work out who ‘thingy Smith’ was, after which I changed it to DSE

I wonder if “fanny” gets through…

EDIT: yes it does! I guess it shows you what’s rude in one country, might not have the same meaning in another!

You can always find a word that is perfectly OK in one language but rude in another, hence those emails circulating that contain pics of Eastern European and Asian brand names which sound rude in english.

From the point of view of the board, ‘rude’ is what the board’s writer says is rude, though perhaps mods can set the allowable level of ‘rudeness’.

Just remember, if you type a post and click Post and your posted post contains the word ‘thingy’ then most likely the board s/w decided you’d included a rude word.

After my very successful glowing orb, I am now ready to commence on my first real project - The Quiz Buzzer.

I need a hint though.

Is there a way for the Ardy to check when one pin goes high before another? (i.e. so I know who pushed their switch first).

(You don’t need to write the whole thing for me, just give me a hint to get me started.) :slight_smile:

Regards

Wongdai

Is there a way for the Ardy to check when one pin goes high before another? (i.e. so I know who pushed their switch first).

Anyone else find the abbreviation “Ardy” to be very trashy sounding?

The Arduino is fast enough that you can poll all the inputs in a few microseconds, which is more than fast enough to identify who pushed their button first. Just sequentially scan through the buttons.

If that were not fast enough (which it is), you could write an assembly routine to detect a pin change on interrupt, read the entire port at once, and then at your leisure, check which pit is pushed. That will get you down to a fraction of a microsecond resolution.

And, if you wanted to get down into a few nanoseconds of resolution, you can use an 8-bit latch IC.

lol@“trashy”. Ardy and I like to talk dirty to each other. She calls me Wangers. ;D

Thanks for your help on the polling. All I needed to know.

On with the show!