This little device allows you to track the physical activity of your cat (or your dog, but not your goldfish) and to store those data on a Google Spreadsheet using IFTTT, a well-known website for connecting various apps and services together.
Introducing IFTTTFirst thing to do is to set up our IFTTT recipe.
You can register here, make sure to use your Google email and you familiar with the IFTTT website.
Ok, now we have to configure our recipe. The first step is to choose the Trigger (or the This), in this case is the Maker Channel, which allows IFTTT to respond to arbitrary webhooks.
The only configurable part of a "Maker Channel" trigger is the event name, which is how IFTTT will know to trigger this particular recipe.
Next we have to configure the Action (or the That) portion of the recipe, which in this case is the Google Drive channel. There are a number of possible actions that can be done with the Google Drive channel, but for our purpose we only need the "Add Row To Spreadsheet" action.
You can name and place your spreadsheet as you please. The important part, though, is the row formatting. The IFTTT Maker trigger has very specific naming conventions, which is where these field names come from.
Note that 'OccurredAt' is the name of the cell that will be filled with the data that the IFTTT trigger fired. The second cell will be filled with the data we decide to store.
AccelerometerFor this project we used a 3-axis accelerometer and its library.
In the library there are already included two useful functions: Activity and Inactivity. We basically start a timer when the Activity function is triggered and stop it when an Inactivity is detected.
int Status = ReadAccelerometer();
if ( Status == 1 && LastStatus != 1) {
Serial.println("Timer started");
LastStatus = 1;
ActivityTimer = millis();
}
else if ( Status == 0 && LastStatus != 0) {
Serial.println("Timer stopped");
LastStatus = 0;
Counter = Counter + (millis() - ActivityTimer) / 1000; // Transform millis in seconds
}
Comments
Please log in or sign up to comment.