Sketches

Sketches are Arduino programs. These sketches are for Freaklabs boards and can be customised for your application.

Please note: Some sketches require libraries. Check the #include for the required libraries.

BoomBox

All sketches are available on Github

We recommend testing BoomBox with sequential playback first, to become familiar with the system and how it works. For details assembling the device, code, how to test and deployment, please refer to the BoomBox Practical User Guide

Sketch NameDescriptionTarget HardwareGithub Repo
testBoomboxStandaloneTests the BoomBox hardware and speakers are working via the command line or 'test' pushbutton on the BoomBox circuit board.

Audio will play through the playlist sequentially.
BoomBoxBoomBox Sequential Github Repo
testBoomboxTrailcamTests BoomBox and camera trap assembly is correct, and the full system is working. Tested via camera's PIR motion sensor in test mode.

Audio will play through the playlist sequentially.
BoomBoxBoomBox Sequential Github Repo
deploymentBoomboxMainBoomBox deployment code for sequential playback.

Parameters include:

max_sounds - number of audio files

delayTime - time in milliseconds trigger and audio playback

durationTime - length of longest audio file

offDelayTime - quiet time before next trigger event
BoomBoxBoomBox Sequential Github Repo
testBoomboxStandaloneRandomTests the BoomBox hardware and speakers are working via the command line or 'test' pushbutton on the BoomBox circuit board.

Audio will play through the playlist randomly.
BoomBoxBoomBox Random Github Repo
testBoomboxTrailcamRandomTests BoomBox and camera trap assembly is correct, and the full system is working. Tested via camera's PIR motion sensor in test mode.

Audio will play through the playlist randomly.
BoomBoxBoomBox Random Github Repo
deploymentBoomboxMainRandomBoomBox deployment code for random playback.

Parameters include:

max_sounds - number of audio files

delayTime - time in milliseconds trigger and audio playback

durationTime - length of longest audio file

offDelayTime - quiet time before next trigger event
BoomBoxBoomBox Random Github Repo

 

WildLogger

All sketches are available on Github

For explanations on the code, please refer to the relevant module page in the Build  Your Own Data Logger (BYOD) course.

Sketch NameDescriptionTarget HardwareBuild Your Own Datalogger ModuleGithub Repo
Module 2-4:
Blink an LED
A basic sketch for blinking an LED, and controlling the blinking speed.WildLoggerModule 2 PageBYOD - Module 2
Module 2-5:
Hello World
This sketch will print out ‘hello world’ to the Arduino serial monitor. 'Hello World' is a common first program developers use to check their hardware can communicate and send text data to the computer via the serial port.WildLoggerModule 2 PageBYOD - Module 2
Module 3-1a:
Arduino Command Line - Hello World
Introduces the Arduino command line library we wrote. We show you how to print out "hello" from the command line.WildLoggerModule 3-1 PageBYOD - Module 3-1
Module 3-1b:
Arduino Command Line - List Arguments & Realtime Clock
Add arguments to the command line and list them out. Also adds a command to display the time from the realtime clock.WildLoggerModule 3-1 PageBYOD - Module 3-1
Module 3-1c:
Arduino Command Line - Blink
Control the blinking frequency of an LED from the command line.WildLoggerModule 3-1 PageBYOD - Module 3-1
Module 3-2a:
Temperature and Humidity Sensing
Read the temperature and humidity values from a DHT11 sensorWildLoggerModule 3-2 PageBYOD - Module 3-2
Module 3-2b:
Command Line Temperature and Humidity Sensing
Create a command to read the temperature and humidity values from the WildLogger sensor interactively from the command line.WildLoggerModule 3-2 PageBYOD - Module 3-2
Module 3-2c:
Creating
a Temperature Warning Light
Use the temperature value from the DHT11 to turn on an LED above a critical temperatureWildLoggerModule 3-2 PageBYOD - Module 3-2
Module 3-3a:
Reading battery voltage
We use the analog to digital converter (ADC) to read the battery voltage of the WildLoggerWildLoggerModule 3-3 PageBYOD - Module 3-3
Module 3-3b:
Reading battery voltage from the command line
Create a command to read the battery voltage interactively from the command lineWildLoggerModule 3-3 PageBYOD - Module 3-3
Module 3-4a:
Set Time and Date
Set the time and date for the real time clockWildLoggerModule 3-4 PageBYOD - Module 3-4
Module 3-4b:
Command Line Time and Date
Create commands to set and read the time and date interactively.WildLoggerModule 3-4 PageBYOD - Module 3-4
Module 3-5a:
Writing and Reading the SD card
Introduces how to initialize the SD card. Then writes data to it and reads it back.WildLoggerModule 3-5 PageBYOD - Module 3-5
Module 3-5b:
Command Line SD Card Write and Read
Create commands to write temperature and humidity data to the SD card. Create a command to read the contents of a file on the SD card.WildLoggerModule 3-5 PageBYOD - Module 3-5
Module 3-5c:
Command Line Disk Operations
Add additional commands to list the files in the root directory and delete files from the SD card.WildLoggerModule 3-5 PageBYOD - Module 3-5
Module 3-6a:
Interrupts - Pushbutton
Introduces interrupts and interrupt service routines (ISR). Initialize the pushbutton interrupt for WildLogger, debounce it, and create ISR to toggle an LED.WildLoggerModule 3-6 PageBYOD - Module 3-6
Module 3-6b:
Interrupts - PIR Motion Sensor
Initialize an interrupt to trigger on the PIR motion sensor. Also read the PIR state and light an LED when the PIR is triggered.WildLoggerModule 3-6 PageBYOD - Module 3-6
Module 3-6c:
Interrupts - RTC Alarm
Initialize the timer on the real time clock to generate an interrupt every minute. Create an ISR to handle the interrupt and print out the date and time on each interrupt.WildLoggerModule 3-6 PageBYOD - Module 3-6
Module 4a:
Tying It All Together
Tie all the previous principles from Module 3 to create a functional datalogging application.WildLoggerModule 4 PageBYOD - Module 4
Module 4b:
Safety Checks and Diagnostics
Add in safety checks and diagnostics into the application. Add error handing for system errors.WildLoggerModule 4 PageBYOD - Module 4
Module 5a:
Power Management with the WildLogger
Add power management code to increase battery life. We put the system to sleep and wake up based on the interrupt from the realtime clock. This stretches out battery life to a few months.WildLoggerModule 5 PageBYOD - Module 5
Module 5b:
Watchdog Timer Implementation
We implement the watchdog timer for WildLogger. This improves the system's field reliability by resetting the system if the watchdog timer isn't reset every 8 seconds.WildLoggerModule 5 PageBYOD - Module 5
Module 5c:
The Grand Finale
This completes the software application for the WildLogger for this course. It ties together the datalogging, power management, and optimizations. Future bonus modules will extend functionality or add different sensors.WildLoggerModule 5 PageBYOD - Module 5
Module 5d:
Bonus - Specify the time spent in command mode before switching into 'norma' mode.
We normally have 5 seconds after reset to check for a special character, ie: 'c'. If the character comes in, then we go into command mode and stay there until we type the 'normal' command which goes into normal
/ sleep mode.

This sketch allows you to specify the time before moving into normal 'sleep' mode.

nb: You can only switch between the two at the beginning of the program so you will need to reset the system before you type commands into it.

This is a variation of Lab 5a.
WildLoggerModule 5 PageBYOD - Module 5

 


Copy link