/
1 - Now let’s modify our sketch to add an analog input 1 - Now let’s modify our sketch to add an analog input

1 - Now let’s modify our sketch to add an analog input - PowerPoint Presentation

myesha-ticknor
myesha-ticknor . @myesha-ticknor
Follow
343 views
Uploaded On 2020-01-13

1 - Now let’s modify our sketch to add an analog input - PPT Presentation

1 Now lets modify our sketch to add an analog input Lets use the potentiometer from HW 4 Arduino Overview 2 Connect the Red wire to 5V Black to GND and White to A0 Arduino Overview ID: 772729

arduino overview sensor connect overview arduino connect sensor modify sketch add uno pin breadboard convert serial gnd sheet data

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "1 - Now let’s modify our sketch to add..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1 - Now let’s modify our sketch to add an analog input- Let’s use the potentiometer from HW #4 Arduino Overview:

2 - Connect the Red wire to +5V, Black to GND, and White to A0 Arduino Overview:

3 - Leave the LED connected to pin 9 but it won’t blink Arduino Overview:

4 - Potentiometer is acting like an analog sensor- We can now hook up any analog sensor and see its value (at least through serial)- What other sensors can we hook up?- Let’s add some…- But first let’s add the Protoshield Arduino Overview:

5 - Take out the Protoshield your team built in HW#4 Arduino Overview:

6 - Carefully connect it with your unpowered Uno Arduino Overview:

7 - Carefully connect it with your unpowered Uno Arduino Overview:

8 - Carefully connect it with your unpowered Uno Arduino Overview:

9 - Carefully connect it with your unpowered Uno Arduino Overview:

10 - Reconnect Uno to laptop and verify all is working- Activate Serial Monitor Arduino Overview:

11 - Disconnect LED Breadboard and connect wire from pin 9 to JC3 on ProtoShield- Activate Serial Monitor Arduino Overview:

12 - Carefully move wire to JC3 to JC2… Arduino Overview:

13 - Add the Temperature Sensor to the Breadboard Arduino Overview:

14 - Connect Pin 1 to 5V Arduino Overview:

15 - Connect Pin 3 to GND Arduino Overview:

16 - Connect Pin 2 to A5 Arduino Overview:

17 - Modify your sketch to add the following variable Arduino Overview:

18 - Modify your sketch to add the following lines in loop Arduino Overview:

19 - Compile and Upload- Activate Serial Monitor- Test by putting your finger on the sensor- Do you see a change? Arduino Overview:

20 - Convert to Voltage and display on Serial Monitor Arduino Overview:

21 - Should see this… Arduino Overview:

22 - Use spec sheet to convert to degrees C- 10 mV/C- Look for offset Arduino Overview:

23 - 0.5 V offset Arduino Overview:

24 - Modify your sketch Arduino Overview:

25 - Should see this… Arduino Overview:

26 - Data make sense?- How would you calibrate this sensor? Arduino Overview:

27 - Add the Humidity Sensor to the Breadboard Arduino Overview:

28 - Connect 5 V from Temp Sensor Arduino Overview:

29 - Connect GND from Temp Sensor Arduino Overview:

30 - Connect Out to A4 Arduino Overview:

31 - Modify Sketch Arduino Overview:

32 - Should get… Arduino Overview:

33 - Convert to voltage and understandable units from data sheet- Algebra Arduino Overview:

34 - Modify Sketch Arduino Overview:

35 - Should get… Arduino Overview:

36 - Data make sense?- How would you calibrate this sensor? Arduino Overview:

37 - Add the Accelerometer to the Breadboard Arduino Overview:

38 - Connect 3.3V to Vcc from UNO Arduino Overview:

39 - Connect GND to GND from Humidity Sensor Arduino Overview:

40 - Connect ZOUT to A3 on UNO Arduino Overview:

41 - Connect YOUT to A2 on UNO Arduino Overview:

42 - Connect XOUT to A1 on UNO Arduino Overview:

43 - Accelerometer has a few other settings we need address from the Data Sheet Arduino Overview:

44 - Sleep…Connect 3.3V from Accel Vcc to SLP Arduino Overview:

45 - Range…Connect 3.3V from Accel Vcc to GSEL Arduino Overview:

46 - Modify Sketch as follows Arduino Overview:

47 - Modify Sketch as follows Arduino Overview:

48 - Should get… Arduino Overview:

49 - Convert to voltage and understandable units from data sheet- Algebra Arduino Overview:

50 - Convert to Voltage = accelX * (5.0/1024)- Subtract offset and convert to Gs Gs = (voltage – 1.65) / (0.206) Arduino Overview:

51 Arduino Overview: - Modify Sketch as follows

52 Arduino Overview: - Modify Sketch as follows

53 Arduino Overview: - Should get…

54 Arduino Overview: - Hold X flat, should see 0 G

55 Arduino Overview: - Hold X arrow pointing up, should see 1.0 G

56 Arduino Overview: - Hold X arrow pointing down, should see - 1.0 G

57 Arduino Overview: - Repeat with Y and Z axes- May need to tape breadboard down- Do you need to Calibrate?- How would you do it?

58 - Add the Pressure Sensor to the Breadboard- Notice orientation Arduino Overview:

59 - Add the Pressure Sensor to the Breadboard- Notice orientation Arduino Overview:

60 - Connect Pin 2 to 5.0 Volts from your Humidity Sensor Arduino Overview:

61 - Connect Pin 4 to GND from your Humidity Sensor Arduino Overview:

62 - Connect Pin 3 to A0 on your UNO Arduino Overview:

63 - Modify your sketch… Arduino Overview:

64 - Modify your sketch… Arduino Overview:

65 - Compile and upload. Should see… Arduino Overview:

66 - Use ¼ sprinkler tubing to suck on pressure sensor- Do not blow as limit of this sensor is 15 psi Arduino Overview:

67 - Convert to voltagepV=A0*(5.0/1024)- Use spec sheet to solve for psi (Algebra)Pmax = 15 psiPmin = 0Vsupply = 5.0 V Output(V) = pV Arduino Overview:

68 - Solve for Pressure(applied) = PaPa = psi = (pV – (.1 * 5.0)) / (.8*5.0) / (15-0) psi = (pV – .5) / (.4 / 15) Arduino Overview:

69 - Modify your sketch… Arduino Overview:

70 - Modify your sketch…Suggest commenting out your accel and other sensor Serial.print statements Arduino Overview:

71 - Should see this…- Suck to zero? Arduino Overview: