top of page

Midterm Project

  • sparvez7
  • Mar 29, 2022
  • 3 min read

Originally I had planned to do a red light green light project in which after a certain action was done (the red light green light sequence) the microbit and ultrasonic sensor was supposed to detect movement based on a change of distance and then start beeping to indicate a player was out. While I had taken 4 hours and completed 3/4 of the project, I had to scratch that idea and start a new one due to unable to figure out how to use the sensor to detect change in movement in a place where the distance is unknown. I hope I am able to do something similar later in the semester.

However, for this midterm project I took a different approach but with almost the same equipment that the first one needed. I instead created a backup camera alarm system. In this project, there are three LED, ultrasonic sensor, and the speaker and based on the distance between the sensor and another object (in this case a wall/car) there are three difference light indication which change depending on the distance. So, if the car is 12 or more inches away from the car/wall, the light will be green and it will play a rather slow beat to indicate you are far from the object. If the car is between 3-12 inches away from the car/wall, the light will be yellow/orange to indicate you are close but not too close where you will crash. Then finally, if you are under 3 inches away from the car/wall, the light will be red and a very fast beep to indicate you are too close and you should stop getting closer. In theory, this can be used as a treasure hunt system to indicate you are very close to the treasure if you get too close to the sensor/the treasure.


For the project, I broke down what I wanted in the program and then did all of them separate, made sure they were working on their own and then combined all the code to get it to work all together. First I tested out the LED which is by far the easiest to do and I made sure they were plugged in correctly and turning on and off as how I wanted it without the speaker or the sensor. Next, I tested the speaker and adjusted the beeping to how I wanted to make them beep and made them correspond to each color so red is fast and green is pretty slow. Finally, I incorporated the sensor and made sure it was calculating the distance or not and then combined the speaker and the led to a certain distance that I wanted the certain LED to light up at and beep at. When putting it together, there was a lag in the beeping and the calculating as I wanted it to display the distance and while it was displaying the distance, it took a mini break and then continued.


I had a lot of issues with the red light green light (which is why I ended up changing it) but I incorporated some of the issues and fixes I found into this program. Also, for there to be a smooth flow between the distance and the LED I did end up using google/youtube and looking at other projects to get an idea of how I wanted to go about mine and I took pieces out of other projects and incorporated into mine. In my code you will see three if/else commands in each other and that I had found from another person doing their project and it was very helpful in getting my program to work.


For my creative flair, I am not very creative but I did try to do something that I could construct in the time I had left and I created a box that is supposed to represent our car (its not a pretty box but oh well) and another box and a "wall" to indicate another car/wall that we are backing up into. It made it look a bit more realistic and honestly the other box can also be the treasure.


This is a short video showing how the program works and you can see there are some flaws (lagging in reading distance, lags in beeps) that were worse before but after playing around with it, I was able to keep them at a minimum.




 
 
 

Recent Posts

See All
Final Project Idea

For my project, I want to remake flappy bird. I think with all the things we learned, flappy bird has all the elements with a moving...

 
 
 
Maria Ressa - Response

What problems is the author discussing in this article? - The problem that the author is discussing is the fact of technology ruining...

 
 
 

Comments


Post: Blog2_Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Sabreena's Blog. Proudly created with Wix.com

bottom of page