We were tasked with creating an IOT project in our 3171 intro to instrumentation class. Both of us were interested in a motorsports project initially. However, upon closer inspection, budget and time constraints made this very difficult. As a result, we shifted to a similar industry, cycling. We decided to design a speed and tilt sensor that uploaded all data to the particle cloud. We also designed a small safety integration to warn riders they are leaning too much at low speeds.
To begin, the hall speed sensor was coded first. It was not difficult to find a reference project online, seen here (https://arduino.stackexchange.com/questions/12578/measuring-time-between-inputs) One major issue with using a hall sensor is that it has a tendency to bounce or double read. This was to be mitigated using the equality "if (revolutionTime >= 30) ) then calculate velocity. However, this doesn't seem to work? seen here is a few outputs from the project.
I am not sure how it did this, given that it should be impossible for it to be 200 km/hr with a min revolution time of 30 milliseconds. This potentially could be filtered out, but I am not confident enough in my wiring abilities. Apart from this, the code works very well and as expected. The warning is sent when below 10km/hr.
LED_ON is triggered when warning is sent and the tilt is true. It mostly is a simple way to integrate the argons back and forth as project demands.
Seen here is the simple wiring and
testing seen here is the simple wiring an for the velocity. A magnet was waved in front of the sensor similarly to how it would when attached to calibrate and test the circuit.
The original plan was to be able to measure a degree of tilt by utilizing 2 DOF on a 6-axis acellerometer. Unfortunetly the acellerometer purchased had errors using the I2C busses so to actually get the project done before the due date a switch-type tilt sensor was used. The sensor operates simply by having a ball inside of a cylinder and if it rests at the bottom the digital output is "LOW" and when the tilt is great enough that the ball moves from the bottom the digital ouput shifts to "HIGH."
The wiring for the tilt sensor is fairly straightforward. No additional components are required and all the hookups are direct to the pins on the Argon.
As seen above the sensor hookup is simple like mentioned before. The green wire is ground, the orange the 3.3V supply and the brown a digital ouptut to pin D3.
When the Tilt sensor is in the tilted state it send a publish to the argon with the hall effect sensor and if the velocity is below the set value (in our case 10 km/h) it will illuminate on that argon. On the argon to measure tilt it is subscribed so that when the warning is given for traveling less then 10 km/h from the other argon it checks to see if its in a tilted state and if so the LED illuminates on that device. This "Driver Warning" feature is shown below.
In the ThingSpeak integration the first plot shows the true numeric value of the acceleration in km/h. The second and third plots both count the number of times the respective event, either "Lean_True" or "warning" occur. These values are also coded to reset to zero if the reset button is hit on the Argon which is why the Lean_True value has a sharp drop.
The live feed access can be viewed here: https://thingspeak.com/channels/1580905
Note: The feed will not update unless new data is sent to ThingSpeak and in the near future further testing of this system is suspended.
VideoIn the Future:It would be intersting if the project could eventually implemented with the 6-axis acellerometer as originally intended. Also attempting to figure out how to eliminate the ocasional double velocity readings that come from the hall sensor. Lastly it would be awesome to see how the system actually works on a real bike or motorcycle. Stay tuned for updates !!!
Credits:A big thank you to all who helped on this project including:
You've got mail project: https://www.hackster.io/macsboost/you-ve-got-mail-2e2d8e#code
Reference project for velocity calculator: https://arduino.stackexchange.com/questions/12578/measuring-time-between-inputs
Image of tilt sensor: https://components101.com/sensors/sw-520d-tilt-sensor-module
All the friends who have offered us help
And to Mr. McAlpine for all his help on the project and for an awesome semester in MEGR-3171... Find his projects here: https://www.hackster.io/macsboost
Comments