4-Button Sequencial Code using Arduino ?

First off, I am completely new to the Arduino "world".

I see this little "slice of technology" can be used in many various applications. My project : Can it be used along with 4 push button-switches as a type of "digital lock" where as a correct 4-button sequence has to entered to open or close a relay ?

Again, I am totally new and have no idea on how to build, program ( if needed ) a Arduino. I DO HOWEVER have 25 years plus of electronic gaming repair under my belt. So I am electronically able, just never heard of Arduino until now.

What is needed ? Do I need to program this thing ? I can read schematics which would also be a BIG help.

Thank you, I am really interested in building some projects using Arduino.


That will be super simple to do and should give you little to no trouble. You would do some simple programming with the free Arduino software to listen to 4 digital pins as inputs and use variables to track if the correct sequence has been pressed thru several "if" statements. then you would tell another digital pin to output HIGH and that would supply voltage for a small relay. the only hard part will be choosing which flavor of arduino you want! Chris

That's the part I don't know. BOTH the programming part and the "which one" to choose. I've never heard of Arduino until just now.

Thanks, Dave.

BOTH the programming part and the "which one" to choose.


If you haven't ever done it, then look at the examples in the IDE, peruse the online reference, check out code in these forums, and check out the playground; try the examples, try changing them to do different things or make them work differently; try combining the code you think you need. Look online for circuit examples, etc and then try to adapt them. If you have a concern, draw up a schematic as best as you can, write up your code, and post it in the appropriate area on these forums for help.

Ultimately, what most of us don't want is to do your work for you; if you show us you are trying, though, we will help you get the rest of the way and hopefully expand your understanding of the Arduino, programming, and electronics.

As far as "which one" for the project:

You will likely be best served by prototyping your project using a regular ole' Arduino Duemilanove (that's Italian for 2009, I believe); later (after you have things debugged) you might want to get a smaller version, or build an RBBB (Really Bare Bones Board), or roll-your-own (standalone). Don't worry about getting a "Mega" or one of the other "big boards"; they aren't needed for your learning, and the extra features might confuse you.

You'll also want to invest in a breadboard and some jumpers; I recommend Elenco for their breadboards (I've had one of the smaller ones for almost 20 years now and it still works great) - they are more expensive than other brands, but worth it IMHO.

Get a set of good jumpers (either straight or flexible - each person has their preference; I prefer straight for on-board runs, with flexible between separated boards or components); for your initial project you'll also want a relay (5V SPDT is fine), some NPN transistors (2N2222 are perfect), a selection of resistors and some cheap standard red LEDs - you might also want to get some pushbuttons, small toggle switches, maybe an 8-position DIP switch, some rectifier diodes (1N4004 is fine), a 7805 voltage regulator (or two), and a 4-cell AA battery holder (for 6 volt output - you can use a 7805 regulator to drop the voltage down properly). You might also want to pick up a cheap servo or two.

Those are the basic parts. Pick up a storage box with compartments to hold the components as well. Eventually, if you really get into this hobby, you will have many rows of those multi-bin storage cabinets; I have several myself, and will probably be shopping for more this weekend (part of my ongoing "clean up my shop" effort)...


Thanks so much again. That's exactly what I needed, A STARTING POINT. Thank you for pointing me in the right direction. Once I become more familiar with the Arduino, I have no doubt I'll understand how it works and how to make it work properly. Off to work I go.......