Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Microcontrollers 1 Microcontrollers • Programmers work in the virtual world • Machinery works in the physical world • Microcontrollers connect the virtual and physical world • The inputs and outputs can be manipulated by, and can manipulate, the physical world 2 3 Arduino is software • An Integrated Development Environment (IDE) for programming • Edit code like a word document • The platform creates the “process”, compiles it, and uploads it to the Arduino • The language is called ‘wiring’, and is based on C 4 Arduino is a platform • A physical Input / Output board (I/O) with a programmable Integrated Circuit (IC). 5 Why Arduino? • Open Source: anyone who wants can improve upon it • Cheap: anyone can produce them for any price (<$15) • Common Interface: communicates via USB • Low Power: from USB or battery pack • Standalone: memory allows it to run even when not connected to a computer 6 What can it do? • Sensors – – – – – [ INPUTS ] Buttons, touch pads, tilt switches Variable resistors (e.g.. volume knob / sliders) Photoresistors (light sensor) Thermistors (temperature sensor) Ultrasound (distance sensor) • Actuators – – – – [ OUTPUTS ] Lights, LED’s Motors Speakers Displays (LCD) CURRENT LIMITS!!! 7 Autonomous Vehicle 8 Laser Harp 9 Clock 10 Sign Language Glove 11 Interfacing 12 Interfacing • Plugs into pins like a breadboard 13 14 15 16 Inputs and Outputs 17 Concepts: INPUT vs. OUTPUT •Referenced from the perspective of the microcontroller (electrical board). Inputs is a signal / information going Output is any signal exiting the into the board. board. 18 Concepts: INPUT vs. OUTPUT •Referenced from the perspective of the microcontroller (electrical board). Inputs is a signal / information going Output is any signal exiting the into the board. board. Examples: Buttons Switches, Light Sensors, Flex Sensors, Humidity Sensors, Temperature Sensors… Examples: LEDs, DC motor, servo motor, piezo buzzer, relay, RGB LED 19 Analog vs. Digital 20 Analog vs. Digital • Computers communicate in a digital language – “ON” or “OFF”, “HIGH” or “LOW”, “1” or “0”, “5V or 0V” • Our physical world is analog – “warm”, “37 mph”, “92 degrees” • So how do we create 2.73 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. 21 Analog vs. Digital 22 Analog vs. Digital Fixed cycle length: constant number of cycles/sec 23 BIG 4 CONCEPTS digitalWrite() analogWrite() digitalRead() analogRead() 24 Components Name Image Type Function Push Button Digital Input Digital Input Switch - Closes or opens circuit Potentiometer Analog Input Analog Input Variable resistor Photoresistor Analog Input Analog Input Light Dependent Resistor (LDR) Relay Digital Output Digital Output Switch driven by a small signal Temp Sensor Analog Input Analog Input Temp Dependent Resistor Flex Sensor Analog Input Analog Input Variable resistor Soft Trimpot Analog Input Analog Input Dig Dig & Analog & Analog Output Output Variable resistor RGB LED 16,777,216 different colors 25 Scales 26 Scales Physical 0V 5V Digital Write LOW (0) HIGH (1) Digital Read LOW (0) HIGH (1) Analog Read 0 1023 Analog Write 0 255 27