Pinewood Derby Tools

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:

BACK TO SCALE OVERVIEW PAGE

If you purchase the Teensy 4.0 from the store there is an add-on option to have the scale sketch preloaded and tested.

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:

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:

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.

Do not continue until you have successfully uploaded the blink example to your board as described in the above instructions. If you could not get the blink example to work you will not be successful uploading the scale sketch.
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.

There are a couple of quirks in the Arduino environment:
1) the folder name MUST match the name of the scale sketch. You can change the name but they must match. So, if you name the sketch fred.ino then the name of the folder must be fred.
2) Keeping multiple copies of the scale sketch (backups for example) in the folder will cause the compile to fail. There should only be one sketch file (.ino) in the folder, move any backups to another directory.
BACK TO TOP

Configuration

There are no software configuration options in the scale sketch. Refer to the Construction page for information on available options via hardware.

BACK TO TOP

Uploading 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 TOP

Operation

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 TOP

Calibration

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:

Follow the instructions on the display to complete the calibration sequence.

BACK TO TOP

Last updated: 9 Jan 2021