Auto-detect frame orientation via accelerometer #8

Open
opened 2026-03-27 21:32:12 +00:00 by antialias · 0 comments
Owner

Currently the frame orientation (landscape / portrait_cw / portrait_ccw) is set manually via the web UI. It would be nice if the ESP32 could auto-detect its physical orientation and report it to the server.

Approach:

  • Add a small accelerometer breakout (LIS3DH, MPU6050, or ADXL345) to the ESP32
  • Read gravity vector at boot before fetching a photo
  • Map to landscape/portrait_cw/portrait_ccw based on which axis has the dominant gravity component
  • Report orientation in the heartbeat POST
  • Server auto-updates frame_settings.orientation if it changed

Hardware options:

  • LIS3DH — tiny, I2C, low power, ~$3. Best fit since we only need gravity direction.
  • MPU6050 — common, cheap, but overkill (has gyro too)
  • Could also use the ESP32-S3's built-in touch pins as a poor man's tilt sensor (two pins, two metal contacts at 90°) but that's hacky

Alternative: Skip the accelerometer and just auto-detect from the EXIF orientation of uploaded photos. But that doesn't help when the physical frame gets rotated.

Low priority — manual setting works fine for now.

Currently the frame orientation (landscape / portrait_cw / portrait_ccw) is set manually via the web UI. It would be nice if the ESP32 could auto-detect its physical orientation and report it to the server. **Approach:** - Add a small accelerometer breakout (LIS3DH, MPU6050, or ADXL345) to the ESP32 - Read gravity vector at boot before fetching a photo - Map to landscape/portrait_cw/portrait_ccw based on which axis has the dominant gravity component - Report orientation in the heartbeat POST - Server auto-updates `frame_settings.orientation` if it changed **Hardware options:** - LIS3DH — tiny, I2C, low power, ~$3. Best fit since we only need gravity direction. - MPU6050 — common, cheap, but overkill (has gyro too) - Could also use the ESP32-S3's built-in touch pins as a poor man's tilt sensor (two pins, two metal contacts at 90°) but that's hacky **Alternative:** Skip the accelerometer and just auto-detect from the EXIF orientation of uploaded photos. But that doesn't help when the physical frame gets rotated. Low priority — manual setting works fine for now.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: antialias/eink-photo-frame#8