LEDs and Sensors: Analog to Digital

Similar documents
Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM

Cornerstone Electronics Technology and Robotics I Week 15 Voltage Comparators Tutorial

Electronics 5: Arduino, PWM, Mosfetts and Motors

1. Learn about the 555 timer integrated circuit and applications 2. Apply the 555 timer to build an infrared (IR) transmitter and receiver

Conversion Between Analog and Digital Signals

Introduction to Arduino

RGB Wall Washer Using ILD4035

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

Basic DC Motor Circuits. Living with the Lab Gerald Recktenwald Portland State University

Basic DC Motor Circuits

Microcontroller-based experiments for a control systems course in electrical engineering technology

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

Basic Pulse Width Modulation

C4DI Arduino tutorial 4 Things beginning with the letter i

Introduction to Electronic Signals

Fundamentals of Signature Analysis

INSTALLATION MANUAL TRAILER LIGHTS CONTROLLER MODULE TYPE MP2-D1 / MP2-D2

Wireless Security Camera

Environmental Monitoring with Sensors: Hands-on Exercise

Arduino Lab 1 - The Voltage Divider

Experiment 8 : Pulse Width Modulation

Lab 3 - DC Circuits and Ohm s Law

Introduction to Arduino

Lab E1: Introduction to Circuits

Arduino Lesson 13. DC Motors. Created by Simon Monk

1 de 13. Kit de 37 sensores compatibles con Arduino

If an occupancy of room is zero, i.e. room is empty then light source will be switched off automatically

IR Communication a learn.sparkfun.com tutorial

Pulse Width Modulation

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

Surveillance System Using Wireless Sensor Networks

Joule Thief 3.0 Kit. June 2012, Rev Joule Thief 3.0

Analog control unit for mobile robots

Controlling a Dot Matrix LED Display with a Microcontroller

FREQUENCY RESPONSE OF AN AUDIO AMPLIFIER

Automation System TROVIS 6400 TROVIS 6493 Compact Controller

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

ECE 492 SENIOR PROJECT 2 MINI SUMO ROBOT

Pulse Width Modulation (PWM) LED Dimmer Circuit. Using a 555 Timer Chip

Lab 6 Introduction to Serial and Wireless Communication

Microcontroller Programming Beginning with Arduino. Charlie Mooney

Pulse Width Modulated (PWM) Controller for 12 Volt Motors

Electronics. Discrete assembly of an operational amplifier as a transistor circuit. LD Physics Leaflets P

Selecting and Implementing H-Bridges in DC Motor Control. Daniel Phan A

Arduino Lesson 4. Eight LEDs and a Shift Register

Microcontroller to Sensor Interfacing Techniques

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

Arduino Lesson 14. Servo Motors

APPLICATION NOTES: Dimming InGaN LED

The $25 Son of a cheap timer This is not suitable for a beginner. You must have soldering skills in order to build this kit.

RGB LED Strips. Created by lady ada. Last updated on :00:18 PM EST

Redesigned by Laurier Gendron (Aug 2006 ) Download this project in PDF. Horn circuit. Train Circuitry

LAB2 Resistors, Simple Resistive Circuits in Series and Parallel Objective:

Inductors in AC Circuits

AC : PRACTICAL DESIGN PROJECTS UTILIZING COMPLEX PROGRAMMABLE LOGIC DEVICES (CPLD)

Electrical Fundamentals Module 3: Parallel Circuits

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

Resistors in Series and Parallel Circuits

User and installation manual

Smart Thermostat page 1

LM 358 Op Amp. If you have small signals and need a more useful reading we could amplify it using the op amp, this is commonly used in sensors.

THE BREADBOARD; DC POWER SUPPLY; RESISTANCE OF METERS; NODE VOLTAGES AND EQUIVALENT RESISTANCE; THÉVENIN EQUIVALENT CIRCUIT

A Trigger Circuit for the 555 Timer IC Scope

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Student Exploration: Circuits

BUILDING INSTRUCTIONS

V out. Figure 1: A voltage divider on the left, and potentiometer on the right.

Accident Notification System by using Two Modems GSM and GPS

Physics 3330 Experiment #2 Fall DC techniques, dividers, and bridges R 2 =(1-S)R P R 1 =SR P. R P =10kΩ 10-turn pot.

Parts of a Computer. Preparation. Objectives. Standards. Materials Micron Technology Foundation, Inc. All Rights Reserved

Arduino Lesson 9. Sensing Light

Tristan s Guide to: Solving Series Circuits. Version: 1.0 Written in Written By: Tristan Miller Tristan@CatherineNorth.com

Wireless Audio Video Sender

Light Bulbs in Parallel Circuits

G-100/200 Operation & Installation

AP Physics Electricity and Magnetism #4 Electrical Circuits, Kirchoff s Rules

Character LCDs. Created by Ladyada. Last updated on :45:29 PM EDT

Measuring Electric Phenomena: the Ammeter and Voltmeter

Radio sensor powered by a mini solar cell the EnOcean STM 110 now functions with even less light

Servo Info and Centering

Hardware Connections between Arduino and IMU Nori Wilkins Apr. 5, 2013

New XUY roller sensors

LOW COST MOTOR PROTECTION FILTERS FOR PWM DRIVE APPLICATIONS STOPS MOTOR DAMAGE

The self-starting solar-powered Stirling engine

MODEL 5010 DUAL CHANNEL SMOKE/FIRE DETECTION MODULE

Scaling and Biasing Analog Signals

Special Lecture. Basic Stamp 2 Programming. (Presented on popular demand)

