Scale Software
This page provides information to aid in the installation of the scale sketch for the Pinewood Derby Car Scale. Refer to the Construction page for information on constructing the scale's hardware (circuit, enclosure, etc.).
The following subjects are covered:
Programming Environment
The following sections describe the software needed to install the scale sketch onto the Teensy 4.0
Arduino Environment
The Arduino development environment is required whether you will be utilizing the default Teensy 4.0 microcontroller or the optional Arduino Due microcontroller. It consists of an integrated development environment (IDE) that allows programs to be edited, compiled and uploaded to the microcontroller. Refer to the Arduino web page which corresponds to your system type and follow the steps to download, install and test the IDE:
- Windows: https://www.arduino.cc/en/Guide/Windows
- Mac OS: https://www.arduino.cc/en/Guide/MacOSX
- Linux: https://www.arduino.cc/en/Guide/Linux
Teensyduino
For the Teensy 4.0 microcontroller an add-on needs to be installed which allows the Teensy to be programmed within the Arduino environment. See this page to download the installer and for detailed installation instructions. After installation the remaining steps in uploading the sketch are done from within the Arduino IDE.
Additional Libraries
A few additional libraries need to be installed to support the load cell amplifiers and the TFT display. Information about installing libraries can be found on the following web page: https://www.arduino.cc/en/Guide/Libraries
Referring to the first section, "How to Install a Library using the Library Manager", search for and install the following libraries:
- HX711_ADC
Verification
To verify the programming environment has been installed correctly open the "Blink" sketch in the Arduino IDE; use the corresponding sketch for the microcontroller being used:
Arduino Due: File > Examples > 01.Basics > Blink
Teensy 4.0: File > Examples > Teensy > Tutorial1 > Blink
Upload the sketch and verify the LED is blinking on the microcontroller.
Scale Sketch
If you have not done so already download the scale sketch. Extract the scale folder from the zip file and place it anywhere on your computer. Inside the folder you should see two files: scale.ino and logo.h.
BACK TO TOPConfiguration
There are no software configuration options in the scale sketch. Refer to the Construction page for information on available options via hardware.
BACK TO TOPUploading Sketch
In the Arduino IDE open the scale sketch from the folder and upload the sketch to the microcontroller by pressing the "Upload" button. This is the same process used when you tested your environment by uploading the blink example earlier.
BACK TO TOPOperation
Operation of the scale is simple. Turn on the scale by making sure the DC power supply is plugged in and the scale's power switch, if installed, is in the "On" position. The startup screen will be briefly displayed and then the main screen will be shown. If needed, tare the scale and then place the derby car on the scale. The weight and weight distribution (%) will be displayed. Once the weight reading stabilizes, the car's approximate center of gravity will be indicated on the display by a small red dot on the car graphic. Use the "Units" button to toggle between displaying the weights in grams and ounces.
BACK TO TOPCalibration
Calibration of the scale is done utilizing a 50g reference weight which is placed on each load cell in turn so the scale can calculate and store a unique calibration factor for each cell.
The calibration sequence is started as follows:
- turn on the scale
- when the start-up screen is displayed, press and hold the Tare button
- when the calibration screen is display, release the Tare button
Follow the instructions on the display to complete the calibration sequence.
BACK TO TOPCreated: 1 Nov 2020Last updated: 9 Jan 2021