Software apps and online services
We were trying to think of cool ways we could connect two particle photons together and send data from one to another. Our team's extracurricular activities include rocketry and Formula SAE. We wanted to be able to use an accelerometer and photon to graph the movement of an object from a base station using some form of wireless transmission and initially planned to graph the movement of the car and its orientation (yaw, pitch, and role). Why this particular aspect of the project was not possible to achieve is explained below. Essentially, we hope to be able to graph and display movement, and to be able to accurately see what the car/rocket is doing on a computer. Using this project, we could affix the components to a rocket or formula car and see the orientation of a rocket as it flies upward, or see the acceleration and angle of a formula car while in a turn. The culmination of our efforts are an accelerometer and photon combination, which notifies another photon it has been tilted past a threshold set in the particle photon's code. We also utilize Blynk to graph how many times the accelerometer tilts and to also send a warning message to the user.
Our project began in an effort to wirelessly transmit accelerometer data using the Particle Photon’s User Datagram Protocol(UDP) capabilities. This initial setup would have involved a particle connected to a computer while the other was connected to the serial outputs on an arduino, through which all of the processing/formatting of the accelerometer data would have been accomplished. Using UDP we wanted to wirelessly transmit accelerometer data to a photon and have that photon read in the data in a format capable of being using by a program that orients a constructed three-dimensional object in a rendering window, and updates that object’s orientation in real-time based on the orientation of the accelerometer. The program that would have handled the three-dimensional mapping of accelerometer data is called “Processing” and is used for many projects requiring some form of visualization.
We discovered inherent limitations in being able to do this, though. Firstly, the accelerometer outputs data using I2C which works well with the example code for Processing when a wireless transmission component isn’t needed. Secondarily, UDP is rather impractical for this application. We succeeded in reading in packets of data consisting of only a solitary character, with datatype char, but were unable to read the entire data packet we wanted to send.
We then explored using two small radios to transmit our accelerometer data. We were successful in transmitting this data but with the Arduino reading in the accelerometer data via I2C and the radios only capable of sending and receiving data via Rx and Tx pins, processing couldn’t read the incoming data properly. There may be a way to successfully transmit data via Rx and Tx pins that was originally transmitted using I2C. If there is, it is currently not in our skillset to implement.
As of now, we have a configuration consisting of two particle photons and an accelerometer. The accelerometer is connected to one of these photons and publishes an event upon rolling, or angular acceleration about the “y” axis, for the other photon to listen to. The listening photon has subscribed to this event and, upon detecting it has been published, will illuminate the onboard LED at pin D7. We have then interfaced the photon-accelerometer combination with Blynk, writing a string message to a terminal widget and graphing the number of times the accelerometer has exceeded the roll threshold.
Below is a video of The B-Team explaining our project and the Blynk dashboard we used to notify the user of the rolling of the accelerometer.
Photos of our hardware configuration can be seen below. We purchased the MPU6050 accelerometer to connect to the photon.
Blynk allowed us to utilize an app available on Apple’s app store that is capable of displaying whatever data we push to it. We have decided to push a string message to a terminal widget which notifies the user of the accelerometer that they have exceeded the angular acceleration threshold set in the code. We have also included a counter for how many times the accelerometer exceeds the threshold. With this we plot the number of counts versus time on a graph in the blynk app.
The photo above is our Blynk dashboard. We wrote a message containing the text "Danger" when the accelerometer tilted. The graph below shows the number of times the accelerometer rolled over a certain period of time. The counter resets upon resetting the photon.
The particle photons communicate between one another using a simple publish and subscribe solution. We then implement the Blynk app to allow graphing of a variable counter versus time.
We did attempt to have the secondary photon call the Blynk functions, but the particle photon would consistently disconnect from the cloud upon doing so. This could have been interference due to Particle.subscribe() and Blynk.begin(auth).