Challenge

Project 2 - Measuring the distance of an object using ultrasonic sensor and also smoothen the sensor data using moving average filter

Dear sir/madam,

Please find attached my second and final project submission!! This week's project was absolutely great- reading the sensor's data sheet, understanding how sound sensors work and how their conversions are handled and most interestingly, because my first attempt included 2 arduinos over I2C (there is a particular line in the challenge text under "Expected Outcomes" that mentions 2 arduinos, but a few TSEs said that it's not really necessary), I finally had the chance to learn and practice a little more with bit shifts and union bit extractions since I2C communications only transfer one byte at a time.

I have attached a .BRD file of the circuit as well as screenshots of it working. Here is the link to it as well. I'd like to make a small note here: as I've mentioned in my source code, the arithmetic of converting the speed of sound into the required units causes a relatively significant loss in distance measurement due to floating point arithmetic precision (the distances are off by approx. -1.80cms; they are closer by approx. 1.80cms.) I have chosen this side effect over precisely using the required conversion value for two reasons:

  1. I wanted to generalise the program as much as possible and prevent hardcoding;
  2. I assumed that this kind of setup might be used as a parking sensor or a cruise control throttle sensor and therefore relatively closer distances (within reason) would lead to relatively safer autonomous driving decisions being made.

Awaiting your feedback,

Best regards,

Rahul Singh

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.