2026 remote: build for the Teensy 4.0 actually in the remote
Board teensy41 -> teensy40. All pins exist on the 4.0; the MPU6050's Wire2 (SDA2 25 / SCL2 24) is on the underside solder pads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
769d72462d
commit
e23216b3a1
7 files changed
+20
-18
No files matched your search
@@ -10,7 +10,7 @@ before changing anything.
|
|||||||
|
|
||||||
```
|
```
|
||||||
robot/ Teensy 3.6 firmware (PlatformIO env robot)
|
robot/ Teensy 3.6 firmware (PlatformIO env robot)
|
||||||
remote/ Teensy 4.1 firmware (PlatformIO env remote)
|
remote/ Teensy 4.0 firmware (PlatformIO env remote)
|
||||||
shared/HexapodProtocol/ wire protocol, used by robot, remote and sim
|
shared/HexapodProtocol/ wire protocol, used by robot, remote and sim
|
||||||
sim/ robot firmware -> hexapod_sim.dll (CMake + g++), headless smoke test
|
sim/ robot firmware -> hexapod_sim.dll (CMake + g++), headless smoke test
|
||||||
Hexapod_Simulation_Unity/ Unity 6000.6 project that loads the DLL (Assets/HexapodSim/)
|
Hexapod_Simulation_Unity/ Unity 6000.6 project that loads the DLL (Assets/HexapodSim/)
|
||||||
@@ -34,7 +34,7 @@ PlatformIO, one `platformio.ini`, two environments:
|
|||||||
| Env | Board | Sketch dir | Purpose |
|
| Env | Board | Sketch dir | Purpose |
|
||||||
|-----|-------|------------|---------|
|
|-----|-------|------------|---------|
|
||||||
| `robot` | `teensy36` | `robot/` | walking robot |
|
| `robot` | `teensy36` | `robot/` | walking robot |
|
||||||
| `remote` | `teensy41` | `remote/` | handheld transmitter |
|
| `remote` | `teensy40` | `remote/` | handheld transmitter |
|
||||||
|
|
||||||
- `shared/` is PlatformIO's `lib_dir`. `shared/HexapodProtocol/` is a
|
- `shared/` is PlatformIO's `lib_dir`. `shared/HexapodProtocol/` is a
|
||||||
header-only library both sketches `#include <HexapodProtocol.h>`.
|
header-only library both sketches `#include <HexapodProtocol.h>`.
|
||||||
@@ -108,7 +108,7 @@ joint-rate clamp → servos.
|
|||||||
| `Comms` | nRF24 RX, link timeout, `injectPacket()` for the harness |
|
| `Comms` | nRF24 RX, link timeout, `injectPacket()` for the harness |
|
||||||
| `ServoDriver` | 18 servos on hardware PWM (50 Hz, 16-bit), per-servo calibration from `Config.h` `SERVOS`, duty 0 = relaxed, skips invalid IK solutions |
|
| `ServoDriver` | 18 servos on hardware PWM (50 Hz, 16-bit), per-servo calibration from `Config.h` `SERVOS`, duty 0 = relaxed, skips invalid IK solutions |
|
||||||
|
|
||||||
## Remote architecture (`remote/`, Teensy 4.1)
|
## Remote architecture (`remote/`, Teensy 4.0)
|
||||||
|
|
||||||
Loop: drain Nextion + USB serial input every pass. On each `TX_HZ` (100)
|
Loop: drain Nextion + USB serial input every pass. On each `TX_HZ` (100)
|
||||||
tick: sticks → IMU → radio link status → RemoteState (smoothers,
|
tick: sticks → IMU → radio link status → RemoteState (smoothers,
|
||||||
@@ -366,7 +366,7 @@ Robot (`robot/README.md` has detail):
|
|||||||
Remote (`remote/README.md` has detail):
|
Remote (`remote/README.md` has detail):
|
||||||
- Pins in `remote/Config.h`, taken from the old remote sketch: radio CE 9 /
|
- Pins in `remote/Config.h`, taken from the old remote sketch: radio CE 9 /
|
||||||
CSN 10, sticks A0–A5, Nextion on Serial1 (0/1). The MPU6050 is on
|
CSN 10, sticks A0–A5, Nextion on Serial1 (0/1). The MPU6050 is on
|
||||||
**Wire2 (25/24)**, since A4/A5 = Wire's SDA/SCL are stick pins; that's
|
**Wire2 (25/24, solder pads under the Teensy 4.0)**, since A4/A5 = Wire's SDA/SCL are stick pins; that's
|
||||||
the owner's choice and needs rewiring the MPU. Which stick axis is on
|
the owner's choice and needs rewiring the MPU. Which stick axis is on
|
||||||
which pin is still unknown.
|
which pin is still unknown.
|
||||||
- `STICK_INVERT[]`, calibration defaults, deadzones, expo.
|
- `STICK_INVERT[]`, calibration defaults, deadzones, expo.
|
||||||
@@ -393,7 +393,7 @@ Remote (`remote/README.md` has detail):
|
|||||||
- `b2` → **Nextion upload passthrough**: shows `uploadscreen`, then
|
- `b2` → **Nextion upload passthrough**: shows `uploadscreen`, then
|
||||||
bridges USB ↔ Serial1 forever, so Nextion Editor can upload a `.tft`
|
bridges USB ↔ Serial1 forever, so Nextion Editor can upload a `.tft`
|
||||||
through the remote's USB port. The new firmware keeps this.
|
through the remote's USB port. The new firmware keeps this.
|
||||||
- Sticks on **A0–A5**, contiguous (`analogInPin + i`). On the Teensy 4.1,
|
- Sticks on **A0–A5**, contiguous (`analogInPin + i`). On the Teensy 4.0,
|
||||||
A4/A5 are pins 18/19 = Wire SDA/SCL, which the MPU6050 needs. The old
|
A4/A5 are pins 18/19 = Wire SDA/SCL, which the MPU6050 needs. The old
|
||||||
code had the MPU code disabled (`if (false)`). Owner's decision: keep
|
code had the MPU code disabled (`if (false)`). Owner's decision: keep
|
||||||
the sticks, move the MPU to Wire2.
|
the sticks, move the MPU to Wire2.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Hexapod
|
# Hexapod
|
||||||
|
|
||||||
A six-legged walking robot (Teensy 3.6) and its handheld remote
|
A six-legged walking robot (Teensy 3.6) and its handheld remote
|
||||||
(Teensy 4.1 + Nextion touchscreen), linked over nRF24L01.
|
(Teensy 4.0 + Nextion touchscreen), linked over nRF24L01.
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|||||||
@@ -129,8 +129,8 @@ Also from the owner: the bump on top of the middle post is a lanyard loop
|
|||||||
(the original's tunnel through it is modelled); the square hole is the on/off
|
(the original's tunnel through it is modelled); the square hole is the on/off
|
||||||
slide switch, mounted on top (same switch as the robot). Inside: an IMU on the
|
slide switch, mounted on top (same switch as the robot). Inside: an IMU on the
|
||||||
21 x 9 mm block (assumed GY-521), a USB-C breakout on the side-port block, and
|
21 x 9 mm block (assumed GY-521), a USB-C breakout on the side-port block, and
|
||||||
a Teensy **4.0** (confirmed by the owner, although `platformio.ini` builds
|
a Teensy **4.0** (confirmed by the owner; `platformio.ini` now builds
|
||||||
the remote for a 4.1); it has no mounting holes and is placed on the
|
the remote for it); it has no mounting holes and is placed on the
|
||||||
hole-less 8 x 24 mm block as a guess.
|
hole-less 8 x 24 mm block as a guess.
|
||||||
Open: what the 6 mm x 10 mm holes in the bottom bosses hold (magnets?), and
|
Open: what the 6 mm x 10 mm holes in the bottom bosses hold (magnets?), and
|
||||||
whether the upper two bosses are meant to be asymmetric (x -80.387 / +82.73).
|
whether the upper two bosses are meant to be asymmetric (x -80.387 / +82.73).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
; Hexapod: two firmware images in one project.
|
; Hexapod: two firmware images in one project.
|
||||||
; pio run -e robot build robot/ (Teensy 3.6)
|
; pio run -e robot build robot/ (Teensy 3.6)
|
||||||
; pio run -e remote build remote/ (Teensy 4.1)
|
; pio run -e remote build remote/ (Teensy 4.0)
|
||||||
; pio run -e robot -t upload flash (Teensy Loader / teensy_cli)
|
; pio run -e robot -t upload flash (Teensy Loader / teensy_cli)
|
||||||
; pio device monitor -e robot serial monitor at 115200
|
; pio device monitor -e robot serial monitor at 115200
|
||||||
;
|
;
|
||||||
@@ -25,5 +25,5 @@ board = teensy36
|
|||||||
custom_src_dir = robot
|
custom_src_dir = robot
|
||||||
|
|
||||||
[env:remote]
|
[env:remote]
|
||||||
board = teensy41
|
board = teensy40
|
||||||
custom_src_dir = remote
|
custom_src_dir = remote
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
// =====================================================================
|
// =====================================================================
|
||||||
// Remote handset config (Teensy 4.1). Everything here is a placeholder
|
// Remote handset config (Teensy 4.0). Everything here is a placeholder
|
||||||
// until checked against your real wiring and parts - see the BENCH notes.
|
// until checked against your real wiring and parts - see the BENCH notes.
|
||||||
// Radio address/channel/rate/PA/payload size are NOT here: they live in
|
// Radio address/channel/rate/PA/payload size are NOT here: they live in
|
||||||
// shared/HexapodProtocol so they can't drift from the robot.
|
// shared/HexapodProtocol so they can't drift from the robot.
|
||||||
@@ -69,8 +69,10 @@ constexpr float STICK_EXPO[NUM_AXES] = { 0.25f, 0.25f, 0.30f, 0.20f, 0.20f,
|
|||||||
// One-pole low-pass on raw ADC counts (1 = no filtering). Pots are noisy.
|
// One-pole low-pass on raw ADC counts (1 = no filtering). Pots are noisy.
|
||||||
constexpr float STICK_FILTER_ALPHA = 0.5f;
|
constexpr float STICK_FILTER_ALPHA = 0.5f;
|
||||||
|
|
||||||
// ---- Remote IMU: MPU6050 on the second I2C bus (Wire2: SDA2 = 25, SCL2 = 24) ----
|
// ---- Remote IMU: MPU6050 on the third I2C bus (Wire2: SDA2 = 25, SCL2 = 24) ----
|
||||||
// Not Wire (18/19): those pins are stick axes A4/A5.
|
// On the Teensy 4.0, 24/25 are solder pads on the underside, not edge pins.
|
||||||
|
// Not Wire (18/19): those pins are stick axes A4/A5. Not Wire1 (17/16) either:
|
||||||
|
// those are stick axes A3/A2.
|
||||||
#define IMU_WIRE Wire2
|
#define IMU_WIRE Wire2
|
||||||
constexpr uint8_t IMU_ADDR = 0x68; // 0x69 if AD0 is pulled high
|
constexpr uint8_t IMU_ADDR = 0x68; // 0x69 if AD0 is pulled high
|
||||||
// Mounting remap: which chip axis (0=X,1=Y,2=Z) and sign gives each handset
|
// Mounting remap: which chip axis (0=X,1=Y,2=Z) and sign gives each handset
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Hexapod remote firmware (Teensy 4.1)
|
# Hexapod remote firmware (Teensy 4.0)
|
||||||
|
|
||||||
Handheld transmitter for the hexapod. It reads two 3-axis twist-grip
|
Handheld transmitter for the hexapod. It reads two 3-axis twist-grip
|
||||||
joysticks and an MPU6050, takes operator commands from a Nextion
|
joysticks and an MPU6050, takes operator commands from a Nextion
|
||||||
@@ -13,17 +13,17 @@ From the `2026-current` folder: `pio run -e remote`, flash with
|
|||||||
|
|
||||||
## Wiring (from the old remote sketch in `../../2019-teensy-nrf24/remote/`; edit `Config.h` if yours differs)
|
## Wiring (from the old remote sketch in `../../2019-teensy-nrf24/remote/`; edit `Config.h` if yours differs)
|
||||||
|
|
||||||
| Part | Signal | Teensy 4.1 pin |
|
| Part | Signal | Teensy 4.0 pin |
|
||||||
|------|--------|----------------|
|
|------|--------|----------------|
|
||||||
| nRF24L01 | MOSI / MISO / SCK | 11 / 12 / 13 (SPI0) |
|
| nRF24L01 | MOSI / MISO / SCK | 11 / 12 / 13 (SPI0) |
|
||||||
| nRF24L01 | CE / CSN | 9 / 10 |
|
| nRF24L01 | CE / CSN | 9 / 10 |
|
||||||
| nRF24L01 | VCC | 3.3 V, with a 10–100 µF cap right at the module |
|
| nRF24L01 | VCC | 3.3 V, with a 10–100 µF cap right at the module |
|
||||||
| MPU6050 | SDA / SCL | **25 / 24 (Wire2)**: not 18/19, those are stick pins A4/A5 |
|
| MPU6050 | SDA / SCL | **25 / 24 (Wire2)**, solder pads on the underside of the 4.0: not 18/19, those are stick pins A4/A5 |
|
||||||
| Nextion | TX → RX1, RX ← TX1 | 0 / 1 (Serial1), 5 V supply |
|
| Nextion | TX → RX1, RX ← TX1 | 0 / 1 (Serial1), 5 V supply |
|
||||||
| Sticks | 6 axes | A0–A5. Which axis is on which pin isn't known yet: reorder `STICK_PINS` until the `p` dump reads right |
|
| Sticks | 6 axes | A0–A5. Which axis is on which pin isn't known yet: reorder `STICK_PINS` until the `p` dump reads right |
|
||||||
|
|
||||||
**MPU6050 rewiring:** the old remote had its MPU code switched off, probably
|
**MPU6050 rewiring:** the old remote had its MPU code switched off, probably
|
||||||
because A4/A5 double as Wire's pins. Move the MPU's SDA/SCL to pins 25/24.
|
because A4/A5 double as Wire's pins. Move the MPU's SDA/SCL to pins 25/24 (the pads under the board).
|
||||||
|
|
||||||
Stick pots are wired 3.3 V – wiper – GND. **Never feed 5 V into a Teensy
|
Stick pots are wired 3.3 V – wiper – GND. **Never feed 5 V into a Teensy
|
||||||
4.x analog pin.**
|
4.x analog pin.**
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "NextionUI.h"
|
#include "NextionUI.h"
|
||||||
#include "SerialConsole.h"
|
#include "SerialConsole.h"
|
||||||
|
|
||||||
// Hexapod remote (Teensy 4.1): reads two 3-axis sticks and the handset
|
// Hexapod remote (Teensy 4.0): reads two 3-axis sticks and the handset
|
||||||
// MPU6050, takes operator commands from the Nextion touchscreen (and the USB
|
// MPU6050, takes operator commands from the Nextion touchscreen (and the USB
|
||||||
// serial console), and transmits a CmdPacket to the robot at TX_HZ.
|
// serial console), and transmits a CmdPacket to the robot at TX_HZ.
|
||||||
// See README.md for wiring, calibration and the serial key map.
|
// See README.md for wiring, calibration and the serial key map.
|
||||||
|
|||||||
Reference in new issue
Block a user