Introduction to Arduino Microcontrollers Death by Powerpoint Overview
Introduction to Arduino Microcontrollers (Death by Powerpoint)
Overview n Background Microcontroller defined/Why Arduino's? n Types of Arduino microcontrollers n What To Get (Hardware and Software) n Electronic Circuits n Projects n Examples n Inspiring the next generation of coders, hardware experts and tinkers. n
Microcontrollers – One Definition Programmers work in the virtual world. n Machinery works in the physical world. n How does one connect the virtual world to the physical world? n Enter the microcontroller. n A microcontroller is basically a small-scale computer with generalized (and programmable) inputs and outputs. n The inputs and outputs can be manipulated by and can manipulate the n
Arduino – Official Definition n Taken from the official web site (arduino. cc): n Arduino is an open-source electronics prototyping platform based on flexible, easy-to -use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
Why Arduino? n For whatever reason, Arduino microcontrollers have become the de facto standard. n n Make Magazine features many projects using Arduino microcontrollers. Strives for the balance between ease of use and usefulness. Programming languages seen as major obstacle. n Arduino C is a greatly simplified version of n
Why Arduino in Education? Programming Skills. n Electronic Skills. n Making the leap. n Inspiration. n Practical learning. Hacking! (Changing the way things work) n Cost! n So much so that the BBC got in on the act with > n
The BBC Micro: bit Still a microcontroller. n Similar concept. n Similar abilities. n Similar programing. n Beginner friendly. n Will be everywhere. n Not as practical for bigger projects. n
Learn through Doing. We learn fastest when inspired to play. n To Tinker. n To create, debug, and make something that works! n Electronics are cheap, kids can afford to create, play with and break / rebuild all sorts of projects. n Basic Arduino kits are cheap enough to give to kids! n Electronics are not a form of magic, take control. n
What Can Arduino Do? It can CONTROL devices. n It can SENSE through sensors. n It can INTERACT with the environment. n It can PROCESS what it senses. n It can OUTPUT to other devices or programs. n
Practical Applications. Displays. n Data Logging. n Robots. n Hacking. n Toys. n Games. n Creating. n Controlling. n
Arduino Types n Many different versions Number of input/output channels n Form factor n Processor n Leonardo n Due n Micro n Lily. Pad n Esplora n Uno n
Arduino Uno Close Up n The pins are in three groups: Invented in 2010 n 14 digital pins n 6 analog pins n power n
Micro When size matters: Micro, Nano, Mini n Includes all functionality of the Leonardo n Easily usable on a breadboard n
Lily. Pad n Lily. Pad is popular for clothing-based projects.
Where to Start Get an Arduino (starter kit). n Download the IDE. n Connect the Arduino. n Configure the compiler. n Connect the circuit. n Write the program. n Get frustrated/Debug/Get it to work. n Get excited and immediately start next project n
Arduino Starter Kits n Pre Selected Retail Kits. n n Ebay Kits. n n Advantage that multiple projects (and instructions) are usually included. Usually of very good quality and much cheaper than retail. Website Lists and purchase through Ebay. n There a plethora of sites offering part lists for the beginner with associated projects.
Typical £ 20 Kit.
Shields are circuit boards that plug into the top of an Arduino. n They extend the capabilities of an Arduino. n Examples: n Ethernet n GPS n Motor n Prototype n n shieldlist. org
What to Get – My Recommendation n Required: n n n n Arduino (such as Uno) USB A-B (printer) cable Breadboard Hookup wire LED's Resistors Sensors Switches n Good Idea: n n n Capacitors Transistors DC motor/servo Relay Advanced: n n Soldering iron & solder Heat shrink tubing 9 V battery adapter Bench power supply
What to get (Advanced) LCD Shield. n Multi Input Output Board. n Motor Control Shield. n Servos. n Relays. n Led Strips. n Prototype boards & Shields. n Bread Boards with PSU. n Lots of leds, resistors, motors, transistors & wires! n
Arduino Program Development Based on C++ without 80% of the instructions. n A handful of new commands. n Programs are called 'sketches'. n Sketches need two functions: n void setup( ) n void loop( ) n setup( ) runs first and once. n loop( ) runs over and over, until power is n
Arduino C Arduino sketches are centered around the pins on an Arduino board. n Arduino sketches always loop. n n n void loop( ) {} is equivalent to while(1) { } The pins can be thought of as global variables.
Arduino C Specific Functions n pin. Mode(pin, mode) Designates the specified pin for input or output n digital. Write(pin, value) Sends a voltage level to the designated pin n digital. Read(pin) Reads the current voltage level from the designated pin n analog versions of above n n analog. Read's range is 0 to 1023 serial commands
Compiler Features n n n Numerous sample sketches are included in the compiler Located under File, Examples Once a sketch is written, it is uploaded by clicking on File, Upload, or by pressing <Ctrl> U
Basic LED Circuit Connect the positive (+) lead of a power source to the long leg of an LED. n Connect other leg of the LED to a resistor. n High resistance means a darker light. n Low resistance means brighter light. n No resistance means a burned out LED. n n Connect other leg of the resistor to the negative lead of the power source.
Let the Good Times Roll! n At this point we have: Purchased a starter kit, including the Arduino n Connected and configured the Arduino n Connected a simple LED circuit n n Let's write some code!
Blink Sketch void setup( ) { Connected to one end of the circuit pin. Mode(13, OUTPUT); } void loop( ) { digital. Write(13, HIGH); delay(1000); digital. Write(13, LOW); delay(1000); } Connected to other end of the circuit
So What? Great. Blinking lights. Not impressed. n Blinking Signal can be reused in hundreds of projects. Control sirens, flashing lights, motors, valves, an SOS Beacon Project (light and sound). n Only covered output thus far. n Can use analog inputs to detect physical phenomena. n
Inputs n Digital inputs will come to the Arduino as either on or off (HIGH or LOW, respectively). HIGH is 5 VDC. n LOW is 0 VDC. n n Analog inputs will come to the Arduino as a range of numbers, based upon the electrical characteristics of the circuit. 0 to 1023 n. 0049 V per digit (4. 9 m. V) n
Analog Input-Application The variable resistor can be replaced with a sensor. n For example, a photo resistor. n n Depending upon the light level at the photo resistor: n Turn on a light n Increase or decrease the brightness of an LED (or an LED array) n Most sensors are simply variable resistors, but vary their resistance based on some physical characteristic.
Sensors can be both binary or a range. n Usually, sensors that measure a range of values vary their resistance to reflect their detection. n Arduinos can only sense voltages, not resistances. n Sensors that only vary their resistances require a circuit called a voltage divider to provide the Arduino a voltage. n
Common Sensors n n n Dials on a radio are simply potentiometers Temperature Light Angle Switches n n did the user throw a switch or push a button? Accelerometer (measures motion and n n Infrared sensor & light Hall effect sensor and magnet Ball tilt sensor (for measuring orientation) Force
Projects. Hacking pound shop electronics. n Anoyatron. n Data Loggers for science projects. n Distance Sensor. n Pretty Lights. n Automation. n Solve a real world problem. n Clock. n
Anoyatron. Costs < £ 2 n Beeps at random intervals. n Takes less that 30 minutes to make. n Runs on a single 3 v Battery. n Will run for 40 years on the power from this single battery. n Wins friends in the workplace! n
Advanced Projects. Robots! n Big Displays! n 3 D Scanners & Printers! n Drones! n Intruder Alarm. n CNC Machine. n LED interactive table. n Web Server. n
Simple Robot. n Features, Self correcting. n Handles Multiple tasks. n Various Logic for dealing with obstacles. n Behaviour seems more intelligent than it is. n Works by repeatedly banging it’s head on walls. n Seems well suited to an educational environment. n
Conclusion The Arduino microcontroller is a low cost way to enter into the hobby of robotics & Electronics. n The Arduino has two plusses over any other: n The user community n Extensive online library of code and projects n n Viewed as the "base" system, upon which all other microcontrollers are built. Compatibility.
Introduction to Arduino Microcontrollers
- Slides: 43