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
- 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..
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.
- 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.
Follow these instructions to upload the Adafruit.IO certificate onto your arduino.
Note: Update your Wifi firmware while you are at it.
Create a file called secrets.h
in 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"
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.
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.
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.
- 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