Experiment #5, Series and Parallel Circuits, Kirchhoff s Laws

Advanced LED Controller (LED Chaser)

1. Oscilloscope is basically a graph-displaying device-it draws a graph of an electrical signal.

Automotive Sensor Simulator. Automotive sensor simulator. Operating manual. AutoSim

THERMAL ANEMOMETRY ELECTRONICS, SOFTWARE AND ACCESSORIES

Tube Liquid Sensor OPB350 / OCB350 Series

A Digital Timer Implementation using 7 Segment Displays

Contents. Document information

ECE 495 Project 3: Shocker Actuator Subsystem and Website Design. Group 1: One Awesome Engineering

Constructing a precision SWR meter and antenna analyzer. Mike Brink HNF, Design Technologist.

Equipment: Power Supply, DAI, Variable resistance (8311), Variable inductance (8321)

Using voltage regulator to convert 5-12V range to 3.3V. Huan Lin

Transcription:

LEDs and Sensors: Analog to Digital In the last lesson, we used switches to create input for the Arduino, and, via the microcontroller, the inputs controlled our LEDs when playing Simon. In this lesson, we will again use input to control output, but this time we will use analog input and analog output. Analog Input The real world is not digital. Consider temperature fluctuation as an example, it generally moves within some range of values without making large abrupt changes. We can measure aspects of our world like temperature, light intensity, forces, or whatever using analog sensors. In a digital device, the resulting signals are stored as sequential digital data. Consider the analog signal depicted below. In a digital device, we discretize the input signal range (i.e., 0 to 5 Volts for the Arduino) into different voltage levels or intervals called states. The number of states is the resolution. Common resolution values range from 256 states (i.e., stored in 8 bits) to 4,294,967,296 states (i.e., stored in 32 bits); the Arduino uses 1024 states stored in 10 bits. This means that 5V/1024 or 4.8 mv is the smallest voltage change that you can measure. The translation of analog voltage values into different states is called Analog to Digital Conversion. The Arduino has built-in analog-to-digital conversion, and the analogread()command (it s actually a procedure call), is used to invoke that conversion process.

Analog Output As you know, the digital pins on the Arduino board can output either high (5V) or low (0V) on or off. But what if we want an output voltage in between 0V and 5V--something simulating an analog signal? Well, we can do this using a process called Pulse Width Modulation (PWM). Although we can t use the Arduino s digital pins to directly supply say 2.5V, we can pulse the output on and off really fast to produce the same effect. If you were to watch the output signal on an oscilloscope, you would see the output pulsing between high and low at regular intervals. Since this on-off pulsing is happening so quickly, the connected output device sees the result as a 50% reduction in the normal voltage (in this example). We can vary the output voltage (the effective voltage ) by regulating or modulating the width of the high pulse. For example, if we make the high pulse 25% as wide (in time) as the low pulse, the effective voltage will 25% of full voltage. On the Arduino, the analogwrite() command (i.e., procedure call) applied to an analog output pin is used to invoke the PWM process. In the next exercises, we will use a potentiometer and several sensors to generate analog input. We ll then use that input to control both digital and analog (i.e., PWM) output.

Analog I/O Exercise 1: LED Fader In this exercise, we will use a potentiometer to generate analog input. We ve used them before; a potentiometer, or, pot for short, is just a variable resistor. Connect the middle leg of the pot (the one marked measure in the image above) to analog pin 2 of the Arduino. Connect the other 2 legs of the pot to 5V and ground as shown above. Turning the knob of the pot changes the voltage experienced at pin 2 as shown below. Now add an LED to your breadboard and connect it to pin 9 of the Arduino as shown below. Note that pin 9 is an analog output, or PWM pin.

Now run the program PotDimmer by Tod Kurt to control the brightness of the LED using the pot. Observe how the LED light fades and intensifies depending on the position of the pot. Can you identify the line of code used to read the analog input? How about send the analog output? Why is the value read from input divided by 4 before it is used as output? Analog I/O Exercise 2: Theremin DO NOT BREAKDOWN THE CIRCUIT you created in exercise 1, but rather add a speaker to pin 7. Now run the Theremin program by Tod Kurt. Once you understand the program, modify it so that the input from the potentiometer not only controls the output of the speaker but also drives the LED. Create a seasonally spooky sound and light device. Be prepared to demonstrate your device and explain the changes you made to the class. Analog I/O Exercise 3: A Distance-Sensitive Theremin DO NOT BREAKDOWN THE CIRCUIT you created in exercise 2, instead replace the pot with the SHARP distance sensor. The SHARP distance sensor bounces Infra-Red (IR) light off objects to determine how far away they are. It returns an analog voltage that varies with the distance of the nearest object. These sensors are good for short-range detection, i.e., under 1m of distance. The leads of the distance sensor will have to be trimmed and twirled before they can be inserted in your breadboard. Connect the black wire of the distance sensor to ground, the red wire to 5V, and the white wire to analog input pin 2. Run the program that you developed for exercise 2 again. Vary the distance of an object in front of the eyes of the distance sensor and enjoy the effects.

Analog I/O Exercise 4: A Light-Sensitive Theremin This time replace the SHARP distance sensor with a photoresistor as shown in the schematic below. Use a large resistor such as a 10k Ohm (brown-black-orange) resistor for R1 in the schematic below. A photoresistor is a light-dependent resistor---brighter light means less resistance. Again, run the program that you developed for exercise 2 and enjoy the effect that varying the light on the photoresistor has on the sound and the LED.