This is Tyler Hayes' and Reece Walser's submission for the Fall 2023 MEGR 3171 IOT project. This project required us to collect data using two sensors of our choice and two Particle Photon 2s. The publish and subscribe functions are to be used to enable both our Photons to communicate with one another. Finally, ThinkSpeak Webhook integration is to be used to graph data in real time.
OverviewAre you tired of boring old RC cars? Antiquated and boring machines that are incapable of collecting and sending data across the internet. If so, you're in luck, as our team's project allows you to upgrade any bland RC car into an IOT data-collection machine, capable of providing real-time information about how often you drive into things. By using an impact switch, ultrasonic distance sensor, and two Photon 2s such a feat is possible.
HardwareThe car we decided to use for this project is this BEZGAR TB141 RC car. The reason we chose to use this car, in particular, is because it has a couple of flat surfaces which we can use to place breadboards upon.
Next, the impact switch sensor we used is this cheap switch we found on automationroboticsarduino.com. In hindsight, we believe a different sensor could have been a better fit for our project, as we realized we could only detect head-on collisions without the use of multiple of these sensors. For the purposes of this project, this shortcoming is not that big of a deal, so we used it anyway.
The final sensor we used is an HC-SR04 ultrasonic distance sensor, which is a neat sensor for its low price. This sensor is capable of emitting ultrasonic waves, which echo back and are detected by the sensor. By measuring the time it takes for waves to return to the sensor and using the equation: Distance = (Speed of Sound * Time Taken) / 2, it is possible to determine the distance from the sensor to the nearest object.
As previously stated, we selected a car for this project based on the location of flat surfaces where we could stick a breadboard. Due to the fact that the impact switch sensor we used is effectively more of a button, it is necessary for there to be a location to place a breadboard on the front of the car. Luckily, the hood of the car is a perfect fit for this. Using a breadboard with an adhesive on the back, we constructed our circuit (seen in the circuit diagrams at the bottom of this page) and stuck it on the hood of the car. We then used duct tape to connect the impact switch to the very front of the car, as seen in the image below. Since the impact switch isn't connected directly to the breadboard, it was necessary for us to use some female-to-male jumper wires to connect the sensor to our Photon 2.
Next, we set up the HC-SR04 ultrasonic distance sensor. Sticking a breadboard on the roof of the car, behind the headlights, we were easily able to construct the circuit (again, the circuit configuration can be found at the bottom of this page). It is worth noting that we needed to stagger the breadboard to hang off the side of the car, as the sensor would otherwise be blocked by the headlights.
An improvement can be made in our design by incorporating some other way to power the car. Currently, we need to have both Photon 2 boards connected via a wire to an external power source to operate, which means it is greatly limited in where it can travel. Due to time restrictions, we were unable to implement a better power source into our project.
ThingSpeak IntegrationAn advantage of IOT projects is the ability to integrate Webhooks in order to collect or transfer data. For this project, we were required to set up a Webhook with ThingSpeak in order to graph data. Below you can see the two integrations we created in the Particle Console.
Above you can see the two charts created through our ThingSpeak integrations. The data shown in the charts can provide information about the RC car at any time. On the left, you can see the impact status of the car. If the chart reads 1, the car wasn't touching anything, if it reads 0, the car was touching something during that time. On the right, you can see the distance from the sensor to the nearest object in front of the car at various moments in time. All distance data is in inches.
Here is a link to our ThingSpeak channel. Note that it will only update when our Photon 2 boards are active.
Comments