Work Progress

This week we were introduced multiple types of input devices. I decided to make an ultrasonic sensor. In the final project, I want to make a smart curtain system that can be controlled by detecting objects/people approching.

  • Here's my schematic and board.

  • kerf

    kerf

    Note: I didn't find the component of HC-SR04 in the fab library, so I added an FTDI as a placeholder. One thing I find very convenient about HC-SR04 is that sonar marks VCC, Trig, Echo, GND on its four pins, saving me some time to check schematic for GND and VCC when debugging.
    I didn't know there were female headers in the lab when I was making my board, so the orientation of my sonar is very strange. kerf

    I decided to use Arduino IDE to program the board, and I found this tutorial online by simplely searching "ultrasonic sensor arduino IDE".This tutorial explains how to use the ultrasonic sensor HC-SR04 with Arduino, as well as the basics of the sensor detection, how it triggers signals, read echoes, and convert time delays into distance and values on the serial.
    The following is the code I used.

    Basically, the code is doing things as simple as —— First, define the digital pin number of the trig and echo pin on the microcontroller, and then tell setup that trigPin as output and echopin as input. Then, let the echo pin calculates the distance based on the time it takes to receive the information. Program success!
    kerf

    However, I noticed that in the video given by Neil, there was a python interface designed by him. The visualized sensor effect is much cooler than the printed value of serial, so I hope to program this board again through command prompt. I downloaded Neil’s make file, C code, and python script. Unfortunately, I always got permission denied messages on the computer of architecture shop (although I used sudo command), so I went to EDS and got the board programed on their computer. kerf

    kerf

    Here is the commands I used: