Recitation 3 – Sensors

Exercise 3:

Working in pairs:

Choose one of the the following sensors—not provided in your Arduino kit— and read about it:

Attach it to your Arduino and use the data from your sensor to turn on and off an output (Servo motor, LEDs, Buzzer, etc.). Document your work on the documentation blog.

Here are some notes that can help you:

For Moisture Sensors, Sharp IR Sensors, and Vibration Sensors you can use simple analog read.

In the case of Infrared Distance Sensors using map() can be helpful to map the analog readings from the sensor to the distance between the sensor and the object it is sensing — look at the bag of your sensor to know what is its distance range. For the Sharp Infrared Distance Sensor you can also follow the sample code available here.

To create a Vibration Sensor you will need a piezo disk and a 1M resistor. You can use the Knock example on your Arduino IDE — under Examples —> 0.6Sensors.

For the HC-SR04 you can use the Ping example on your Arduino IDE — under Examples —> 0.6Sensors. In order to do that you will have to connect both Trig and Echo to the same Digital Pin in your Arduino.

For the Grove 3-Axis Accelerometer you can use the ADXL3xx example on your Arduino IDE — under Examples —> 0.6Sensors.

Recitation 2 – Arduino Basics

Exercise 2:

Working in pairs:

We realize the documentation on your kits suggest you use the prototyping shield. We suggest you skip the shield and hook them up using the documentation below. Remember: you still need to program the arduino with example code from the DFRobot link.

Traffic light(click to make bigger)

Temperature Alarm. 

Warning: Make sure your temperature sensor is placed in the correct orientation. If it’s wrongly placed, it may get hot and you might get burned.

The temperature alarm will turn on if it’s hotter than 27 degrees. Place your finger on the sensor to heat it up. You can click the magnifying glass sign of your Arduino IDE to see the values coming into the sensor. We will talk some more about this button and what this is showing you during class.

You can see what the sensor is reading by clicking the magnifying glass.

Ambient Light

The ambient light needs a flashlight or the light on your phone to activate. Place it over the sensor to see the LED change.

RGB Light Dimmer

Recitation 1 – Basic Circuits

Exercise 1:

  • Working in pairs, create three simple circuits on a breadboard based on the circuit diagrams below and take photos and notes to post later on the documentation blog (we will go over documenting your work in class).
    • The first circuit uses a voltage regulator, buzzer and a switch.
    • The second circuit uses a voltage regulator, resistor, LED and switch.
    • The third circuit uses a voltage regulator, resistor, potentiometer, LED and switch.
  • In your blog post please answer some of the following questions:
    • Why was it important to use a voltage regulator?
    • Why did you need or not need resistors in your circuits?
    • We used pushbutton switches in these diagrams. Are there any switches that we interact with everyday that do not require us pressing a button or an on/off switch with our hands?
  • Materials:
    • 1 * Breadboard
    • 1 * LM7805
    • 1 * Buzzer
    • 1 * Push-Button Switch
    • 1 * 220 ohm Resistor
    • 1 * LED
    • 1 * Variable Resistor
    • 1 * Power Supply and Leads
    • Hookup Wires

Here are some helpful diagrams to help you understand your components better:

LED Pinout:

Image from Tweaking4All.

 

LM7805 voltage regulator pinout:

Image from Electronics4u.

 

Variable Resistor:

Push-Button Switch. Notice that some of the leads are always connected to each other.

Image from Razzpisample