Week 2 - Bluetooth Connection, HID Control & Motor Optimization & 3D Printed Housing

Week 2 - Bluetooth Connection, HID Control & Motor Optimization & 3D Printed Housing

šŸ“… Date: 2025-02-09 – 2025-02-15
šŸ·️ Tags: Year 2 Project, ESP32-S3, Smart Knob, HID, Bluetooth, FOC


šŸŽÆ This Week's Goals

  1. Implement Bluetooth HID communication so that the ESP32-S3 can act as a wireless input device.
  2. Integrate motor control with force feedback to improve user interaction.
  3. Test and refine the Bluetooth HID response time and stability.
  4. Design a suitable 3D knob housing

šŸ”¹ 1️⃣ Bluetooth HID Integration

To enable wireless control, we implemented Bluetooth HID (Human Interface Device) on the ESP32-S3, allowing the knob to function as a mouse, keyboard, and Surface Dial alternative.

šŸ“Œ Key Features Implemented

✅ Rotational input for scrolling (mapped to arrow keys or volume control).
✅ Short press for click-like actions (e.g., Enter, Ctrl + Z).
✅ Long press and hold for function switching (e.g., toggle between scrolling & zooming).
✅ Bluetooth auto-reconnect support for seamless operation.

šŸ“Œ Code Implementation - BLE HID Setup

The following code initializes ESP32-S3 as a Bluetooth HID keyboard and sends keypress events based on knob rotation.

šŸ“Œ How This Works

  1. ESP32-S3 registers as a Bluetooth keyboard.
  2. Knob rotation is mapped to arrow keys (for scrolling).
  3. Knob press sends a key command (e.g., Ctrl, Enter).

✅ This allows the knob to function as a wireless input device for various applications.



šŸ”¹ 2️⃣ Motor Control Optimization

To provide force feedback and improve rotation feel, we integrated Field-Oriented Control (FOC) for smoother motor control.

šŸ“Œ Challenges Faced

Initial motor response was inconsistent, leading to jitter.
❌ Resistance wasn't dynamically adjusted based on rotation speed.
❌ Torque control needed real-time feedback adjustments.

šŸ“Œ Code Implementation - FOC Motor Control

We used the SimpleFOC library to control the motor’s torque and improve force feedback.


šŸ“Œ How This Works
  1. Uses FOC (Field-Oriented Control) for smooth motor feedback.
  2. Adjusts torque dynamically to provide different levels of resistance.
  3. Prevents unnecessary jitter and sudden torque changes.
✅ This ensures a more natural rotational feel for the knob.

šŸ”¹ 3️⃣ Designing a 3D-Printed Housing

šŸ“Œ Issues with the Initial Design

We identified several problems with our initial 3D-printed design:

  • Insufficient support structure, leading to flexing under pressure.
  • Motor misalignment, causing uneven rotation.
  • Loose fit between components, leading to vibrations.

šŸ“Œ Improvements & New Design Features

Reinforced internal structure to prevent bending.
Added motor mounting points for better alignment.
Redesigned PCB mounting slots for secure connections.
Integrated cable management system to reduce wire clutter.

šŸ“Œ 3D Printing & Testing

  • Printed the new housing using PLA material for initial testing.
  • Checked component alignment and made small adjustments.
  • Tested real-world usability and ergonomics.


First version of 3D printing kit


Several test 3D printed bases (the bottom one worked best)


šŸ”„ Challenges & Team Collaboration

IssueSolution
Bluetooth connection dropped frequentlyAdjusted BLE power settings & optimized pairing process
HID input lagTweaked BLE polling rate and input event timing
Motor response was inconsistentTested FOC implementation
Housing was unstableAdded reinforcements & improved design fit

Through effective teamwork, we quickly resolved issues, improved design efficiency, and optimized motor control.


šŸ“Œ Next Week's Plan

  • Enhance HID control: Add gesture-based inputs & configurable modes.
  • Improve FOC performance: Further optimize motor torque & speed control.

Comments

Popular posts from this blog

Week 4 - Final Debugging & System Integration

Week 1 - Hardware Assembly & Connections