A quick romp through electronics, microcontrollers, and programming with the Arduino UNO

Dylan A. Shell

Introduction

This document aims to get you up and running with some programmable hardware so that you can invent your own things that move and interact with the world, and are reconfigurable and adaptive in what they do. It will consist of only smatterings of knowledge for the various pieces because our goal is to get to the point where you can play around on your own.

We focus on the Arduino UNO device, a self-contained microcontroller that is prized for its easy-of-use, its open-source design, and the availability of examples of web. As a microcontroller it includes a microprocessor and a little bit of memory (to store programs and data), a USB connector, a separate power connector, a clock, some blinking lights, and various other bits of circuitry for interacting with the world (a.k.a. I/O circuits). Think of it as a cut down computer (close to a programmable calculator), but specialized for connecting stuff up to it. The Arduino is robust, so it'll be quite forgiving should things be wired-up incorrectly.

I don't want to assume much background—so we'll go through the bits and pieces of the hardware and software gently. Much of this tour will be done in person, so the notes aren't intended to be complete by themselves. Instead, they have cues to take us through the various bits to make sure we build-up in a logical sequence, learning things as we need them, and nothing critical is omitted.

What you need to bring

Check that you have the following:

A 9V Battery From http://www.beckyandmetoys.com/components/com_virtuemart/shop_image/product/full/9V.jpg
A USB Type B cable (e.g., for printers) From http://www.ebay.com
Your laptop (it is worthwhile trying to install the arduino software, mentioned below.) From http://www.istockimg.com

Inventory (what you'll be supplied with)

Check that you have the following:

Arduino UNO From https://blog.arduino.cc/wp-content/uploads/2014/12/
A 9V wall adapter power supply From http://www.makershed.com/products/9v-wall-adapter-plug-for-arduino
A 9V battery leads From http://www.taydaelectronics.com/media/catalog/product/cache/1/image/500x500/9df78eab33525d08d6e5fb8d27136e95/a/-/a-656.jpg
Breadboard From https://en.wikipedia.org/wiki/Breadboard
A few jumper wires From http://www.australianrobotics.com.au/sites/default/files/imagecache/product_full/mcjw3.jpg
Aligator leads From http://www.aliexpress.com/item/2Pcs-Dual-Red-and-Black-Test-Leads-with-Alligator-Clips-Jumper-Cable-16GA-Wire/32429210681.html
A few resistors From https://d114hh0cykhyb0.cloudfront.net/images/uploads/resistors-0004-2b.jpg
Four pin LED From http://cdn.instructables.com/FYP/3IV4/IBC21WLG/FYP3IV4IBC21WLG.MEDIUM.jpg
A micro button switch From http://www.alpha-crucis.com/1861-2351-thickbox/pulse-mini-switch-button.jpg
A potentiometer (variable resistor) From http://www.mouser.com
A photoresistor From http://cdn.instructables.com/FOH/F83V/IAMCFJPJ/FOHF83VIAMCFJPJ.MEDIUM.jpg
A NPN-Type transistor From http://www.amazon.com
A 30 cm length of flexinol/muscle wire From http://www.ebay.ie

Before we begin...

Go to http://www.arduino.cc, download and install the latest IDE for your computing platform. We will continue with some preliminaries, that do not need to use the arduino yet.

Electronics basics

  1. Connect the LED to a 9V battery. This link shows how the colors work.
  2. It is better to connect the LED through a resistor. Ideally a 220 Ω resistor (look for color code in bands: red red brown gold). Here is a reference This is a reference for how the color codes work. If you're lazy here's a list of the common resistor sizes.
  3. A breadboard is quite useful for wiring components with little fuss. See this image describing how they work.
  4. Make a circuit with the micro button switch that turns the LED on/off.
  5. Make a circuit with the potentiometer in series with the LED.

During these exercises, cut to length and strip jumper wires as needed.

Arduino: First steps

  1. Take the arduino out of its box.
  2. Add the rubber feet to the bottom of the circuit board.
  3. Connect the arduino to your laptop via the USB cable.
  4. Also check that your wall adapter works when plugged in.

Arduino: Sensors and Input

Power, reading an analog value, the "Serial Monitor"

Tweak the code

Generalize the hardware

Arduino: Outputs

Output pins

Flexinol, and amplification via a transistor

The output pins from your arduino are really intended as signals. They aren't intended to do the heavy-lifting of actually powering components. When the components are LEDs, then it's no sweat. But if we're actually going to be moving things in the real world, we shouldn't be relying on those output pins to provide the necessary power. And doing so can damage the arduino, so try to avoid it.

What we need is to have a beefy flow of current, and a way to use the output pin just to throw the switch to turn that flow on/off. That is what the transistor component does.

This picture gives an all-in-one description of how your NPN transistor works. This figure shows the schematic for your transistor and how relate this to physical component. We'll be connecting a 1K Ω resistor (brown black red gold)between the output pin and the base. Be careful not to mix up the pins of your transistor: if you put an LED in backwards the current simply doesn't flow (thats the Diode part). But if you send all the power through the Base to the Emitter, it can destroy the transistor.

This is an example of "heavy-lifting" because the shrinkage comes from heat. Current is turned into heat, affecting the physical properties of the material. Once current is removed, the material cools by dissipating the heat.

Input and output

Notes & Resources

The sources and copyright owners of various images are acknowledged in "alt" tags.