กลับไปหน้ารวมไฟล์
if-this-then-cat-1f3249-en.md

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 IFTTT

First 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. 

Accelerometer

For 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
}

EXPANDED TECHNICAL DETAILS

Behavioral Pet Interaction IoT

"If This Then Cat" is an automated feline engagement system that uses real-time web triggers to interact with your pet while you're away.

  • Maker Service Integration: Using the IFTTT (If This Then That) Maker Webhooks, the Arduino (via ESP8266) can be triggered by diverse events, such as getting a Twitter mention or a specific time of day.
  • Kinetic Play Actuation: Upon trigger, the Arduino activates a servo-driven laser pointer or a motorized "feather toy." The movement patterns are randomized in software to keep the cat engaged and prevent predictable behavior.

Remote Monitoring

  • Arduino Web Editor Dashboard: Allows the owner to manually trigger a play session from a smartphone web interface, providing a fun and interactive way to bridge the distance between pet and owner.

ข้อมูล Frontmatter ดั้งเดิม

title: "If This Then Cat"
description: "Wondering if your cat is sleeping all day or running around the hood? Check it out with this tracker!"
author: "Arduino_Genuino"
category: "Home & Automation"
tags:
  - "iot"
  - "animals"
  - "internet of things"
views: 18960
likes: 6
price: 1120
difficulty: "Intermediate"
components:
  - "1x Li-Ion Battery 1000mAh"
  - "1x 3D Printer (generic)"
  - "1x Analog Accelerometer: ADXL335"
  - "1x Arduino MKR1000"
tools: []
apps:
  - "1x Maker service"
  - "1x Arduino Web Editor"
downloadableFiles:
  - "https://create.arduino.cc/editor/Arduino_Genuino/e2b41a20-ecec-43ef-8129-0454e20b281b/preview"
  - "https://create.arduino.cc/editor/Arduino_Genuino/e2b41a20-ecec-43ef-8129-0454e20b281b/preview"
documentationLinks: []
passwordHash: "19f67854bd404976a79c78f671b2e743c870ae4dc1716bcc3f3135a16ae26627"
encryptedPayload: "U2FsdGVkX18OMASAY2ccy6jjtsmfszvuy9lryJf5s42qSDiq3uAk1EeOl4NO9VOTb8AbaI2JOEoaSwD94+6cMLFaFfHEDUI5bZkrPGqpFmBhh8nZQVExeKm0HPXCG4KA"
seoDescription: "Track your cat's activities with this Arduino project. Monitor sleeping patterns and movements using a custom Tracker."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/if-this-then-cat-1f3249_cover.png"
lang: "en"