NEW Aug. 25, 2021!

Since the last firmware files were posted on Aug. 11 I’ve found and corrected a few more bugs. The files below are the latest updates.

This post contains links to all of the source code files associated with CTR2. These include firmware source code for the Teensy 4.1 development board and the Nextion display and their compiled binaries.

You’ll also need to create an SD card with the default data folders and files used by the Teensy 4.1 to store settings. You can download those files from the CTR2 Default SD Card Files post.

If you have access to a CNC mill and want to cut out your own display enclosure, download the appropriate file for your display from the Display Enclosure CNC Files post.


The source code for this project is copyright 2021 by Lynn H. Hansen. All code is open source and is subject to the terms of GPL3 (GNU GENERAL PUBLIC LICENSE, Version 3.0, 29 June 2007). You may download, modify, and use this software for your own personal use. The right to manufacture or otherwise commercialize CTR2 hardware and/or software is not granted by this license.


The CTR2 firmware for the Teensy 4.1 development board was created using the Arduino IDE (or an Arduino compatible IDE). The complete source code is contained in the file below. Because of the size of the source code I split the CTR2.ino file into many sub-files. All files must be copied to a folder named CTR2. The CTR2.ino can be thought of as the master file and is the one you open in the Arduino IDE. It has the global declarations for variables used by the other files. The other files contain code for specific functions and will automatically load into the Arduino IDE when the CTR2.ino file is opened.

Visit my FW – Setting up your programming environment and uploading firmware post for instructions on how to use these files.

To upload the CTR2 firmware to the Teensy, open CTR2.ino in your IDE and compile it. Once this is done use the IDE to compile it and send it to the Teensy board.

The CTR2_Executable_xx-xx-xx.hex file is the executable file for the Teensy 4.1. It can be downloaded to the Teensy using an external program such as AVRDude but this is not for the faint of heart.


The code for the Nextion display is created in the Nextion IDE. The compiled file uses the .tft name extension. There are two ways to get the .tft firmware into your display.

  1. Download the display source code file for your display. Unzip the files then open the .hex file in the Nextion IDE. In the IDE, select the File – TFT file output menu option to create the .tft file. You will be asked where you want to save the .tft file. Save it somewhere you can find it again!
  2. Download the .tft executable file below for you display.

Source files for the Nextion 3.5″ and 5″ Enhanced displays

Executable (.tft) files for the Nextion 3.5″ and 5″ Enhanced displays

Once you have the .tft file, copy it to a blank SD card. Make sure your display is off then insert that card into the SD card slot on the back of the display. Turn the display on. The display will update its program with the .tft file. Once this is done, turn off the display and remove the SD card. You can use the SD card on the Teensy 4.1 board to save data files.


To verify that you have the correct code versions loaded on your HMI and display, navigate to the Settings -> Config page. The two text boxes under the Delete Log button will show the Code ver: and Disp ver: dates for the Teensy and the display. These dates should match the dates shown on the files above. These dates should always match.

Leave a Reply

Your email address will not be published. Required fields are marked *