This repository is focused on the development of a robot head and neck assembly, controlled by an ESP32 DevKit V1. The assembly is designed to allow for precise movements in multiple axes, enabling the robot head to simulate human-like motions. The system is controlled via Bluetooth, allowing for wireless operation.
- Six Degrees of Freedom: The robot head and neck assembly can move in six different axes, providing a wide range of motion.
- Bluetooth Control: Movement commands can be sent wirelessly via Bluetooth, enabling remote control of the robot head.
- Precise Movement: Utilizes the FastAccelStepper library for smooth and precise stepper motor control.
- Adjustable Speed and Acceleration: Movement speed and acceleration can be adjusted dynamically through commands.
- Multiple Input Options: Accepts commands via both Bluetooth and USB Serial, providing flexibility in control methods.
- ESP32 DevKit V1
- Six A4988 Stepper Motor Drivers
- Six NEMA 17 Stepper Motors
- Leadscrews and Mechanical Assembly for the Robot Head and Neck
- Power Supply for the Motors and ESP32
- Bluetooth Module (if not integrated into the ESP32 DevKit V1)
- PlatformIO for ESP32 development
- FastAccelStepper library for stepper motor control
- Hardware Setup:
- Connect each stepper motor to an A4988 driver according to the pin map below.
Motor Number | Step Pin | Direction Pin |
---|---|---|
Motor 1 | 33 | 32 |
Motor 2 | 18 | 26 |
Motor 3 | 23 | 14 |
Motor 4 | 19 | 27 |
Motor 5 | 22 | 12 |
Motor 6 | 21 | 13 |
- Pin 25 is optional for software based enable, however I tie all enable pins to ground to enable permanently.
- Connect the step and direction pins of each A4988 driver to the corresponding pins on the ESP32.
- Ensure the power supply is adequately rated for the stepper motors and the ESP32, 12-24v is safe.
- If you want to modify your maxmimum current for the steppers, please use this guide!
-
Software Setup:
- Open this folder in VSCode
- Install PlatformIO and set up a new project for the ESP32 DevKit V1.
- Add the FastAccelStepper library to the project dependencies.
- Upload the provided script to the ESP32.
-
Bluetooth Configuration:
- Pair the ESP32 with your Bluetooth control device.
- Use the device name "NECK_BT" for connecting.
- Send commands with the script in the py folder called neck_con.py
- Import move(x,y) methods into parallel scripts, such as Supervision.
- Modify the values on line 45 through 53 to reflect your imager resolution.
- Add your own control schemes from and additional functions to neck_con.py and access them for your application.
Send movement commands to the ESP32 via Bluetooth or USB Serial in the following format:
- Direct Control:
1:100,2:200,3:-150,...
where the number before the colon represents the motor number (1-6) and the number after the colon represents the target position in millimeters. - Angle and Height Control:
X10,Y-5,Z15,H30,S1.5,A2,R10,P-5
whereX
,Y
, andZ
are the angles and planes for yaw or radial rotation, lateral, and ventral/dorsal translation respectively,H
is the height offset,S
is the speed multiplier,A
is the acceleration multiplier,R
is the roll angle, andP
is the pitch angle. - Default Values: The speed variable (speedVar) is set to 48000 hz, and acceleration value (accVar) is set to 36000. Refer to FastAccelStepper library for more details on where those variables are passed.
- Ensure that the mechanical limits of the robot head and neck assembly are not exceeded to avoid damage.
- The speed and acceleration values should be set carefully to prevent excessive wear on the mechanical components.
- Implement feedback mechanisms such as encoders or limit switches for more precise control.
- Develop a user-friendly interface for controlling the robot head and neck assembly.
- Integrate sensors for autonomous movement and interaction.
This project is open-source and available under the MIT License.
- Thanks to the developers of the FastAccelStepper library for providing an efficient way to control stepper motors with the ESP32.
- Gratitude to the ESP32 community for their valuable resources and support.