Difference between revisions of "Arduino tutorial"

From Open Garage Wiki
Jump to: navigation, search
Line 17: Line 17:
<span style="background-color: yellow;">Explanation: Anthony gives tour of hardware</span>
<span style="background-color: yellow;">Explanation: Anthony gives tour of hardware</span>
* About Arduino & Raspberry Pi
* Computer basics (16Mhz, 2kb RAM, 32kb ROM)
* Open hardware & alternatives
* Shields etc
* Community
* Tour of the hardware
=== Install ===
=== Install ===

Revision as of 14:16, 26 March 2021

The goal of this tutorial is very generic for any beginner, you'll learn all the basics to use digital, analog and serial inputs and outputs on the Arduino, allowing you to transfer your digital skills into the physical world. A dedicated student will be able to go through all these steps in about two hours.


Parts needed

  • Arduino (we prefer to use the original UNO version, which is most common)
  • Internet connected computer on which you can install the Arduino IDE (Windows, Mac, Linux)
  • USB B cable
  • LED
  • Breadboard
  • Collection of male-male breadboard wires
  • 220 ohm resistor
  • Button
  • 10K ohm resistor
  • Potentiometer


Explanation: Anthony gives tour of hardware

  • About Arduino & Raspberry Pi
  • Computer basics (16Mhz, 2kb RAM, 32kb ROM)
  • Open hardware & alternatives
  • Shields etc
  • Community
  • Tour of the hardware


Parts: Computer, Arduino, USB B cable, internet

  • Connect Arduino with USB B cable to computer
    • Green Power LED turns on
    • Default factory setting: orange LED near pin 13 blinks
  • Install Arduino IDE from http://arduino.cc/en/main/software

Basics of digital output: Blinking LED

A blinking LED is the Hello World of electronics.

Parts: LED

  • Load the blinking LED example program in the Arduino IDE (File > Examples > Basics > Blink)
  • Verify & Upload the program to the Arduino
    • Arduino not found? Under "Tools" in the main menu: check whether board (Arduino Uno) and port (dependent on your computer's settings) is correctly configured
  • Add an LED between pin 13 (long leg) and GND (short leg)
  • Change the speed of the blinking LED
  • Make "SOS" with the blinking LED
    • In Morse code, SOS stands for "Save Our Souls"
    • It has its own symbol, ...---..., dot dot dot dash dash dash dot dot dot
    • In Morse, a dash is 3 times as long as a dot, the delay between dashes/dots is as long as a dot. Symbols are separated with a delay that is as long as a dash

Intermezzo: Anthony explains the breadboard, basics of resistors for LEDs, buttons and pull-up/pull-down resistors.

Parts: LED, breadboard, wires, 220ohm resistor

  • Add an LED on pin 12 and animate both LEDs (you'll need to move to the breadboard to add a resistor!)

Basics of digital inputs: Buttons

Parts: Button, 10kohm resistor

  • Add a button with a pull-down resistor to your existing LED project, see http://www.arduino.cc/en/Tutorial/Button with code in (File > Examples > Digital > Button)
  • Let your LED on pin 12 turn on when the button is pressed.
  • Change the pull-down resistor circuit to a pull-up resistor circuit and change the program so that the button example works correctly again.

Intermezzo: Anthony talks about analog inputs, outputs and communicating data to the computer.

"Analog" output

  • Change the LED to PWM (File > Example > Basics > Fade)

Analog input

Parts: photoresistor, potentiometer

  • Keep the PWM LED and replace the button with a photoresistor, with Files > Examples > Basic > AnalogReadSerial
  • When the program is running, open the "Serial Monitor" in the Arduino IDE to monitor photoresistor values being sent over serial USB connection
  • Replace the photoresistor and pull-down resistor with a potentiometer
  • Control the PWM LED brightness with the potentiometer


What will you build next?

  • Find a project in the Arduino book and make it!
  • Take a sensor, or a motor, or a display, Google its symbol/number/registration together with the term Arduino and make something!