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
- Implement Bluetooth HID communication so that the ESP32-S3 can act as a wireless input device.
- Integrate motor control with force feedback to improve user interaction.
- Test and refine the Bluetooth HID response time and stability.
- 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
- ESP32-S3 registers as a Bluetooth keyboard.
- Knob rotation is mapped to arrow keys (for scrolling).
- 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
š 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.
- Uses FOC (Field-Oriented Control) for smooth motor feedback.
- Adjusts torque dynamically to provide different levels of resistance.
- Prevents unnecessary jitter and sudden torque changes.
š¹ 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.
š„ Challenges & Team Collaboration
Issue | Solution | |
---|---|---|
Bluetooth connection dropped frequently | Adjusted BLE power settings & optimized pairing process | |
HID input lag | Tweaked BLE polling rate and input event timing | |
Motor response was inconsistent | Tested FOC implementation | |
Housing was unstable | Added 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
Post a Comment