A comprehensive web-based pin configuration tool for the Teensy 4.1 microcontroller with EEPROM persistence and real-time control.
- Web-Based Interface: Modern, responsive web UI accessible via Ethernet
- Real-Time Pin Control: Configure and monitor all 42 GPIO pins in real-time
- EEPROM Persistence: Pin configurations automatically saved and restored on power-up
- Multiple Pin Modes: Support for INPUT, OUTPUT, PWM, ANALOG_IN, and protocol modes
- Live Pin Monitoring: Real-time display of pin states and analog values
- Digital I/O: INPUT, OUTPUT, INPUT_PULLUP, INPUT_PULLDOWN
- Analog: ANALOG_IN (ADC), PWM output (0-255)
- Serial/UART: RX1-RX8, TX1-TX8 (8 hardware serial ports)
- I2C: SDA0-SDA2, SCL0-SCL2 (3 I2C buses)
- SPI: MOSI, MISO, SCK, CS (2 SPI buses)
- CAN: CTX1-CTX3, CRX1-CRX3 (3 CAN buses)
- Visual Pin Layout: Interactive board representation matching physical pinout
- Glassmorphism Design: Modern, premium UI with smooth animations
- Auto-Refresh: Optional 10-second auto-refresh for live monitoring
- Scroll Position Memory: Maintains scroll position across page refreshes
- Arduino Code Export: Generate setup code from current configuration
- Network: IP address, MAC address, link status
- Hardware: Board type, processor, CPU speed, temperature
- Memory: Flash, RAM, EEPROM specifications
- Uptime: System runtime tracking
- Peripheral Status: SD Card, QSPI Memory, Ethernet, USB Host/Device
- Teensy 4.1 microcontroller
- Ethernet connection (built-in Ethernet PHY)
- Power supply (USB or external 5V)
The interface automatically detects and displays available modes for each pin based on Teensy 4.1 specifications:
| Pin Range | Capabilities |
|---|---|
| 0-1 | Serial1 (RX1/TX1), CAN2, Touch |
| 2-9 | Digital I/O, PWM, Serial2 |
| 10-13 | SPI (MOSI, MISO, SCK, CS), PWM |
| 14-23 | Analog (A0-A9), Serial3-5, I2C, PWM |
| 24-27 | Analog (A10-A13), Serial6, I2C2, SPI1 |
| 28-32 | Serial7, PWM, CAN3 |
| 33-37 | Digital I/O, PWM, SD Card |
| 38-41 | Analog (A14-A17), SPI1 |
# Install Teensyduino add-on from:
# https://www.pjrc.com/teensy/td_download.html- NativeEthernet (included with Teensyduino)
- SPI (Arduino built-in)
- EEPROM (Arduino built-in)
- Open
teensy41-PinConfiguration.inoin Arduino IDE - Select Tools > Board > Teensy 4.1
- Select Tools > USB Type > Serial
- Click Upload
- Connect Ethernet: Plug Ethernet cable into Teensy 4.1
- Power On: Connect USB or external power
- Find IP Address: Check Serial Monitor (115200 baud) for assigned DHCP IP
- Access Web Interface: Open browser and navigate to the IP address
- Select Mode: Click mode buttons (IN, OUT, PWM, AIN, etc.)
- Set Output Value:
- Digital: Click "SET HIGH" or "SET LOW"
- PWM: Drag slider (0-255, displays as percentage)
- Monitor Input: View real-time values for INPUT and ANALOG_IN modes
- Auto-Refresh Toggle: Enable/disable automatic page refresh
- Arduino Code Export: Copy generated setup code for standalone use
- Scroll Memory: Page remembers scroll position during navigation
Pin configurations are automatically saved to EEPROM when changed and restored on power-up:
// Magic number verification: 0xAA55
// Storage: 4 bytes per pin (mode + value_high + value_low + reserved)
// Total: 2 bytes (magic) + 168 bytes (42 pins × 4)- DHCP: Enabled by default
- MAC Address:
DE:AD:BE:EF:FE:ED - HTTP Port: 80
To use a static IP, modify the setup() function:
// Replace:
Ethernet.begin(mac);
// With:
IPAddress ip(192, 168, 1, 100);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
Ethernet.begin(mac, ip, gateway, subnet);Returns the main web interface
Configure a pin
pin: Pin number (0-41)mode: Pin mode (INPUT, OUTPUT, PWM, ANALOG_IN, etc.)value: Pin value (HIGH/LOW for digital, 0-255 for PWM)
Example:
/config?pin=13&mode=OUTPUT&value=HIGH
/config?pin=3&mode=PWM&value=128
Toggle auto-refresh on/off
- EEPROM: 170 bytes (2 magic + 168 pin data)
- Flash: ~60KB (code + HTML)
- RAM: ~15KB (runtime)
- Web Response Time: <100ms typical
- Client Timeout: 500ms (prevents blocking)
- Update Rate: 2-second stats refresh
- Auto-Refresh: 10 seconds (when enabled)
0 = INPUT
1 = INPUT_PULLUP
2 = INPUT_PULLDOWN
3 = OUTPUT
4 = PWM
5 = ANALOG_IN
6 = SERIAL_RX
7 = SERIAL_TX
8 = I2C_SDA
9 = I2C_SCL
10 = SPI_MOSI
11 = SPI_MISO
12 = SPI_SCK
13 = SPI_CS
14 = CAN_TX
15 = CAN_RX- Check Ethernet cable connection
- Verify DHCP server is available
- Check Serial Monitor for IP address
- Try ping to verify network connectivity
- Verify pin supports requested mode
- Check for hardware conflicts (e.g., SPI pins if using SD card)
- Ensure pin is not used by system (Ethernet uses pins internally)
- Check Serial Monitor for EEPROM write confirmations
- Verify magic number is written (0xAA55)
- Try manual save: modify any pin to trigger EEPROM write
- Check Auto-Refresh toggle status
- Clear browser cache
- Verify network stability
- Scroll to "Arduino Code Export" section
- Click textarea to select all code
- Copy (Ctrl+C) and paste into your sketch
- Call
applyPinConfiguration()insetup()
The web server runs in loop() and uses non-blocking code. Safe to integrate with:
- Sensor reading
- Motor control
- Communication protocols
- Real-time tasks
Important: Keep loop() code fast (<10ms) to maintain web responsiveness.
Contributions are welcome! Please feel free to submit pull requests or open issues for:
- Bug fixes
- Feature enhancements
- Documentation improvements
- UI/UX refinements
This project is open source and available under the MIT License.
- Hardware: PJRC Teensy 4.1
- Libraries: NativeEthernet, Arduino Core
- UI Design: Modern glassmorphism with gradient backgrounds
- Initial release
- Full pin configuration support
- EEPROM persistence
- Modern web interface
- Real-time monitoring
- Arduino code export
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check Teensy Forum: https://forum.pjrc.com/
- Teensy 4.1 Documentation: https://www.pjrc.com/teensy/
Made with ❤️ for the Teensy community
