input the inputs on the arduino read voltage all inputs
play

INPUT THE INPUTS ON THE ARDUINO READ VOLTAGE. ALL INPUTS NEED TO - PowerPoint PPT Presentation

INPUT THE INPUTS ON THE ARDUINO READ VOLTAGE. ALL INPUTS NEED TO BE THOUGHT OF IN TERMS OF VOLTAGE DIFFERENTIALS. THE ANALOG INPUTS CONVERT VOLTAGE LEVELS TO A NUMERICAL VALUE. PULL-UP (OR DOWN) RESISTOR Often it is useful to steer an


  1. INPUT

  2. THE INPUTS ON THE ARDUINO READ VOLTAGE. ALL INPUTS NEED TO BE THOUGHT OF IN TERMS OF VOLTAGE DIFFERENTIALS. THE ANALOG INPUTS CONVERT VOLTAGE LEVELS TO A NUMERICAL VALUE.

  3. PULL-UP (OR DOWN) RESISTOR

  4. Often it is useful to steer an input pin to a known state if no input is present. This can be done by adding a pullup resistor (to +5V), or a pulldown resistor (resistor to ground) on the input. A 10K resistor is a good value for a pullup or pulldown resistor.

  5. PUSH BUTTON WITH PULL-DOWN RESISTOR When the button isn’t pressed, the voltage going to pin 7 is “pulled down” to 0 because it is connected, via the resistor, to ground. When the button is pressed, the resistance going to ground is higher than that going to the input pin so the full voltage is sent to the pin.

  6. CONTROL AN LED WITH A BUTTON

  7. USING THE INTERNAL PULL-UP RESISTOR When the button isn’t pressed, the voltage going to pin is “pulled up” to HIGH. When the button is pressed, the connection to ground is completed so the pin is LOW.

  8. CONTROL AN LED WITH A BUTTON

  9. TOGGLE AN LED WITH A BUTTON Only change the state of the LED when there is a change from LOW to HIGH on the button. The “old_val” variable holds the state of the button the last time through loop.

  10. TOGGLE AN LED WITH A BUTTON + DEBOUNCING Only change the state of the LED when there is a change from LOW to HIGH on the button. The “old_val” variable holds the state of the button the last time through loop.

  11. ANYTHING CAN BECOME A SWITCH

  12. ANALOG INPUT

  13. POTENTIOMETER

  14. RESET ICSP2 AREF RX TX L GND 13 IOREF 12 RESET Arduino 11 3V3 10 5V 9 GND 8 POWER GND TM DIGITAL (PWM= VIN 7 6 A0 5 A1 4 A2 3 ANALOG IN A3 2 ) A4 TX0 1 ICSP 1 ON A5 RX0 0 A B C D E F G H I J 1 1 5 5 WITH BLINKING LED POTENTIOMETER 10 10 15 15 20 20 25 25 30 30 A B C D E F G H I J

  15. READ ANALOG VALUES AND BLINK LED analogRead() gives values in a range from 0-1024.

  16. RESET ICSP2 AREF RX TX L GND 13 IOREF 12 RESET Arduino 11 3V3 10 5V 9 GND 8 POWER GND TM DIGITAL (PWM= VIN 7 6 A0 5 A1 4 A2 3 ANALOG IN A3 2 ) A4 TX0 1 ICSP 1 ON A5 RX0 0 A B C D E F G H I J 1 1 5 5 WITH PWM LED POTENTIOMETER 10 10 15 15 20 20 25 25 30 30 A B C D E F G H I J

  17. READ ANALOG VALUES AND FADE LED analogRead() gives values in a range from 0-1024. analogWrite() can only write values from 0-255. To account for this we divide the value received from analogRead() by 4.

  18. VOLTAGE DIVIDER

  19. VOLTAGE DIVIDER The resistor closest to the input voltage ( V in ) is called R 1 , and the resistor closest to ground R 2 . The voltage drop across R 2 is called V out , that’s the divided voltage our circuit exists to make.

  20. THE EQUATION

  21. IF R2 AND R1 ARE EQUAL THEN THE OUTPUT VOLTAGE IS HALF THAT OF THE INPUT. IF R2 IS MUCH LARGER THAN R1 (AT LEAST AN ORDER OF MAGNITUDE) THEN THE OUTPUT VOLTAGE WILL BE VERY CLOSE TO THE INPUT. IF R2 IS MUCH SMALLER THAN R1 THEN OUTPUT VOLTAGE WILL BE TINY COMPARED TO THE INPUT.

  22. PHOTOCELL WITH VOLTAGE DIVIDER

  23. PHOTOCELL WITH VOLTAGE DIVIDER R 2 (Sensor) R 1 (Fixed) Ratio R 2 /(R 1 +R 2 ) V out Light Level 1k Ω 5.6k Ω Light 0.15 0.76 V 7k Ω 5.6k Ω Dim 0.56 2.78 V 10k Ω 5.6k Ω Dark 0.67 3.21 V

  24. PHOTOCELL WITH VOLTAGE DIVIDER R 2 (Sensor) R 1 (Fixed) Ratio R 2 /(R 1 +R 2 ) V out Light Level 1k Ω 5.6k Ω Light 0.15 0.76 V 7k Ω 5.6k Ω Dim 0.56 2.78 V 10k Ω 5.6k Ω Dark 0.67 3.21 V What the input pin gets

  25. VOLTAGE DIVIDER You can “tune” the output of the sensor by changing the value of R 1 .

  26. READ ANALOG INPUT VALUES

  27. READ ANALOG VALUES AND CONTROL LED analogRead() gives values in a range from 0-1024. analogWrite() can only write values from 0-255. To account for this we divide the value received from analogRead() by 4.

  28. PRESSURE SENSOR WITH VOLTAGE DIVIDER

  29. PRESSURE SENSOR WITH VOLTAGE DIVIDER

  30. READ ANALOG INPUT VALUES

  31. READ ANALOG VALUES AND CONTROL LED analogRead() gives values in a range from 0-1024. analogWrite() can only write values from 0-255. To account for this we divide the value received from analogRead() by 4.

Recommend


More recommend