2.2 spi tft lcd teensy 3.6 hookup free sample
The SPI library allows you to communicate with one or more SPI (Serial Peripheral Interface) devices. Only SPI master mode is supported, for control of SPI peripheral chips.
This page documents a newer SPI library, released in Arduino 1.0.6 and Teensyduino 1.20, with beginTransaction() and endTransaction(). These new transaction functions prevent SPI bus conflicts, so their use it recommended for all new projects.
SPI has 4 signals: SS, SCK, MOSI, MISO. SCK is a clock signal. Master Out Slave In (MOSI) sends data from the SPI master to one or more slaves. Master In Slave Out (MISO) is how slaves send data back to the master. To talk to only one of several slaves, the Slave Select (SS) pin is used. Thus, some chips need only 3 or even 2 of these signals; a display, for example, will use MOSI but not MISO, as it is an output only device.
The SPI protocol allows for a range of transmission speeds ranging from 1Mhz to 100MHz. SPI slaves vary in the maximum speed at which they can reliably work. Slower speeds are usually needed when 5 volt signals are converted to 3 volts using only resistors. Together with the capacitance associated with the wire and pins,
The serial clock can be either normally high or normally low (clock polarity), and data can be sent on the rising or falling clock edge (clock phase). The four combinations of clock phase and polarity are expressed as the clock mode, numbered 0 to 3 (more on clock modes). Most SPI chips are designed to work with either mode 0 or mode 3.
If all the SPI slaves in a project use mode 0, MSB first, and work at the default 4MHz clock speed, you don"t need to set any SPI options. If any use non default setting, then define this for all SPI devices you are using.
A common problem used to be that different SPI devices needed different, incompatible settings. Your sketch had to take care of saving and restoring the SPI settings before communicating with each SPI device. If any SPI device was accessed from an interrupt, this could result in data corruption if another SPI device was communicating at the time.
With the new SPI library, configure each SPI device once as an SPISettings object. Also, if that device will be called from an interrupt, say so with SPI.usingInterrupt(interruptNumber). To communicate with a specific SPI device, use SPI.beginTransaction which automatically uses the settings you declared for that device. In addition, it will disable any interrupts that use SPI for the duration of the transaction. Once you are finished, use SPI.endTransaction() which re-enables any SPI-using interrupts.
Used by older versions of the SPI library, this method was not interrupt safe and depended on your sketch doing low-level SPI configuration management.
SPI speed was set indirectly, as a function of the Teensy clock, with SPI.setClockDivider(divider). SPI_CLOCK_DIV2 was the fastest option. This meant that code running on a 16MHz Teensy 2 and a 96MHz Teensy 3.2 would set the SPI speed differently to achieve same actual speed for the device.
Sometimes, the SPI pins are already in use for other tasks when an SPI device is added to a project. If that task is simply a digital pin, or an analog input, it is usually better to move that to another pin so that the hardware SPI can be used. Sometimes though, the conflicting pin cannot be moved. The Audio Adapter, for example, uses some of the SPI pins to talk to the Audio DAC over I2S. For this case, Teensy 3.x provides an alternate set of SPI pins.
The main SPI pins are enabled by default. SPI pins can be moved to their alternate position with SPI.setMOSI(pin), SPI.setMISO(pin), and SPI.setSCK(pin). You can move all of them, or just the ones that conflict, as you prefer. The pin must be the actual alternate pin supported by the hardware, see the table above; you can"t just assign any random pin.
You should be aware that libraries sometimes have to move SPI pins. (The Audio Library is an example). If you add an SPI device yto your project and it does not work, check whether the library has moved the pins and if so, use the same pins the library does.
If all else fails, the SPI protocol can be emulated ("bit-banged") in software. This has the advantage that any convenient pins can be used, and the disadvantage that it is much, much slower and prevents your sketch from doing useful work meanwhile.
Fix compiler warnings & improved error messages: EEPROM, Adafruit_CC3000, Adafruit_GFX, Adafruit_ILI9340, Adafruit_ILI9341, Adafruit_RA8875, ADC, FastCRC, FrequencyTimer2, i2c_t3, ILI9341_t3, IRremote, Keypad, ks0108, LowPower, OctoWS2811, OneWire, openGLCD, OSC, PulsePosition, RA8875, SerialFlash, SoftPWM, ssd1351, ST7565, Talkie, Time, TimerOne, TinyGPS, Tlc5940, x10
Libraries updated: Audio, FastCRC, FreqMeasureMulti, PS2Keyboard, SerialFlash, FreqCount, LedDisplay, SerialFlash, Talkie, TFT_ILI9163C, FastLED, ADC, TimeAlarms, TimerOne, TimerThree
Update LiquidCrystal, Adafruit_GFX, Adafruit_NeoPixel, AltSoftSerial, Audio, CapacitiveSensor, DS1307RTC, Encoder, i2c_t3, ILI9341_t3, OctoWS2811, OneWire, SerialFlash, ShiftPWM, Snooze, TFT_ILI9163C, Time, TimerOne, TimerThree, Adafruit_SSD1306, ADC, OctoWS2811
Libraries ported to Teensy 3.x: AltSoftSerial, CapacitiveSensor, FlexiTimer2, FreqCount, FreqMeasure, FrequencyTimer2, MsTimer2, ShiftPWM, TimerOne, TimerThree, Tlc5940
Updated Time library. "atime_t" on Teensy 3.0 changed back to "time_t". Date strings fixed on Teensy 3.0. NTP and GPS sync examples updated for Arduino 1.0.4. Many other fixes and improvements to the Time library examples.
Added partial SoftwareSerial for Teensy 3.0. If the pins match one of the real serial ports, hardware serial is used. This allows use of libraries that are hard-coded for SoftwareSerial. If non-serial pins are specified, only transmit works. Software-based receive is not yet supported (but planned for a future release)
I"m still waiting for the last few components to arrive before I can build the controller, however one thing I wanted to do first is test my chosen LCD with the Teensy microcontroller. I"ve never used a TFT LCD with Arduino or Teensy before, so I first wanted to make sure that I could get the desired functionality and performance out of the LCD.
The LCD I am using is a 2.4" 320x240 TFT LCD with a ILI9341 controller chip which appears to be based off of an Adafruit design, which can be used with a Teensy-optimised Adafruit_ILI9341 library for better performance.
I decided to use the Teensy-optimised Adafruit_ILI9341 library over the standard Adafruit_ILI9341 library due to the demonstrated increased frame rate and performance of the former. I downloaded the library from the Github page and followed the provided instructions to install it into the Arduino software.
After a quick online search I couldn"t find any decent tutorials on using the LCD"s Arduino library to draw shapes (which is mostly what I want the LCD to do), however after dissecting the example sketches that come with the library it became quite clear how to do it. The best source to find out what functionality is provided is the library"s main header file, which shows all the functions that library provides such as drawRect, fillRect, fillCircle, and many more.
To test the LCD and Arduino library I decided to attempt to create a simple Teensy sketch that draws eight sliders on the LCD that each change their value from a MIDI CC message received over USB-MIDI - something that the final controller software will need to do.
Below is the code I created to do this. See the comments in the code to see how it works. The exact MIDI CC numbers I am using in this test code match the default CCs that the KORG nanoKONTROL MIDI controller sends from it"s sliders (see the below example video). If you would like to upload this to a Teensy yourself, you"ll need to set the "USB Type" to "MIDI" in the tools menu.
Below is an example video of the above code running on a Teensy 3.6, using a KORG nanoKONTROL USB-MIDI controller as the MIDI input device, with MIDI messages being routed from the nanoKONTROL to the Teensy using my MacBook running the MIDI Patchbay software.
Fully Asynchronous UDP Library for Teensy 4.1 using QNEthernet. The library is easy to use and includes support for Unicast, Broadcast and Multicast environments.
Enable inclusion of both ESP32 Blynk BT/BLE and WiFi libraries. Then select one at reboot or run both. Eliminate hardcoding your Wifi and Blynk credentials and configuration data saved in either LittleFS, SPIFFS or EEPROM.
Simple Ethernet Manager for MultiBlynk for Teensy, SAM DUE, SAMD21, SAMD51, nRF52, ESP32, ESP8266, RP2040-based (Nano_RP2040_Connect, RASPBERRY_PI_PICO) boards, etc. with or without SSL, configuration data saved in ESP8266/ESP32 LittleFS, SPIFFS, nRF52/RP2040 LittleFS/InternalFS, EEPROM, DueFlashStorage or SAMD FlashStorage.
Simple GSM shield Credentials Manager for Blynk and ESP32 / ESP8266 boards, with or without SSL, configuration data saved in LittleFS / SPIFFS / EEPROM.
Simple WiFiManager for Blynk and ESP32 with or without SSL, configuration data saved in either SPIFFS or EEPROM. Enable inclusion of both ESP32 Blynk BT/BLE and WiFi libraries. Then select one at reboot or run both. Eliminate hardcoding your Wifi and Blynk credentials and configuration data saved in either LittleFS, SPIFFS or EEPROM. Using AsyncWebServer instead of WebServer, with WiFi networks scanning for selection in Configuration Portal.
Simple GSM shield Credentials Manager for Blynk and ESP32 / ESP8266 boards, with or without SSL, configuration data saved in LittleFS / SPIFFS / EEPROM.
Simple Async WiFiManager for Blynk and ESP32 (including ESP32-S2, ESP32-C3), ESP8266 with or without SSL, configuration data saved in either LittleFS, SPIFFS or EEPROM. Now working with new ESP8266 core v3.0.1 and ESP32 core v1.0.6
Simple WiFiManager for Blynk with MultiWiFi Credentials, for Mega, SAM DUE, SAMD21, SAMD51, nRF52, STM32F/L/H/G/WB/MP1, Teensy, RP2040-based RASPBERRY_PI_PICO, etc. boards running ESP8266/ESP32-AT shields. Configuration data saved in EEPROM, EEPROM-emulated FlashStorage_STM32 or FlashStorage_SAMD, SAM-DUE DueFlashStorage or nRF52/TP2040 LittleFS.
Simple WiFiManager for Blynk and ESP32 (including ESP32-S2, ESP32-C3), ESP8266 with or without SSL, configuration data saved in either LittleFS, SPIFFS or EEPROM. Now working with new ESP8266 core v3.0.0 and ESP32 core v1.0.6
Simple WiFiManager for Blynk and Mega, UNO WiFi Rev2, Teensy, SAM DUE, SAMD21, SAMD51, STM32, nRF52, RP2040-based boards, etc. using WiFiNINA shields, configuration data saved in EEPROM, FlashStorage_SAMD, FlashStorage_STM32, DueFlashStorage, nRF52/RP2040 LittleFS
DDNS Update Client Library for SAM DUE, nRF52, SAMD21/SAMD51, STM32F/L/H/G/WB/MP1, AVR Mega, megaAVR, Teensy, RP2040-based RASPBERRY_PI_PICO, WT32_ETH01, Portenta_H7, etc. besides ESP8266/ESP32, using ESP8266-AT/ESP32-AT WiFi, WiFiNINA, Ethernet W5x00, ENC28J60, LAN8742A or Teensy NativeEthernet
Library to detect a double reset, using EEPROM, DueFlashStorage, FlashStorage_SAMD, FlashStorage_RTL8720, FlashStorage_STM32 or LittleFS/InternalFS. For AVR, Teensy, SAM DUE, SAMD, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO, RTL8720DN, MBED nRF52840-based Nano_33_BLE, Portenta_H7, etc. boards. Now using efficient FlashStorage_STM32 library and supporting new RP2040-based Nano_RP2040_Connect, Portenta_H7, RASPBERRY_PI_PICO and STM32 core v2.0.0
Simple WebServer library for AVR, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52, SIPEED_MAIX_DUINO and RP2040-based (RASPBERRY_PI_PICO) boards using ESP8266/ESP32 AT-command shields with functions similar to those of ESP8266/ESP32 WebServer libraries
WizFi360/ESP8266/ESP32-AT library for Arduino providing an easy-to-use way to control WizFi360/ESP8266-AT/ESP32-AT WiFi shields using AT-commands. For AVR, Teensy, SAM DUE, SAMD21, SAMD51, STM32, nRF52, SIPEED_MAIX_DUINO and RP2040-based (Nano_RP2040_Connect, RASPBERRY_PI_PICO, etc.) boards using WizFi360/ESP8266/ESP32 AT-command shields.
Library to detect a multi reset within a predetermined time, using RTC Memory, EEPROM, LittleFS or SPIFFS for ESP8266 and ESP32, ESP32_C3, ESP32_S2, ESP32_S3
Simple Ethernet WebServer, HTTP Client and WebSocket Client library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, W6100, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet
Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client.
Simple Ethernet library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, W5100S, W6100
Simple Ethernet Manager for Teensy, SAM DUE, SAMD, nRF52, ESP32 (including ESP32-S2/C3), ESP8266, RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO, etc. boards. Config data saved in ESP LittleFS, SPIFFS or EEPROM, nRF52 LittleFS, EEPROM, DueFlashStorage or SAMD FlashStorage.
ESP32 VGA, PAL/NTSC Color Composite, SSD1306 ILI9341 ST7789 Controller, PS/2 Mouse and Keyboard Controller, Graphics Library, Graphical User Interface (GUI), Sound Engine, Game Engine and ANSI/VT Terminal
FTP Client for Generic boards such as AVR Mega, megaAVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based (Nano-RP2040-Connect, RASPBERRY_PI_PICO, RP2040W, etc.), ESP32/ESP8266 using Ethernet
Enables GSM/GRPS network connection using the Generic GSM shields/modules. Supporting ESP32 (including ESP32-S2, ESP32-C3), ESP8266, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based boards, etc.
Library to detect a multi reset, using EEPROM, DueFlashStorage, FlashStorage_SAMD, FlashStorage_RTL8720, FlashStorage_STM32 or LittleFS/InternalFS. For AVR, Teensy, SAM DUE, SAMD, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO, RTL8720DN, MBED nRF52840-based Nano_33_BLE, Portenta_H7, etc. boards. Now using efficient FlashStorage_STM32 library and supporting new RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO and STM32 core v2.0.0
Connects to MySQL or MariaDB using ESP8266/ESP32, WT32_ETH01 (ESP32 + LAN8720A), nRF52, SAMD21/SAMD51, STM32F/L/H/G/WB/MP1, Teensy, SAM DUE, Mega, RP2040-based boards, Portenta_H7, etc. with W5x00, ENC28J60 Ethernet, Teensy 4.1 NativeEthernet/QNEthernet, WiFiNINA modules/shields or Portenta_H7 WiFi/Ethernet. W5x00 can use Ethernet_Generic library. ENC28J60 can use either EthernetENC or UIPEthernet Library.
This library enables you to use SPI SD cards with RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO using either RP2040 Arduino-mbed or arduino-pico core.
Use the low-power high-resolution ICM 20948 9 DoF IMU from Invensense with I2C or SPI. Version 1.2 of the library includes support for the InvenSense Digital Motion Processor (DMP™).
Enables reading and writing on SD card using SD card slot connected to the SDIO/SDMMC-hardware of the STM32 MCU. For slots connected to SPI-hardware use the standard Arduino SD library.
Adds tcUnicode UTF-8 support to Adafruit_GFX, U8G2, tcMenu, and TFT_eSPI graphics libraries with a graphical font creation utility available. Works with existing libraries
This library enables you to use Hardware-based PWM channels on Teensy boards, such as Teensy 2.x, Teensy LC, Teensy 3.x, Teensy 4.x, Teensy MicroMod, etc., to create and output PWM to pins. Using the same functions as other FastPWM libraries to enable you to port PWM code easily between platforms.
This library enables you to use ISR-based PWM channels on Teensy boards, such as Teensy 2.x, Teensy LC, Teensy 3.x, Teensy 4.x, Teensy MicroMod, etc., to create and output PWM any GPIO pin.
This library enables you to use Interrupt from Hardware Timers on an Arduino, Adafruit or Sparkfun AVR board, such as Nano, UNO, Mega, Leonardo, YUN, Teensy, Feather_32u4, Feather_328P, Pro Micro, etc.
This library enables you to use Interrupt from Hardware Timers on supported Arduino boards such as AVR, Mega-AVR, ESP8266, ESP32, SAMD, SAM DUE, nRF52, STM32F/L/H/G/WB/MP1, Teensy, Nano-33-BLE, RP2040-based boards, etc.
Really tiny library to basic RTC functionality on Arduino. DS1307, DS3231 and DS3232 RTCs are supported. See https://github.com/Naguissa/uEEPROMLib for EEPROM support. Temperature, Alarms, SQWG, Power lost and RAM support.
Monochrome LCD, OLED and eInk Library. Display controller: SSD1305, SSD1306, SSD1309, SSD1312, SSD1316, SSD1318, SSD1320, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1617, UC1638, UC1701, ST7511, ST7528, ST7565, ST7567, ST7571, ST7586, ST7588, ST75160, ST75256, ST75320, NT7534, ST7920, IST3020, IST3088, IST7920, LD7032, KS0108, KS0713, HD44102, T7932, SED1520, SBN1661, IL3820, MAX7219, GP1287, GP1247, GU800. Interfaces: I2C, SPI, Parallel.
True color TFT and OLED library, Up to 18 Bit color depth. Supported display controller: ST7735, ILI9163, ILI9325, ILI9341, ILI9486,LD50T6160, PCF8833, SEPS225, SSD1331, SSD1351, HX8352C.
RFC6455-based WebSockets Server and Client for Arduino boards, such as nRF52, Portenta_H7, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, Teensy, SAM DUE, RP2040-based boards, besides ESP8266/ESP32 (ESP32, ESP32_S2, ESP32_S3 and ESP32_C3) and WT32_ETH01. Ethernet shields W5100, W5200, W5500, ENC28J60, Teensy 4.1 NativeEthernet/QNEthernet or Portenta_H7 WiFi/Ethernet. Supporting websocket only mode for Socket.IO. Ethernet_Generic library is used as default for W5x00. Now supporting RP2040W
Light-Weight MultiWiFi/Credentials Manager for Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52, RTL8720, etc. boards running Generic WiFi (WiFiNINA, WiFi101, ESP8266-AT, ESP32-AT, etc.) modules/shields. Powerful-yet-simple-to-use feature to enable adding dynamic custom parameters.
Light-Weight MultiWiFi/Credentials Manager for AVR Mega, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based (Nano RP2040 Connect, RASPBERRY_PI_PICO) boards, etc. using u-blox WiFiNINA / WiFi101 modules/shields. Powerful-yet-simple-to-use feature to enable adding dynamic custom parameters.
Enables network connection (local and Internet) and WiFiStorage for SAM DUE, SAMD21, SAMD51, Teensy, AVR (328P, 32u4, 16u4, etc.), Mega, STM32F/L/H/G/WB/MP1, nRF52, NINA_B302_ublox, NINA_B112_ublox, RP2040-based boards, etc. in addition to Arduino MKR WiFi 1010, Arduino MKR VIDOR 4000, Arduino UNO WiFi Rev.2, Nano 33 IoT, Nano RP2040 Connect. Now with fix of severe limitation to permit sending much larger data than total 4K and using new WiFi101_Generic library
Simple WiFiWebServer, HTTP Client and WebSocket Client library for AVR Mega, megaAVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based (Nano-RP2040-Connect, RASPBERRY_PI_PICO, RASPBERRY_PI_PICO_W, ESP32/ESP8266, etc.) boards using WiFi, such as WiFiNINA, WiFi101, CYW43439, U-Blox W101, W102, ESP8266/ESP32-AT modules/shields, with functions similar to those of ESP8266/ESP32 WebServer libraries.
Creating a good real-time simulation of a music speaker cabinet generally requires an FIR filter with a large number of taps—more than was possible with the Teensy 3.6. In this project article, Brian builds one using the Teensy 4.1 module, making use of its large memory, faster speed and added features.
In my article “Fancy Filtering with the Teensy 3.6” (Circuit Cellar 346, May 2019) [1], I introduced convolution filtering, which can be used for guitar cabinet simulation, among many other things. By using FFT routines, you can convert a time-domain-based convolution filter into one that is implemented in the frequency domain. As I explained in that article, this allows the filtering to be performed much more quickly. For example, the Teensy 3.6 board that I used at the time could easily handle a 512-tap FIR filter in real time, without taxing the MCU too much.
However, for guitar speaker cabinet simulation it turns out that getting a really good simulation generally requires an FIR filter with a much larger number of taps. Although the Teensy 3.6 board’s microcontroller (MCU) had enough “horsepower” to handle a filter with more than 512 taps, there are other complications. The larger the number of taps in the filter, the larger the RAM memory requirements are. When I started using the Teensy 3.6 board, its 256KB of SRAM seemed huge, but it turns out it’s not enough to handle FIR filters (implemented using floating-point FFT methods) a lot larger than 512 taps.
When the Teensy 4.0 board became available, it sported 1MB of SRAM, which would seem to solve the memory problem. It also ran at 600MHz (more than 3 times the speed of the MCU used on the Teensy 3.6), so it looked like execution time might not be an issue. However, another issue seemed to me to be unsolvable.
The 128-point partition size is not a random choice. The Teensy Audio Library deals exclusively with 128-sample blocks. That is, it buffers the incoming audio samples from the NXP Semiconductor SGTL5000’s ADC into 128-sample blocks, and uses DMA to move these blocks among the other buffers used by the various audio library functions. To provide steady, uninterrupted sound output, any Teensy Audio Library routine must accept a 128-sample block every 2.9ms, and output a processed 128-sample block at the same rate.
The idea of the uniformly partitioned convolution filter previously described sounds easy, and I implemented it in less than 100 lines of code in my library routine. However, that small size was largely due to my extensive use of CMSIS (Common Microcontroller Software Interface Standard) DSP routines, and it wasn’t easy to come up with that code. Frank spent a lot of time studying Warren Pratt’s code to adapt it to a form that would compile with the Teensy’s Arduino-based compiler. I played a small role in this. My contribution was in porting his code into a C++ Teensy Audio Library class, optimizing it a bit and performing some testing.
The Arm CMSIS DSP routines perform many different matrix-style operations, such as complex FFT, iFFT and time-domain convolution routines. These routines make heavy use of the Arm DSP-like instructions that are available on the NXP (formerly Freescale) MIMXRT1062 Cortex M7 MCU used on the Teensy board. The FFT and iFFT routines contain large tables (related to the size of the FFT you are performing) that are used as look-up tables to speed up the FFT operation. I believe these tables are used to eliminate the bit-twiddling operation (swapping all bits MSB to LSB) that is a part of the FFT routine. It would be impossible to independently write code for such routines that ran as fast as the CMSIS ones do!
Every 2.9ms, a 128-sample block of 16-bit audio data (for both Left and Right channels) is made available by the Teensy Audio Library. Since the CMSIS complex FFT routine expects both I (in-phase) and Q (quadrature) values, the Left and Right channels’ samples are used for I and Q, respectively, and are processed independently. For this project, only a monaural guitar signal is available, so the Q channel processing is basically wasted.
The 256-sample audio signal block is then converted into the frequency domain by a complex 256-point FFT. So, we now have both the Filter Mask and the incoming audio signal in the frequency domain. These frequency domain data blocks are stored in a circular buffer in memory, which implements a frequency domain delay line. The convolution process, if performed in the time domain, is a math-intensive process. Its execution time is linearly related to the number of taps in the Filter Mask. Even the very fast Cortex M7 MCU on the Teensy 4.1 board couldn’t handle time domain convolutions (in real time) using Filter Masks with the number of taps in the 2,000+ range. However, in the frequency domain, convolution is reduced to multiplication, and the execution time is now proportional to the log of the number of Filter Mask taps. The Teensy 4.1 probably has enough processing “horsepower” to handle Filter Masks of >50,000 taps. However, the Teensy 4.1 RAM memory is not large enough to accommodate the large arrays needed for such a large number of FIR filter taps.
Figure 2a: I patched my program to pass along the incoming 128-sample audio blocks to the SGTL5000 DAC with the convolution filter routine patched out. The latency here was 6.4ms. This is the minimum latency you could ever achieve, using the Teensy Audio Library with no processing blocks added.
In the Teensy Audio Library, the ADC signals are accumulated into a 128-sample buffer before they are processed. This results in a 2.9ms delay at 44,100 sample rate.
These files must be added to the folder containing the Teensy Audio Library. This folder will be located under whatever folder you have installed the Arduino/Teensyduino IDE. The path is as follows:
Please refer to the schematic shown in Figure 5. The Teensy 4.1 module used for this project contains the NXP (formerly Freescale) MIMXRT1062 Arm Cortex M7 MCU running at 600MHz. This MCU contains 1MB of RAM storage, which is necessary to handle the long impulse files that I mentioned earlier. Unlike the Teensy 4.0 module used in my earlier project article, the Teensy 4.1 contains extra on-board features, some of which are used in this project:
To maximize the size of the impulse files that the project would handle, I mounted one 8MB PSRAM chip on the board. Unfortunately, this QSPI PSRAM memory is not fast enough to be used for the various arrays needed by the real-time convolution routines. Accordingly, the size of the impulse files can’t become so large that they would need this PSRAM. However, I do use the PSRAM to store the files that are loaded in from the SD card, as well as for temporary arrays used when the integer values from the SD card are converted to floating-point for use by the convolution routine.
I use the SD card socket on the Teensy 4.1 to store the impulse files. It is connected to the MCU via a high speed SDIO port. The Teensy Audio Adapter [4] also contains an SD card socket, but it is interfaced via SPI, so it is a lot slower. Using the SDIO-connected SD card socket on the Teensy 4.1, the amount of time it takes to load a 22,500-sample impulse file (the maximum size this project will handle) is about 150ms. This is as fast as you can stomp on the switch to advance from one impulse to the next, so there is no noticeable delay.
The power for the Teensy 4.1 can be provided either by plugging a USB 5V adapter into the micro-USB socket on the Teensy 4.1 module, or supplying 5V to the VIN pin. I supply 5V using a USB 5V adapter. This 5V also feeds out through the Teensy’s VIN pin and that supplies 5V to the FET preamplifier through an LC filter.
There is a Texas Instruments (TI) TLV75733 LDO regulator on the Teensy 4.1. It provides a regulated 3.3V for the MIMXRT1062 MCU, and makes this 3.3V power available for external circuitry, using the “3.3V” pin. The Teensy Audio Adapter board is powered by this 3.3V supply.
In this project, I make no use of the dedicated DSP, though I have used it successfully in earlier projects. The SGTL5000 datasheet doesn’t specifically mention how many bits of resolution the codec supports, but in any case, the Teensy Audio Library supports only 16-bits.
Unfortunately, I found that the noise level that I got using these two devices was more than I preferred. I was using a protoboard with reasonably sized ground and VCC tracks, and did the hand-wiring as carefully as I could. I guess that there was too much noise on the ground bus, or picked up from the MIMXRT1062, but I wasn’t able to reduce it enough for my liking. So, out came my solder sucker, and the ADC/DAC circuitry was replaced by the Teensy Audio Adapter board.
Although the Teensy Audio Adapter board contains most of the mixed-signal circuitry needed for the project, there is one issue. The Line Inputs have enough gain to handle a guitar’s signal properly; in fact, I set the input amplifier for a full-scale amplitude of 560mV. (Its most sensitive setting is 240mV.) However, the Line In input impedance is only 29kΩ. Most guitars, apart from those with an internal pre-amplifier, have a high source impedance. Their tone will be seriously degraded if the input impedance of the amplifier they are plugged into is less than 100kΩ. Commercial guitar amplifiers have an input impedance of 500kΩ to 1MΩ.
I was planning on using the left channel Line Out for the output signal. As I was building/programing the unit, I simply had been plugging headphones into the Teensy Audio Adapter’s headphone output. This had provided an acceptable signal-to-noise ratio. However, when I tried to feed the Line Out signal into my studio mixer, I found significantly more noise. I attributed the difference between the two outputs to ground noise introduced into the Line Output signal.
I used a common 2.8” SPI-based color TFT touchscreen display for the unit. Initially I didn’t plan on having any graphics requirements, but I wanted to be able to display the impulse name in a medium-sized font, and also display an impulse number in a large (72pt) font that could be seen at a distance. The touchscreen display works fine for this, and is only slightly more expensive than common alphanumeric LCD displays, which are not particularly readable in the dark or at any distance.
I wanted to have a descriptive impulse name displayed on the TFT screen. However, the SD card library that I have used in the past could handle only the old DOS-standard 8.3 filenames. It wouldn’t be much use to display only the 8 characters that made up the primary file name. Therefore, I wired up the touchscreen controller and added a feature to the program that would allow the user to enter a descriptive name for each loaded impulse file, using the touchscreen for initial data entry. This descriptive name would be linked to the impulse file name, and stored in the MCU’s EEPROM space (which is emulated in flash memory).
Just after I finished doing this, I read on the PJRC (Teensy) Forum that the latest beta version of the Teensyduino Arduino add-in contained support for long filenames, as part of the new SD card library. Incorporating that feature seemed like a much better solution, since one could merely rename each impulse file with a longer file name that was more descriptive. That eliminated the need to store descriptive impulse names in EEPROM and the use of the touchscreen to enter those names.
I realized, after looking at the mostly empty TFT screen (just an impulse name and a large font impulse #), that it would be interesting to display a picture of the guitar amplifier (or speaker cabinet) that was being simulated. It’s pretty easy to find such images on the Internet, snip them off the screen and format them in a picture editor.
My Windows 10 snipper program saves its screen captures in jpg or png format. I bring this file into Corel PhotoPaint, and resample it so that it is no larger than 250×184 pixels—the space that I have allocated for the image on the TFT screen. Then I export it in bmp format, giving it the same primary filename as the impulse file that it represents (and a .bmp extension). Luckily, a routine in the Teensy library takes bmp files from an SD card and displays them on the same TFT display that I use in this project. I load these image files on the same SD card that the impulse files are stored on. These images require about 200ms to load/display.
I should mention that the Teensy Audio Adapter is currently available in two versions, Rev. C and Rev. D. Originally, the C revision module was designed to piggy-back on top of the Teensy 3.2 module; that is, the pins matched the pinout of the Teensy 3.2. The Teensy 4.0/4.1 MCU modules have a somewhat similar pinout to that of the Teensy 3.2, but the I2S pins are different. This explains the two versions of the Teensy Adapter. Rev. C matches the pinout of the Teensy 3.2, and Rev. D matches the Teensy 4.0/4.1.
I don’t mount the Teensy Audio Adapter on top of the Teensy MCU module, because it makes it too bulky vertically. Since I am hand-wiring the two modules together, I’ve kept only Rev. C modules, and use them with whatever Teensy module I am using for the project. However, if you are using a Rev. C board with the much faster Teensy 4.0/4.1, you have to place a 100Ω resistor in series with the MCLK line, as shown in the Figure 5 schematic. Table 1 shows the wiring for each of the two revisions (sourced from the PJRC Teensy website).
The last thing I’ll mention about the SGTL5000 CODEC contained on the Teensy Audio Adapter, is that it requires an I2C connection to receive its configuration commands from the MCU. You won’t see the normal pull-up resistors on the SCL and SDA lines in the schematic, since there are 2.2kΩ resistors on the Teensy Audio Adapter module, itself. Figure 7 is a photo of the circuit board, and Figure 6 shows the completed unit in its enclosure.
I have built many music/audio-related projects with various members of the Teensy MCU family of boards. Apart from the powerful MCU that can now be found on the Teensy 4.x modules, the huge number of Arduino libraries that work with these modules is a major consideration. Also, the easy-to-use Teensy Audio Library contains the most comprehensive collection of audio functions that I have found among the four MCU product lines that I routinely use.
That said, I am still amazed that it is possible to do a 22,000-point FIR filter routine in real time on an Arm MCU with a latency in the 10-15ms range. This can be attributed to the fact that the routine is performed in the frequency domain, as mentioned earlier. However, the elegant coding found in the CMSIS DSP routines, together with the high usage of DMA data transfers in the Teensy Audio Library, also contribute to this high performance.
Although I designed this unit to perform only guitar-cabinet simulations, the Teensy MCU is nowhere near fully utilized with that task. The FFT-convolution routine, which is performed for each audio block (occurring every 2.9ms), takes a bit less than 1ms to execute, so about 60% of MCU capacity is free. Using other blocks in the Teensy Audio Library, it would be possible to add effects such as tremolo, reverb, chorus or even a guitar tuner (using the notefreq block).
The firmware for this project can be found on the Circuit Cellar’s article code and files webpage. Note that I used Arduino version 1.8.13 and Teensyduino Beta 1.54. These newest versions are needed to compile the code. My uniformly partitioned convolution filter library is available with the rest of the firmware on the article code and files webpage. It must be added to the Teensy Library as described earlier in the article.
Note: We’ve made the May 2020 issue of Circuit Cellaravailable as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.
The ST7789 TFT module contains a display controller with the same name: ST7789. It’s a color display that uses SPI interface protocol and requires 3, 4 or 5 control pins, it’s low cost and easy to use. This display is an IPS display, it comes in different sizes (1.3″, 1.54″ …) but all of them should have the same resolution of 240×240 pixel, this means it has 57600 pixels. This module works with 3.3V only and it doesn’t support 5V (not 5V tolerant).
As mentioned above, the ST7789 TFT display controller works with 3.3V only (power supply and control lines). The display module is supplied with 3.3V (between VCC and GND) which comes from the Arduino board.
To connect the Arduino to the display module, I used voltage divider for each line which means there are 4 voltage dividers. Each voltage divider consists of 2.2k and 3.3k resistors, this drops the 5V into 3V which is sufficient.
The first library is a driver for the ST7789 TFT display which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “st7789” and install the one from Adafruit).
The Prototyping System for Teensy 4.1 provides a flexible setup for working with the Teensy 4.1 microcontroller, the most powerful Arduino compatible microcontroller available today.
The baseboard provides the core features required in many setups including power input handling, logic level shifting, touch screen LCD for user interface and access to common buses and interfaces such as Ethernet, USB Host, CAN bus, RS485 bus, Serial TTL, I2C, level shifted I2C, SPI, level shifted SPI, WiFi and Bluetooth.
A Fully Stuffed version that comes with everything installed and includes all the accessories needed to basically just plug and go. The ultimate in instant gratification. Just add the Teensy 4.1 of your choice from the list down below to complete a fully functioning setup.
Add your choice of Teensy 4.1 from the memory configuration options below and the system will be fully assembled with the example software preloaded. Just apply power and the system will come up and run the example code. Plug in the earbuds to hear the audio.
The Teensy 4.1 Fully Loaded for Prototyping System have all the headers installed to properly mate up with the connectors on the baseboard. VUSB trace is cut and a Schottky diode installed to properly isolate power.
If you already have a Teensy 4.1 that you want to use with this baseboard, it is fairly easy to adapt to it with nominal thru-hole soldering skills. There are instructions toward the bottom of this page.
The area next to the Teensy 4.1 is designed to provide flexibility for working with various adapters for adding functionality to the system. We offer a number of options below and it is possible to design your own.
The area next to the Teensy 4.1 is footprinted to accept 2 of the standard size Teensy adapters such as the Audio Rev D adapter for easily working with them.
Because of the power of the Teensy 4.1, it is very popular for use with audio projects because it is fast enough to synthesize music on the fly and the PJRC team provides excellent tools like the PJRC Audio System Design Tool for working with their audio module. We have a version with pins preinstalled so it will plug into the baseboard. It also comes with a microphone installed. One comes installed in the Fully Stuffed version along with a 32GB SD card preloaded with sample WAV files.
The PT8211 is a low cost 16-bit stereo Digital-to-Analog (DAC) with line level output. It is supported by the PJRC Audio System Design Tool which makes it easy to use with the Teensy 4.1. We offer a version that is fully assembled with male header pins to make it plug-n-play with the baseboard. It is also available in kit form on the product page.
The PJRC team that created Teensy also put together a very nice workshop for learning about audio processing using Teensy since Teensy has the horsepower to synthesize audio on the fly. They also created a powerful Teensy Audio Library and Audio System Design Tool.
We have created this adapter to provide the user controls for going through the workshop and have modified the original workshop and programs as needed to work with this baseboard in our Audio Tutorial and Workshop. The board is shortened to less than full width to provide clearance to also mount the Teensy 4.x Audio Adapter at the same time. Standoffs provide mechanical support.
If you have an interest in learning how to use audio with Teensy or just want to explore more of what the Teensy can do, going through the audio workshop is very informative. This board can also be used to provide a couple general purpose potentiometer and pushbutton inputs.
The same adapter area is also footprinted to accept a larger 4″ x 2.5″ adapter with access to all of the Teensy 4.1 pins available along the two edges of the PCB.
This adapter mounts a 400 tie-point high quality solderless breadboard for building temporary breadboard circuits. The female headers on either end of the breadboard provide access to all of the Teensy 4.1 pins. This allows circuits to be built, the whole baseboard assembly with solderless breadboard to be moved around and then the breadboard subassembly can be removed intact and replaced without having to reconnect anything. Great for bouncing between several projects.
We have created an adapter that makes it very easy to work with a string of addressable LEDs. Just plug in the LED strip and a 5V power source. The adapter also includes the functionality of the popular Teensy Octo2811 Adapter for larger arrays in a physical format that works better with this baseboard. This allows up to 8 channels of addressable LEDs using CAT cable
The Teensy 4.1 socket brings all I/O out from the bottom of the Teensy 4.1. The socket also has a row of male headers for easily connecting logic analyzer or O’scope probes or for jumping pins over to a solderless breadboard or making temporary connections such as patching in the high-speed logic level converters.
We offer our Teensy 4.1 Fully Loaded for Prototyping System line of Teensy 4.1 products that are configured for use with this board and similar baseboard setups that bring the I/O down from the bottom of the Teensy 4.1. They include the following changes from the standard Teensy 4.1:
A female 2×3 2mm header is mounted at the Ethernet connector location on the bottom side of the Teensy 4.1 which mates with an extended reach male header on the baseboard and connects the Teensy 4.1 to the MagJack on the baseboard.
Male 5-pin headers are mounted to the bottom side of the Teensy 4.1 to bring down the USB Host lines to connect to the on-board Host USB connector. VBat connects to a CR2032 battery holder and On/Off and Program connect to buttons on the baseboard.
By separating the VUSB and VIN power inputs and placing a Schottky diode between them, this allows the Teensy 4.1 to be powered from both the USB cable and VIN input at the same time if the VIN power source also has a diode installed. It also allows the modified Teensy 4.1 to be powered on the bench from the USB cable without being placed into a baseboard which can be handy at times.
When used with a 3rd party baseboard, it removes the need to solder a diode onto the bottom of the Teensy 4.1. When used with our Prototyping System for Teensy 4.1 baseboard, the Schottky diode on the Teensy 4.1 is in parallel with another one on the baseboard, so is redundant.
This 5V VIN power provides power to the Teensy 5V VIN input, the ESP32-S 5V input and the LCD display which all have their own built-in 3.3V regulators.
The VIN power also feeds a 3.3V regulator that powers the 3V power rail on the board to take the load off the Teensy 4.1. This arrangement also ensures that 3.3V is available no matter how the board is powered to avoid the possible issue of driving logic signals into an unpowered IC.
The Teensy 4.1 onboard 3.3V regulator output is not used on the baseboard, but the power is available on the T3V pins of the Teensy 4.1. If these pins are used, be sure not to connect the T3V pins to the 3V or other powered rail or damage could result. The same is true for the 3V3 pin of the ESP32-S.
If USB power is also connected to the Teensy 4.1 along with DC input power, the board contains the necessary Schottky diodes to separate the USB power from the VIN power as long as the VUSB/VIN trace is cut on the bottom of the Teensy 4.1 as is done on the Teensy 4.1 with offer for use with this baseboard.
The entire Teensy 4.1 footprint is brought out to the proto adapter area. The outer 24-pin female headers support connecting to all of the Teensy 4.1 I/O pins and can fit a 4.0″ x 2.5″ adapter . The inner 14-pin headers support inserting up to two of the standard PJRC 14-pin adapter boards like the popular Teensy 4.x Rev D Audio Adapter.
The only electrical differences is that the SPI Clk pin 13 and MOSI pin 11 lines to the adapter area have 56Ω series resistors to minimize signal reflections. A second set of resistors feed these same signals to the LCD. The 3V pins in the adapter area power are supplied from the baseboard 3.3V regulator and not the Teensy 4.1. 0.1uF bypass caps are connected to each of the power pins in this area.
The board supports either a 2.8″ or 3.2″ 320×240 color touchscreen LCD with the ILI9341 display controller. This is the best supported display for the Teensy 4.1 and readily available from ProtoSupplies.com and PJRC. The 3.2″ version comes with the Fully Stuffed option.
The onboard SD card slot on these displays generally don’t work without modification and the Teensy has an SD card slot, so they are not usually worth messing with. The 4 SD pin locations on the right side of the display are there for mechanical support. This allows a 4-pin male header to be soldered to the display and plugged into the female header. The two sets of female header are provided because the 3.2″ display has a slightly wider footprint than the 2.8″ display.
The Teensy 4.1 Serial1 on pins D0 and D1 connects to the ESP32-S Serial 2 on pins 28 and 27 to provide communications between the two microcontrollers.
The ESP32-S can be used as a co-processor to the Teensy 4.1 to offload all WiFi or Bluetooth work. The ESP32-S is much better suited for that type of work than the Teensy 4.1. It can also be used to offload other processing work such as to act as a dedicated sensor monitor and motor controller for instance.
The other pins on the ESP32-S are unallocated, so can be repurposed as desired. A row of adjacent male header pins is provided to make jumping over to a breadboard or the Teensy 4.1 easy, such as if you want to work with SPI instead of serial communications between the two microcontrollers.
Two jumpers allow the Teensy 4.1 Serial 1 signals on pins 1 and 0 (1-RX, 0-TX) to be disconnected from the ESP32-S if it is desired to free up pins D0 and D1 on the Teensy or if an alternate communication scheme such as SPI is being used with the ESP32.
The board has a MagJack for making wired Ethernet connections. Teensy 4.1 has all the circuitry built-in for connecting to Ethernet and the two just need to be physically connected.
Note: Due to Ethernet PHY chip shortages and price increases, some Teensy 4.1 on the market are now being built without this chip and do not have Ethernet capability. All of the Teensy 4.1 we sell for this system have the PHY chip and full Ethernet capability, but if you plan to source or have already sourced a Teensy 4.1 from somewhere else for use with this board, keep that in mind if you plan to use Ethernet.
The baseboard has a extended length 2×3 2mm spacing male header to pickup the Ethernet connections from the bottom of the Teensy 4.1 that has a mating female header installed.
There is also a 2×3 2mm male header next to the MagJack that allows a Teensy 4.1 with a male Ethernet header already installed in the normal position to connect to the MagJack using an IDC cable like is supplied with the Teensy 4.1 Ethernet kit.
The USB Host is a 2nd USB port that allows you to connect USB devices to the Teensy 4.1. It is fully independent of the main USB device port, so USB devices can communicate simultaneously with Teensy while Teensy communicates with a computer via the USB device port. The USB Host port operates at up to 480Mbit/sec. Use the
For providing power to the USB connector, there is a jumper USB 5V to select between using the standard switched USB 5V power from the Teensy 4.1 T4.1 or using the external VIN 5V unswitched power VIN which can be handy for powering higher current applications without having to resort to a powered hub.
The Teensy 4.1CAN3 bus on pins D30, D31 is connected to an SN65HVD230, 231 or 232 CAN bus transceiver. These parts are all equivalent parts in this circuit and selected based on availability.
The receive output of the transceiver on D30 has a jumper J8 that can be used to disable this input into the Teensy 4.1 if the pin is to be used for other purposes.
RS485 is a long-line serial communication bus that allows multiple devices to connect to the same serial bus over long distances of up to 1200 meters. The underlying protocol is standard TTL level RS232 but with differential transceivers used to extend to long distances and support multiple device drops. Speeds of up to 2.5Mbit/sec are possible. Handy for device control of one or more devices over longer distances or in electrically noisy environments such as industrial control.
The receive output of the transceiver on D34 has a jumper J7 which can be used to disable this input into the Teensy 4.1 if the pin is to be used for other purposes.
In addition, a 5V level shifted version of both buses is also provided using the standard MOSFET setup and 2.2K pull-up resistors that will work for most applications. 5V and ground is provided for the level shifted versions.
The SPI bus is also routed to the adapter area of the board. CLK and MOSI each have two 56 ohm series resistors with the output of one branch going to the breakout header and LCD display and the second branch going to the adapter area to minimize reflections on the bus.
Serial7 on pins D28and D29 is brought out to a 4-pin header on the back edge of the board along with with 3.3V and ground for easy hookup to a serial device.
A CR2032 coin cell batter holder is located under the LCD display. This connects to the VBat on the Teensy 4.1 for providing battery backup capability.
The On/Off button when pressed and held for 4 seconds turns off the Teensy 4.1 3.3V onboard regulator, thus shutting the Teensy down. Pressing the button again for 0.5 seconds while off will turn the 3.3V back on and reboot the processor. Note that this On/Off button has no affect on the baseboard 5V or 3.3V power. It only affects the 3.3V regulator on the Teensy module itself.
Since designing basic PCBs through quick-turn houses is fairly easy these days, this feature allows users to design and build application specific circuits without having to deal with all the details of building a complete system which can be fairly daunting. This can also be handy for designing and testing subsystems while prototyping a design before committing to a complete ground up design. The adapter footprint is simply a 3.6″ wide Teensy 4.1 pinout as shown below.
A custom PCB height greater than 2.5″ can also be used if the overhang is on the front edge of the board or can also be on the back side if the LCD is not being used.
If you already have a Teensy 4.1 that you want to use with this baseboard, it is fairly easy to adapt to it with nominal thru-hole soldering skills and a sharp knife by following the directions below.
If you ordered the Fully Stuffed version and want to verify the basic setup works before modifying your Teensy 4.1, the unmodified Teensy can be installed in the socket and connected to a USB cable to download the example software. Power for the baseboard will also come from the USB cable. The ESP32-S will already be programmed so the setup should run as soon as the Teensy 4.1 has been programmed. Please Note: It is important to not also apply power through the DC input on the baseboard until the Teensy 4.1 has been modified as follows or damage could result.
Cut the trace between the pads on the bottom of the Teensy 4.1 to isolate the USB power from VIN power. Use a sharp X-acto knife or box knife with a new blade. Angle the blade at about a 45 degree angle and press straight into the trace on one side. Don’t use a sawing motion as you are just cutting through soft copper. Move the blade to the other side of the trace and repeat the process to remove a small wedge of the trace. A magnifier definitely makes this process easier if you have access to one. A properly cut trace is shown at the bottom. If you have a ohm meter, use it to verify the cut was successful by measuring across the pads. You should not measure a dead short.
Install a female 2×3 2mm header on top of the tall 2×3 2mm male header if you Teensy does not already have a male header in that location. Push it just slightly onto the male header, so you can align the pins with holes in the Teensy 4.1 first as you install the Teensy 4.1.
Install the Teensy 4.1 into its socket making sure that the pins of the headers you just installed all line up with the holes in the Teensy 4.1 and protrude through. It doesn’t hurt to give a light tug on a couple of the 2×3 2mm female header pins to make sure it is seated firmly up against the bottom of the Teensy 4.1.
If there is a male Ethernet header already installed on the top of the Teensy 4.1, an IDC cable like provided with the Teensy 4.1 Ethernet kit can be used to mate with the male 2×3 2mm header next to the MagJack if you are planning to use that feature.
The setup described in this section illustrates the basic usage of some of the core parts of the system and provides a starting point for anyone just getting started with the Teensy 4.1 ecosystem. It assumes that at least an LCD is installed and also looks to see if an ESP32-S and Teensy 4.x Rev D Audio adapter board with SD card are also installed to enable additional functionality.
If you ordered the Fully Stuffed version along with a Teensy 4.1, it will already be loaded with this software and will run as soon as power is applied. If you ordered a Fully Stuffed version without the Teensy 4.1, you will just need to load the software into the Teensy 4.1 as everything else will be setup.
The programs are not overly clever on the programming to make them easier to follow (and because I am not overly clever at programming) and pull heavily from various sample programs. The communications between the Teensy 4.1 and ESP32-S in particular are handled in a very simplistic fashion by passing simple text strings.
Checks to see if any of the PSRAM or Flash memory chips have been installed and reports that info out the serial port. If you ordered a system with the Teensy 4.1 already installed, this also provides a way to verify that you received the correct version without having to pry the Teensy 4.1 out of its socket.
Configures the LCD display and touch screen and paints a couple of buttons on the screen. One for playing audio and one for scanning for WiFi networks.
If a scan is requested, it sends the command ‘S’ for scan to the ESP32-S and then looks for a response back with the found networks. The found networks are then listed on the LCD.
If the ESP32-S is installed and you have two USB cables, you can open two instances of the IDE with one connected to the Teensy 4.1 and one connected to the ESP32-S for downloading the programs and Serial Monitor windows can be opened on both to see what is going on. This makes it easy to make program changes to either processor and download new code without messing with cables. To open 2 separate instances of the IDE, they both need to be launched by clicking on the application icon.
Their are nine 0.138″ diameter holes which can accept up to 3.5mm or #6 screws unevenly spaced around the board. The board ships with nine M3 8mm long nylon threaded standoffs and M3 6mm screws to provide mechanical support and electrical isolation when working with it on the bench.
Anyone working with the Teensy 4.1 should checkout the PJRC forum as it has exceptional technical support provided by a talented user base including Paul Stoffregen, the creator of the Teensy product line.
*Pin 13 is the standard SCK signal, but also is hooked up to the Teensy"s on-board LED, so the board will flash its LED whenever it writes to the TeensyView. Pin 14 does not appear to support SCK on the Teensy 4.0 or 4.1
*Pin 15 is the standard RESET pin, but also the only available pin for GPT capture. The GPT isn"t even supported in Arduino/Teensyduino by default, but is there if you do lower-level register-level programming. My project needed that as the input for a GPS PPS, so I had to use the alternate pin 2, which works fine (plain GPIO).
New Defines: DYNAMIC_BLADE_DIMMING, DYNAMIC_BLADE_LENGTH, DYNAMIC_CLASH_THRESHOLD, SAVE_BLADE_DIMMING, SAVE_CLASH_THRESHOLD, INCLUDE_SSD1306, FILTER_CUTOFF_FREQUENCY, FILTER_ORDER, NO_REPEAT_RANDOM, FEMALE_TALKIE_VOICE, DISABLE_BASIC_PARSER_STYLES and ENABLE_ALL_EDIT_OPTIONS
Make a config file. Usually, this will be tweaked and re-uploaded many times, but the best way to get started is to go to the Proffieboard V2, Proffieboard or TeensySaber V3 page and use the configuration generator. Go to the config/ directory, make a copy of one of the .h files, then rename the copy to "mysaber_config.h" (or whatever you like), then open up the file in an editor (like notepad) and remove all the lines, then cut-n-paste the stuff from the config generator instead and save it.
If you have a problem, you can contact me on The Rebel Armory or the fx-sabers forum, but there is also lots of online informtation about arduinos and teensys, so some googling probably won"t hurt.
The number - When playing a sound, TeensySaber will generally pick one of them randomly. The numbers can either be on the form 1,2,3,4,5,6,7,8,9,10,11, etc. or 01, 02, 03, etc. or 001, 002, 003, etc. The number sequence must be consistent and without any gaps. It"s also possible to omit the number completely. For looping sounds, TeensySaber will randomly pick one of the numbered files each time it starts over, so it"s possible to create a more interesting hum by having "hum.wav", "hum1.waw", "hum2.wav" etc. Note that since we"re using an ancient file system, the length of the name and number must not total more than 8 characters. (So you can only have 11 poweron sounds: poweron.wav, poweron0.wav, poweron1.wav....poweron9.wav)
4.9 - Font search paths, IR, SPI LED, Layers, presets.ini cleanup on programming, lightning block, melt, responsive styles, lots of new styles and effects.
5.9 - MICOM, initial Teensy4 support, RFID, I2S, S/PDIF, WS2811 speedups, FromHumFileStyle, EffectSeqence, CircularSectionF, MarbleF, SliceF, Saw, PullDownButton, SubBladeWIthStride
{"id":4795785936967,"title":"AC 260V 100A Digital LCD Panel Volt AMP Meter Power Energy Ammeter Voltmeter","handle":"ac-260v-100a-digital-lcd-panel-volt-amp-meter-power-energy-ammeter-voltmeter","description":"\u003cspan lang=\"en\"\u003e\u003cspan lang=\"en\"\u003e\u003cspan title=\"Description\nA Function\n1. Electrical parameter measurement function (voltage, current, active power, energy)\n2. Overload alarm function (over power alarm threshold, backlight and power flashing to alarm).\n3. Power alarm threshold preset function (can set power alarm threshold).\n4. Reset energy function.\n5. Store data when power off.\n6. STN whole viewing angleLCD (display voltage, current, active power\/energy at the same time)\n7. Backlight function.\nB. Appearance and Key function\nI. Display Interface\nThe large-screen STN whole viewing angle LCD can display voltage, current, power, energy at the same time.(note: power and energy display can be switched by the key.)\nII.Display format\n\n1.Power: test range: 0~22kW\nwithin 1KW, the display format is 0.0~999.9W;\n1KW and above, the display format is 1000~9999W;\n10kw and above, the display format is 10.0~22.0kW\n2.Energy: test range: 0~9999kWh\nWithin 10KWh, the display format is 0~9999Wh;\n10kWh and above, the display format is 10~9999kWh;\nOver 9999kwh will return 0\n3. Voltage: test range: 80~260V\nDisplay format: 80~260V\n4. Current: test range: 0~100A\nDisplay format: 0.00~99.99A\nIII. Key\n1. Backlight control\nShort press the key to turn on or off the backlight, the backlight has memory function, it can store the on or off state when power off.\n2. Reset energy\nStep1: Long press the key at least3 seconds until the number in energy display area flash, then release the key.\nStep2: If short press the key again, then the energy value is cleared and exit the reset state.If short press the key again, then the energy value will not be cleared and will exit the reset state. If there is no operation on the key within 10 seconds, the energy value will not be cleared and will exit the reset state.\n3. Set power alarm threshold\nStep1: Long press the key at least 3 seconds until the number in power display area flash,then release the key\nStep2: Powerarea display the current power alarm value and the last digit begin to flash, then you can short press the key to plus 1, short press the key can switch the digit which you want to set. The threshold can’t be over 25kw( note: the default value is 25kw)\n\nStep3: After finish the setting, long press the key over 3 seconds or there is no operation over 10 seconds, it will store data automatically and exit the set state.\n4. Power\/Energy switch\nYou can short press the key to switch display the power\/ energy, the display state will be store when power off.\nC. Precautions\n1. This module is suitable for indoor, please do not use outdoor.\n2. Applied load should not exceed the rated power.\n3. Wiring order can’t be wrong.\nD. Specification parameters\n1. Working voltage: 80 ~ 260VAC\n2. Test voltage: 80 ~ 260VAC\n3. Rated power: 22kW\n4. Operating frequency: 45-65Hz\n5. Measurement accuracy: 1.0 grade \n\nPackage Included:\n1PC*\"\u003e\u003cstrong\u003eDescription\u003c\/strong\u003e\u003cbr\u003e\u003cstrong\u003eA Function\u003c\/strong\u003e\u003cbr\u003e\u003c\/span\u003e\u003c\/span\u003e\u003c\/span\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cspan id=\"result_box\" lang=\"en\"\u003e\u003cspan title=\"Description\nA Function\n1. Electrical parameter measurement function (voltage, current, active power, energy)\n2. Overload alarm function (over power alarm threshold, backlight and power flashing to alarm).\n3. Power alarm threshold preset function (can set power alarm threshold).\n4. Reset energy function.\n5. Store data when power off.\n6. STN whole viewing angleLCD (display voltage, current, active power\/energy at the same time)\n7. Backlight function.\nB. Appearance and Key function\nI. Display Interface\nThe large-scr