Arduino All-in-One Getting Started Guide

Arduino All-in-OneAn all-in-one tutorial to getting started with the Arduino open-source electronics prototyping platform. This guide is meant for the beginner but should be also be useful to you if you already tinker with electronics but want to get started with the Arduino. Iā€™ll cover:
ā€“ breadboarding LED outputs from the Arduino
ā€“ creating and reading digital inputs to the Arduino
ā€“ how to program the Arduino to take the input and act on it to modify the outputs
Our demonstration project will consist of a set of three blinking LEDā€™s that blink in sequence. Youā€™ll control the speed of the blinks via a pushbutton controller. Iā€™ve designed this project to be modular in nature: we can create a fairly complex effect, but Iā€™ve wired and coded everything in a modular fashion to make it easier to follow. Of course, that means that neither the circuits nor the code are necessarily the most efficient way of doing things ā€” but the emphasis here is on making it clear and understandable.
Acknowledgement: Iā€™d like to thank Lady Ada for her excellent set of tutorials on the Arduino which is where I first learned Arduino basics. I cover a lot of the same ground, but her work has a very different flavor and emphasis including a different set of circuits and programs. I recommend that you pay her tutorials a visit. You can also buy Arduino boards and an wide variety of shields and accessories for the Arduino from her company, Adafruit Industries.
Hereā€™s how the finished project behaves:

Step 1 Testing Your Board / Getting Started

If you have already connected an Arduino to your computer and run the basic ā€œblinkā€ example you can skip this step. However, if all youā€™ve done is unbox it, hereā€™s how to start:
1) Download the software youā€™ll need from the makers: Software Download.
2) Install the software and connect your Arduino to your computer via a USB cable. It draws power directly from the USB port, so you donā€™t need to connect a power supply to it at this point.
3) If you have a newer board youā€™ll see a resistor next to pin 13 and an LED next to that. That LED works just as if it were connected between pin 13 and the ground (GND) pin next to it. If the LED is NOT on your board, just connect an LED between 13 and GND. You donā€™t need to do anything else since a resistor is already built in and limits the current through the LED so you donā€™t put your board at risk of a short circuit. NOTE: This resistor may not be present on really old boards (I just donā€™t know), but I doubt you have one of those.
4) Set your board type and serial port under ā€œToolsā€ in the software kit. The current version (at the time of writing) does not have an option for the newest Duemilanove boards, but choosing Diecimila works just fine.
5) Open the blink example from the software kit: Itā€™s under File | Sketchbook | Examples | Digital. The onboard LED (or the one you added) should blink on and off after you upload the Blink ā€œsketchā€ (as Arduino projects are called) to the board (File | Upload).
When you write programs for your Arduino, you will normally do much of your debugging in the software development kit by doing a Verify/Compile before uploading, but since we just uploading a pre-built test sketch I skipped that here.

Step 2 Wiring the Blinky Lights

Wiring the Blinky LightsIā€™ve broken the circuit down in such a way that we will be wiring up our output (the blinky lights) completely separately from our input (the pushbutton switch). Makes it easier to understand if youā€™re just starting out.
First, a note and word of caution. Newer Arduino boards have an LED right on the board itself or at least a resistor connected to pin 13 so that you can stick an LED right between pin 13 and ground (GND).
This is NOT true for the other pins! If you connect LEDā€™s or other circuits on other pins you must be certain to protect your board from excessive currents or full-out short circuits. You can fry your Arduino!
Personally, I recommend that you always use a resistor when experimenting. You donā€™t want to accidentally short to ground, so at least connect a low value resistor to the ground pin. Better safe than sorry.
In this circuit we are using pins 11,12 and 13 as digital outputs (5V) to power the LEDā€™s. The negative post of each LED connects across a single shared resistor and then to ground. In my circuit Iā€™m using a 150 ohm resistor (it was just a convenient grab from my parts bin). You can use other values here ā€” just donā€™t go too extreme so that you donā€™t either (a) keep the LED from lighting or (b) push too much current through your Arduino.
If you run the Arduino ā€œblinkā€ sketch from step one you should now notice that one of your LEDā€™s is blinking. If not, you should check back over your wiring and components. A diagram for this very simple circuit is below.

Step 3 Wiring the Pushbutton Switch

To keep things modular, the pushbutton switch also connects to your Arduino, but itā€™s a very separate circuit.
Note that the little pushbutton switches commonly available have four legs. The pins on each side are permanently connected to one another, so the button actually makes a single connection between the two sides. If youā€™re in doubt as to which posts are which, just check it with your multimeter.
In the circuit diagram youā€™re going to notice that we are using two resistors. Again, the exact values arenā€™t really important, but the relative values are. If you arenā€™t familiar with the concept of pull-up/pull-down resistors, please take a minute to really understand this circuit. If you donā€™t, you will likely get flaky results in future projects or ā€” worse yet ā€” burn out your Arduino.
When the switch is OPEN, the circuit is simply a connection from the digital input (pin 2 in our case) to ground through a couple of resistors. Since we are connected to ground the value at pin 2 is LOW (approximately zero volts). If we were connected only to the switch the value would be whatever noise the wires were picking up. Maybe it would be close enough to zero to work, but maybe not. We need that ground connection to make sure our reading is right.
When the switch is CLOSED, the 5V source is connected to ground across our 15k resistor. The 150 ohm resistor is negligible by comparison, so it has a minimal effect on the voltage our input pin is reading (5V) and the digital input is HIGH (~5V). The 150 ohm resistor keeps us from creating a short between the power source and the pin so that we donā€™t damage the Arduino.
Again, the exact values of these resistors are not important. Just make sure R1 is MUCH bigger than R2 and that R2 is big enough to limit the current back to the board. My values were simply plucked from my parts bin.
Clarification: The resistor is a pull-DOWN resistor because it connects the digital input to ground. A pull-UP resistor would pull the normal (no button pressed) state of the input to 5V.
For more Detail: Arduino All-in-One Getting Started Guide


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top