
A Forest and Bird Warkworth Project

Development Environment
First step is to decide whether to download the Arduino IDE or to use their cloud, I personally chose to download the IDE.
​
IDE Download Link or use the Cloud Link
​
Make sure your Arduino mkr1010 wifi is up to date:
See https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-fw-cert-uploader/.
​
Download the code:
In the IDE (or the cloud) create a new Sketch and cut and paste the code you downloaded into that.
​
Download The Libraries
Next step is to download the libraries, the libraries required are all at the top of the code e.g.
// libraries to include to use the MKR 1010 et. al.
#include <SD.h> // for the sd card
#include <SPI.h> // serial peripheral interface for SD Card and rfid reader
#include <ArduinoLowPower.h> // be able to use the low power options and wake on interupt to save power
#include <WiFiNINA.h> // in this development we are using wifi to serve the data without having to remove the SD card more than necessary
#include <set> // implements a simple set datastructure, useful for the RFID Ids
#include <stdlib.h> // standard c++ library general utilities
#include <RTClib.h> // library supporting adafruit Real Time Clock. The Adafruit PCF8523 only uses I2C 7-bit address 0x68
#include <Adafruit_SleepyDog.h> //library to set up a watchdog (something that resets the processor if it isn't regularly updated)
#include <Wire.h> // I2C interface for RTC
Instructions on how to download libraries is linked here​​
Modify the Sketch to match your needs:
The sketch has comments in it relative to variables that you can change to match your configuration/needs.
Boolean Variables for configuration:
-
secondIR is true, but if you are only using one IR Break beam, change that to false.
-
RGBLed is true, if you do not include a RGB Led for status notifications change it to false.
-
RTClock is true, if you chose not to timestamp/have an real time clock change it to false.
-
ResetRealTimeClock, normally false, but if you need the time to be updated you can set to true, update the arduino with the code, then set to false and re-upload the code. Alt
​​
Timing Variables: ​
I have set up various variables for timing that you can re-configure if you wish. These variables are mostly around battery saving options, with how long to try to read a RFID chip after a break beam is no longer broken; how long to wait for someone to try to connect to the WIFI Access Point created before turning off wifi, once up how long to wait for a client (user) to request the data after they have connected before turning off wifi, how often to wake up and indicate that the system is still running but nothing has been happening, and how long to wait to trigger the watchdog (processor reset) if the system is not in sleep-mode (saves power, and is woken by an interrupt) and no operations are being executed by the software. These are RFIDREADDURATION, WiFiReadDuration, ClienttTimeout, WakeTime and BarkTime (watchdog).
​
Debugging Tools:
debug: will be false, if you need to run the code while connected to your pc and ide serial monitor, then set it to true. Be sure to set it to false before deploying.
TestWatchdog: will be false, if you set it to true you will be able to make sure the processor resets itself. Be sure to set it to false again if you do this.
debug_ids: leave as false, only turn to true if you need to look at what ids are being read that are not handled properly.
WIFI Settings:
ssid: this is the name of the network the Arduino will use when it creates an access point for people to obtain the information from the system, set to something useful for yourself.
pass: the password for the wifi network, set to something useful for yourselves.
IP address, gateway, subnet, you can leave as is or set to something that is in the regulated range.
​
​