Recitation 3: Sensors by Sheldon Chen

The recitation last commenced after the major event, the distribution of our individual Arduino kit. This time, we tried several new sensors, the moisture sensor, the infrared distance sensor, the vibration sensor, the ultrasonic sensor, as well as the joystick module. And we, of course, were expected to get these electronic components working.

The process of assembling these components was almost the same, which involves finding the electrical description of component online, assembling the circuit, copy paste the code from online resources. It could simply work after this. The videos of these circuits working are as follows.

However, there still were several small problems I had or mistakes I’ve made, either in coding or in the hardware. First of all, when reading the analog data from the joystick, what the serial monitor shows were nothing but a bunch of messy code. There was nothing wrong with the circuit or the code. It was later found by Eric that we forgot to switch to the correct baud rate in the serial monitor. What’s more, when using the code online to drive the ultrasonic sensor, it was using two pins to receive and send the ultrasonic signal, which was different what the documentation has said. And it turned out the theory is to take sending out ultrasonic signal as on, and receiving the signal as off, while using the built-in timer to calculate the time gap between sending out and receiving. And by multiplying the duration and the speed of sound divided by two, the result is the distance between the sensor and the barrier. Last but not least, when I was assembling the circuit where one can use the potentiometer to adjust the brightness of the LED, the brightness of the LED wasn’t able to change linearly while the potentiometer was turned. Thanks to Eric, he discovered that I forgot to convert the value of analog read, which ranges from 0 to 1023, to analog write, which ranges 0 to 255.

Apart from the potentiometer and LED combination mentioned above, I also attempted to assemble a circuit using the ambient light sensor and the LED, where the LED would light up if there isn’t too much light in the environment. I think there would be several conditions using the circuit. One circumstance would be installing a number of them on the way from the bedroom to the restroom and use them as the pilot lamp. Those LEDs would be turned on when there isn’t much light in the environment. When one needs to use the restroom at night, these LEDs would be showing this person the way while not turning on the light and wake others up. It would be especially useful for those living with others in the same room. The other circumstance would be installing the light at the end of the pen for kids. And the LED would light up once the environment is too dark for kids to read and write. It would reduce the chances of kids having myopia.

According to Eric Parren, computers are very dumb (Eric). Indeed, computers are only machines executing the instruction you send, not being able to freestyle at all. Thus, it would be appropriate to compare code as a tutorial or recipe. The computer would be following the tutorial provided by programmers and executing it step by step, in order to attain a certain goal or demonstrate something.

Living in the 21st century, it is not hard to spot the influence computers have on our behavior. In a word, with their assistance in dealing with repetitive work, we are becoming lazier and lazier. One great example would be the emergence of smart home gadgets, such as floor mopping machine. By implementing these machines, we would be freed from carrying out domestic work. But on the flip side, by having computers everywhere in our life handling the repetitive work would enable us to focus more on work that requires creativity. In the past, when using the film cameras to take photos, you must adjust all the parameters, such as aperture, shutter speed, focus, etc. And the procedures would be so annoying that one can hardly focus on composition. By implementing computers in cameras, all the repetitive work above would no longer be troubling us. The only thing photographers need to worry about is the composition.

Reference

  1. https://www.dfrobot.com/wiki/index.php/SHARP_GP2Y0A41SK0F_IR_ranger_sensor_(4-30cm)_SKU:SEN0143
  2. http://wiki.seeedstudio.com/Grove-Moisture_Sensor/
  3. https://www.arduino.cc/en/Tutorial/Knock
  4. https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf
  5. https://www.brainy-bits.com/arduino-joystick-tutorial/
  6. https://randomnerdtutorials.com/complete-guide-for-ultrasonic-sensor-hc-sr04/
  7. https://www.brainy-bits.com/arduino-joystick-tutorial/

Leave a Reply