Lab Documentation 4 Sensors (Marcela Godoy) by Zersh

Lab 4: Sensors

Date: March 4, 2017

Instructor: Marcela Godoy

This week, we are assigned to choose one sensor and to use that sensor to create our own project, and make it very interactive. For me, I choose the IP sensor, and the function of it is that it can detect the distance between the object and the sensor’s “eye.” The sensor I choose can detect the distance between 20cm to 150cm.

At first I set up the analog put in, so that the data of the distance can be shown on the monitor, however the data is not between 20 to 150, it is between 100 to 550. After I turned to the fellow, I was told that I can use a map function to adjust the data to [20,150]. The map function is very useful to adjust the data to the range that we want to collect, and also to regulate it to how we can control the project when using loop and if functions.

WechatIMG3 WechatIMG5

Then, when the sensor was settled, I decided to add a buzzer. And by changing the distance, the buzzer would generate different sounds. At first I was thinking of changing the volume and turn the sound up and down, however, it seemed that the initial sound is not very loud enough, and if it turned down, we can not hear it. I also had a problem with changing the pitch. Finally, I found the tone function: tone(pin, frequency, duration), and I can finally change the tone and make the sound very interactive when I move my hands and change the distance that the sensor would detect.WechatIMG2

I think, the coding part is difficult at the beginning basically because I am not every familiar with the build in function, and it is very important to know them, or otherwise, the project would be less interactive. Also, this project gave me some inspiration to my stupid pet trick project.

One thought on “Lab Documentation 4 Sensors (Marcela Godoy) by Zersh

Leave a Reply