wiki:ControlSystems/Electrical/Training/Arduino/Lesson1

Getting to Blinky

  • DEVICES: Single board computer
  • TOOLS: Arduino Uno, Arduino Software, USB A-B cable, Windows or Linux computer
  • THEORY: Arduino programming (Embedded C/C++)
  • HANDS-ON: Write an Arduino program and get it running!

Arduino is a popular ultra-low-cost computing platform that is easy to program and build into robots and other devices. You should have received a kit that includes an Arduino Uno single board computer and USB cable. The objectives of this lesson are to learn about the Arduino Uno, install the Arduino software on your computer, connect your computer to the Arduino Uno, and load an example program onto it. We will also explore the Arduino Uno itself and the structure of an Arduino program. Let's get started.

The Arduino software includes everything you need to write programs for your Arduino Uno. Arduino software is available for Windows, Linux, and Mac OS. Many of the school computers already have Arduino software installed. If your computer does not have the software installed, download it now from here and install it on your computer. Please follow the detailed instructions on how to install the software and get started here.

Arduino Uno

https://upload.wikimedia.org/wikipedia/commons/3/38/Arduino_Uno_-_R3.jpg

The Arduino Uno is a single-board computer based on the AVR ATMega32 microcontroller; you can read more about it here. We use the Arduino Uno because it is easy and low cost (often available for under $3.50 or less than $10 via amazon prime). A microcontroller is a single integrated circuit that contains a microprocessor, memory, flash storage, and a host of peripherals to connect to other devices such as USB ports, serial ports, digital and analog input and output ports, etc. The Uno provides a standard interface (two rows of black connectors) that allow you to interface with many other devices. There are a wide range of off-the-shelf devices available that can plug into those black connectors; many are the same shape as the Uno and are referred to as "shields". You can purchase Ethernet shields, WiFi shields, Motor controller shields, etc. Shields have the same set of black connectors and are stackable. You can (and should) read about arduino shields here. Your kit includes a prototyping shield and in later lessons you will use a motor control shield to drive the motors in a mini-bot.

Arduino Software

If you followed the instructions above, you have already seen and run an Arduino program: blinky (if you haven't, please do so now). Arduino developers refer to programs as "sketches". Sketches are written in C and C++ which are the most popular languages for programming embedded computers (computers without screens and keyboards). Java is derived from C/C++ and is extremely similar; if you know Java, you will have no problem with C/C++. A good introduction to Arduino programming and the blinky example program is here (please follow the link and read the introduction).

Activities

You should now be familiar with the basic structure of an Arduino sketch including the setup() and loop() functions and you should be able to compile a sketch and load it onto your Arduino Uno. Try the following:

  • vary the speed and duty cycle of the blinking LED by changing the delays
  • make the LED fade in and out rather than blink on and off by varying a fast duty cycle

Other Stuff

  • You can even develop in the cloud (see here).
  • You can connect to your Arduino using Bluetooth
  • There are *many* other tutorials including:
  • MIT has numerous Arduino project and tutorial videos MIT.
    • Advanced users should pay special attention to this one which discusses using a small, inexpensive, bread-boardable ATTiny chip for your custom projects instead of using a whole Arduino board.
  • Another Arduino-specific wiki is here
Last modified 19 months ago Last modified on Nov 3, 2019, 4:26:30 PM