Introduction to Arduino Programming and Application Building
Duration: 3 Days
Course Background
The aim of this 3 day workshop is to provide some answers and explanations to the Arduino programming language, and to its basic syntax. Hopefully at the end of the workshop concepts such as functions, variables, arrays, if .. else logic, for loops and while loops should become a little clearer, and Arduino sketches should start to look a little less "intimidating". Maybe "little green shoots" of confidence in writing Arduino sketches from scratch will start to emerge. Because of time limitations it will not be possible to explore Arduino programming in full. However, a foundation for future study, either from books, or web resources or follow on courses and workshops will have been laid. Unlike traditional programming courses this workshop introduces programming concepts such as variables, branching, looping , input output, and the use of modules as a natural part of the problem solving involved in building sketches to perform various tasks of increasing complexity. The workshop is split half and half between instructor presentations and hands on labs.
Course Prerequisites and Target Audience
This workshop is for those who have little programming knowledge and who wish to go beyond simply "putting together" various Arduino sketches, or simply adapting existing sketches in a somewhat "trial and error" way. It has been devised in response to queries along the lines of " I have managed to build some Arduino projects, and they have worked, but, when I tried to develop projects of my own I have become "totally lost" It will be of great use to teachers who have to incorporate embedded systems computing into the emerging STEAM and CAS curricula and who find the prospect of becoming proficient in the various technologies involved quite daunting.
Course Outline
- Introduction to Arduino
- Microcontrollers and how they work
- How microcontrollers differ from PCs
- How microcontrollers are programmed
- How microcontrollers interface with sensors (e.g. buttons) and actuators (e.g. motors)
- The structure of Arduino sketeches
- How the Arduino sketch is transformed into working code
- How a compiled Arduino sketch is loaded and run
- Arduino sketching as problem solving
- Practical Digital Electronics by Example - Buttons and LEDs
- Microcontroller Digital Input/Output (I/O)
- Ports and I/O pins
- Wiring up LEDs and turning them on and off
- Wiring up switches and push buttons
- Events and Actions - Deciding what to do when a button is pressed or a switch is turned on
- Doing more fancy things with multiple buttons and multiple LEDs
- Functions and Variables Explained
- Functions as a means of reusing code
- Variables as a means of remembering values and of passing information into functions
- Functions as a means of providing "functionality" - a survey of the various functions provided by Arduino
- Functions that return values
- Devising your own functions
- Comparing values and comparison operators
- Logical expressions and logical operators
- Making decisions using if .. else statements and switch statements
- Functions as a means of providing "functionality" - a survey of the various functions provided by Arduino
- Timers and Their Uses
- Timers count time ticks
- Timers count up to some maximum number or down to zero and generate a signal when they have done so
- Timers can be configured to generate "ticks" at precise intervals
- Using timers to flash an LED(s)
- Using for loops and while loops to repeat pieces of code
- Experimenting with "interesting" lighting effects
- Generating interesting patterns
- Nesting loops within loops
- Reading analog values - Analog to Digital Conversion
- How Analog to Digital Conversion works
- Configuring pins for analog input
- Capturing analog values
- Reading a variable potentiometer by measuring the voltage across it
- Representing an integer value
- Displaying an integer value in binary using a bank of LEDs
- Representing positive and negative integers in binary
- Representing an integer in Binary Coded Decimal
- Displaying an integer using a seven segment LED
- Controlling power output using Pulse Width Modulation(PWM)
- Explanation of PWM
- The Arduino analog output as a PWM output
- Using PWM to vary the intensity of an LED
- Using a variable potentiometer to dim and brighten LEDs by converting its resistance to a suitable PWM analog output value
- Introduction to driving devices requiring higher voltages or currents than can be directly handled by the microcontroller
- Low voltage DC motors
- Servos
- Relays
- Serial communications
- Introduction to RS232
- How the RS232 port of the Arduino microcontroller communicates with the PC over a USB connection
- Using RS232 for communication between an Arduino and a PC