Skip to content

Software for an IoT scale. It periodically uploads weight data from an Arduino MKR1000 to your Adafruit.IO account. I use it to keep track of my cat's weight when she goes to the litter box.

Notifications You must be signed in to change notification settings

BizarroDavid/patooti-scale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This project implements an IoT scale. The scale periodically uploads weight data from an Arduino MKR1000 to your Adafruit.IO account.

On start up the software will automatically tare any weight that it detects, then it will hop onto your wifi network and upload weight readings to your Adafruit.IO feed. Every minute the software will upload the maximum weight it has recorded in that time period. The time period can be adjusted in main.ino

Note: Due to plotting limitations on the Adafruit.IO charts, using an upload time period of once per minute is appropriate for charts that display the last 24 hours of weight data. If you use a higher frequency you may see your data readings get agregated in unexpected ways

Prereqs

  • You have installed the Arduino IDE
  • You have set up an account at adafruit.io.
  • This repo is set to build in VSCode. Install the Arduino for Visual Studio Code extension..

Hardware Setup

This project assumes the following hardware setup:

  • Load sensors attached to an HX711_ADC
  • HX711_ADC attached to an Arduino MKR1000

The Arduino MKR1000 contains built in WiFI capabilities, however any internet enabled Arduino setup should work.

See my blog post for more details on the physical assembly.

Getting started

Install these Arduino libraries

  • WiFi101 / WifiNINA Firmware Updater
  • HX711_ADC by Olav Kallhovd (link)
  • Adafruit IO Arduino Library (link)

Note: You should be able to install all of these from the Arduino library manager.

Upload the Adafruit.IO certificate onto your MKR1000

Follow these instructions to upload the Adafruit.IO certificate onto your arduino.

Note: Update your Wifi firmware while you are at it.

Define your secrets

Create a file called secrets.hin the main directory and populate it with your Wifi credenfials and your Adafruit.IO API username and key. The file should look like this:

#define SECRETS__IO_USERNAME "xxxxx"
#define SECRETS__IO_KEY "xxxxxxxxxx"
#define SECRETS__WIFI_SSID "xxxxxxx"
#define SECRETS__WIFI_PASS "xxxxxxx"

Software Architecture

Software Layer Diagram

The software is layered as follows, starting from the lowest level:

  • CircularBuffer: The HX711 library is used to feed load sensor data into a circular buffer which is used to perform smoothing of the weight signal.

  • LoadCell_MaxInTimeWindow: This layer is used to keep track of the max weight reading within a given time period.

  • Main: The main layer obtains these periodic measurements and pushed them up to your Adafruit.IO feed.

Working in VS Code

Useful commands (Ctrl-P)

  • Open Serial Monitor
  • Upload
  • Verify ##(builds your codes)##

Keep VSCode open in Windows mode. You can keep your code in WSL.

Notes

Getting VSCode intellisense to work

See the last section here: microsoft/vscode-arduino#765. You need to make sure VSCode recognizes your headers, you will need to update c_cpp_properties.json.

How to add a new SSL cert to the Arduino MKR1000

  • connect board to PC's USB port
  • Launch the Adruino IDE (Not VSCode)
  • Upload onto the board the FirmwareUpdater sketch from the WiFI samples (in the Arduino IDE)
    • Examples > Wifi101 > Firmware Updater. Then click upload button
  • From the tools menu open the Wifi101/WifiNINNA Firmware Updater Tool
  • Remove domains from the box in section #3 (it will probably be arduino.cc:443)
  • Using the "Add domain" button and certificates for these URLs: "arduino.cc", "io.adafruit.com"
  • Click "Upload Certificates to WiFi module" button.
  • Back in VSCode open up the Patooti Scale project (this project)
  • Press Ctrl+P then run the "Arduino: Upload" command
  • Go this think link and verify that you start rec'ving data (may take up to 1 minute) https://io.adafruit.com/bizarrodavid/dashboards/patooti

About

Software for an IoT scale. It periodically uploads weight data from an Arduino MKR1000 to your Adafruit.IO account. I use it to keep track of my cat's weight when she goes to the litter box.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published