Switches & whiskers on the Arduino living with the lab lever arm switches mounted to Arduino © 2012 David Hall.

Slides:



Advertisements
Similar presentations
Why won’t my Arduino work???? living with the lab © 2012 David Hall.
Advertisements

temperature system wiring
College of Engineering & Science living with the lab Ohm’s Law © 2012 David Hall 1.5V.
Using the servo library living with the lab Libraries are computer programs written to add functionality to Arduino programs. A library to control hobby.
Conductivity sensor implementation living with the lab © 2011 LWTL faculty team.
Analog and Digital Measurements living with the lab 14 digital input / output pins 6 analog input pins © 2012 David Hall.
Waterproofing a thermistor ENGR 121 living with the lab © 2013 David Hall.
Using the Arduino to Make an LED Flash Work in teams of two! living with the lab digital I/O pins (I/O = input / output) USB cable plug power pins.
User-defined functions in Arduino sketches living with the lab © 2012 David Hall.
Calibration of conductivity sensors living with the lab.
Using Your Arduino, Breadboard and Multimeter Work in teams of two! living with the lab 1 © 2012 David Hall.
Living with the lab Attaching Arduino to Boe-Bot Chassis © 2012 David Hall.
Thermistor calibration living with the lab © 2013 David Hall.
Cascaded switching of a solenoid valve living with the lab transistor relay solenoid valve © 2012 David Hall.
Assembly of conductivity flow loop living with the lab (in preparation for calibrating conductivity sensor)
Using fixed-cell references and built-in functions in Excel living with the lab © 2012 David Hall.
220  470  Gnd5V Currents Through Parallel Resistors 1 living with the lab © 2012 David Hall.
Using Hobby Servos with the Arduino living with the lab © 2012 David Hall.
Introduction to Microsoft Excel living with the lab © 2012 David Hall.
Voltage Drops Around Closed Loops 470  220  5V   220  living with the lab © 2012 David Hall.
Navigating the engineering disciplines robot challenge living with the lab © 2012 David Hall.
Kirchoff’s Current Law (KCL) living with the lab University of Pennsylvania Library and Wikipedia Gustav Kirchoff (left) and Robert Bunsen (right) Bunsen.
Adding a Barrel Jack to a Battery Pack living with the lab © 2012 David Hall.
Using for loops to control LEDs living with the lab 1 1 arduino.cc the for statement allows us to repeat a block of commands a limited number of times.
Building Circuits.
Pump Fabrication Day Group A will draw their pump
Controlling Servos with the Arduino
Connecting Switches.
Series and Parallel Resistors
Introduction to the Arduino
Why Won’t My Arduino Work?
Troubleshooting Your Multimeter
Using servos.
calibration of conductivity sensors
Servo Library and Functions
Line Following Tips photoresistor circuits
What’s in your kit?.
Robot Assembly.
How to Use Dial Calipers
Controlling a Motor with Cascading Switches
Introduction to Transistors
Introduction to the Fishtank
RGB LEDs.
Conservation of Mass Problem
Maxbotix Ultrasonic Distance Sensor
Conductivity Sensor.
Schedule 8:00-11:00 Workshop: Arduino Fundamentals
Introduction to Transistors
Servo Library and Functions
Troubleshooting Your Multimeter
a few of my favorite sensors
Relays.
using for loops to control LEDs
using the Arduino to make LEDs flash
Using Photoresistors with an Arduino
Line Following Tips photoresistor circuit
Data Types.
analog and digital measurements
Using “if” statements.
Digital Input from Switches
Implementing Switches Using Interrupts
Arduino: For Loops.
Non-Concurrent Force Systems
IR Object Detection IR detector IR LED IR light reflected off object
Radio Frequency Transmitter and Receiver
Interfacing a Rotary Encoder with an Arduino
Evaluating Design Alternatives
Counting Servo Gear Teeth (FS90R Servos)
Static Equilibrium Problem
Reservoir Loop.
Presentation transcript:

switches & whiskers on the Arduino living with the lab lever arm switches mounted to Arduino © 2012 David Hall

living with the lab 2 The content of this presentation is for informational purposes only and is intended only for students attending Louisiana Tech University. The author of this information does not make any claims as to the validity or accuracy of the information or methods presented. Any procedures demonstrated here are potentially dangerous and could result in injury or damage. Louisiana Tech University and the State of Louisiana, their officers, employees, agents or volunteers, are not liable or responsible for any injuries, illness, damage or losses which may result from your using the materials or ideas, or from your performing the experiments or procedures depicted in this presentation. If you do not agree, then do not view this content. The copyright label, the Louisiana Tech logo, and the “living with the lab” identifier should not be removed from this presentation. You may modify this work for your own purposes as long as attribution is clearly provided. DISCLAIMER & USAGE

the switches long lever with three electrical terminals can be wired as normally open (electricity flows only when switch pressed) can be wired as normally closed (electricity stops flowing when switch pressed) used with inch quick disconnect terminals 3 living with the lab

4 wiring when the switch is not pressed, electricity can pass through the normally closed (NC) path when the switch is pressed, electricity can pass through the normally open (NO) path

use a digital input to sense when switch is on or off 5 living with the lab ANALOG RESET 3V3 5V Gnd Vin AREF GND DIGITAL POWER 10k  switch switch status voltage at pin 7 status of digital input 7 0V (no power applied) 5V (direct connection to power) HIGH LOW closed (pressed) open (not pressed) digitalRead(7) check status of pin 7 using...

6 living with the lab why the 10kΩ resistor? ANALOG RESET 3V3 5V Gnd Vin AREF GND DIGITAL POWER 10k  switch using a large resistance limits the current so that we don’t waste electricity... any resistor will do, but there’s no sense in wasting power

7 hooking things up on your robot living with the lab space is tight, and it’s easy to break the quick disconnect terminals (can solder them if desired) connect wires to the common and normally open terminals on the switch

8 tools a wire stripper and some sort of crimping tool are needed (can also crudely crimp using a vise) living with the lab

9 completing the circuit on the breadboard to prevent wires from coming loose to make it easier to see what’s going on (easier to troubleshoot) living with the lab try to keep the wiring tidy... violet leads go to +5V source white and red leads provide digital input one 10kΩ resistor per switch is installed

10 programming this program causes the built-in LED on pin 13 to turn on when the switch is pressed living with the lab int whisker1=0; void setup(){ pinMode(7,INPUT); pinMode(13,OUTPUT); } void loop(){ whisker1=digitalRead(7); if(whisker1== HIGH) // whisker1==HIGH if whisker pressed { digitalWrite(13,HIGH); } // turn LED on pin13 on else { digitalWrite(13,LOW); } // turn LED on pin13 off } this is our first time to use if … else control (see next slide)

11 if / else if/else allows greater control over the flow of code than the basic if statement, by allowing multiple tests to be grouped together arduino.cc living with the lab if (x < 500) { // do Thing A } else if (x >= 1000) { // do Thing B } else { // do Thing C } can use an unlimited number of else if blocks... or none, as in the program on the previous slide