Introduction
Microcontrollers Programmers work in the virtual world. Machinery works in the physical world. The microcontroller connects the virtual world to the physical world A microcontroller is a small-scale computer with generalized (and programmable) inputs and outputs. The inputs and outputs can be manipulated by, and can manipulate, the physical world.
Arduino is hardware
Arduino is software Including an Integrated Development Environment (IDE) for programming. It’s used to edit code as if editing a word document The platform is used to create the “process”, compile it, and then upload it to the microcontroller. The language itself is based in C and is called ‘wiring’
Arduino is a platform A physical Input / Output board (I/O) with a programmable Integrated Circuit (IC).
Why Arduino? It is Open Source, both in terms of Hardware and Software. Anyone who wants can copy it for free It is cheap, the hardware can be built from components or a prefab board can be purchased for as little as $15 It can communicate with a computer via serial connection over USB (common interfaces) It can be powered from USB or standalone DC power. It can run standalone from a computer (chip is programmable) and it has memory (a small amount).
What can it do? CURRENT LIMITS!!! Sensors ( to sense stuff ) [ INPUTS ] Push buttons, touch pads, tilt switches. Variable resistors (eg. volume knob / sliders) Photoresistors (sensing light levels) Thermistors (temperature) Ultrasound (proximity range finder) Actuators ( to do stuff ) [ OUTPUTS ] Lights, LED’s Motors Speakers Displays (LCD) CURRENT LIMITS!!!
Autonomous Vehicle
Laser Harp
Clock
Sign Language Glove
Interfacing
Interfacing Plugs into pins like a breadboard
Inputs and Outputs
Concepts: INPUT vs. OUTPUT 18 Referenced from the perspective of the microcontroller (electrical board). Inputs is a signal / information going into the board. Output is any signal exiting the board.
Concepts: INPUT vs. OUTPUT 19 Referenced from the perspective of the microcontroller (electrical board). Inputs is a signal / information going into the board. Output is any signal exiting the board. Examples: Buttons Switches, Light Sensors, Flex Sensors, Humidity Sensors, Temperature Sensors… Examples: LEDs, DC motor, servo motor, piezo buzzer, relay, RGB LED
Analog vs. Digital
Analog vs. Digital 21 Computers “naturally” talk in a digital language. Things are either “ON” or “OFF”, “HIGH” or “LOW”, “1” or “0”, “5V or 0V” Our physical world is analog. Things can be “medium”, “warm”, “37 mph”, “92 degrees” So how do we create 2.75 volts if all we have is 0 and 5? With a technique called Pulse width Modulation (PWM) Imagine turning a fan off and on every second. It would operate at a “medium” speed. The longer the pulses (ON’s), the higher the average voltage and the actual voltage output.
Analog vs. Digital 22
Analog vs. Digital Fixed cycle length: constant number of cycles/sec 23 Fixed cycle length: constant number of cycles/sec
digitalWrite() analogWrite() BIG 4 CONCEPTS digitalRead() analogRead()
Components Push Button Potentiometer Photoresistor Relay Temp Sensor Name Image Type Function Push Button Digital Input Switch - Closes or opens circuit Potentiometer Analog Input Variable resistor Photoresistor Light Dependent Resistor (LDR) Relay Digital Output Switch driven by a small signal Temp Sensor Temp Dependent Resistor Flex Sensor Soft Trimpot RGB LED Dig & Analog Output 16,777,216 different colors
Scales
Scales Physical 0V 5V Digital Write LOW (0) HIGH (1) Digital Read Analog Read 1023 Analog Write 255