//Serial.print("Entered view");
}
else if (fa2 > sensitivity) // maximum
{
Serial.print(1000); //Cause red line to indicate exiting presence
Serial.print(",");
//Serial.print("Exited view");
}
else
{
Serial.print(0); //Cause red line to indicate no movement
Serial.print(",");
//Serial.print("No Movement");
}
}
else
{
Serial.print(0);
Serial.print(",");
}
Serial.println();
// Do this last
averageValue = EA * upValue + (1 - EA) * averageValue;
while (millis() < startTime + LOOP_TIME); // enforce constant loop time
}
Once again, the output for this example code should look something like the below image. This graph is the derivative of a single channel on our
presence sensor, so any variance from 0 shows the rate of change of the signal.
Click the image for a closer look.
Resources and Going Further
Now that you’ve successfully got your AK9753 up and running, it’s time to incorporate it into your own project!
For more information on the AK9753, check out the resources below:
AK9753 Schematic (PDF)
AK9753 Eagle Files (ZIP)
AK9753 Datasheet (PDF)
Product Showcase: Qwiic Presence Sensor
Qwiic System Landing Page
SparkFun AK975X Arduino Library GitHub Repository – Source and example files for the Arduino library used in this tutorial.
GitHub Repository - Repo for the product.
Need some inspiration for your next project? Check out some of these related tutorials:
PIR Motion Sensor Hookup Guide
An overview of passive infrared (PIR) motion detecting sensors, and how
to hook them up to an Arduino.