Graduation project from DECI L4 Semester 1
A MicroPython-based project for ESP32 to control a dual-camera pan & tilt system using joystick input, servo motors, slide switches, and LEDs.
This project allows real-time control of two cameras using a joystick and 4 servos (two per camera). The direction is based on analog joystick readings, while a slide switch toggles control logic. Additional user-defined gain values adjust movement sensitivity. LEDs reflect switch states, and interrupt-driven mechanisms ensure responsiveness and efficiency.
-
Joystick Direction Detection
- Analog reading via ADC in polling or interrupt mode
- Outputs one of:
'U','D','L','R', or'M'(Middle) - Button press triggers a prompt for gain entry (1–10) via Serial
-
Servo Motor Control
- 4 Servos (2 per camera) initialized at 90°
- Can rotate left/right by set degrees
- Controlled using
goto(),left(), andright()methods - Servo movement speed is scaled by the user-entered gain
-
Switch and LED Logic
- One slide switch controls logic
- LED1 lights up when switch = ON, LED2 lights up when switch = OFF
- State read and stored in a dedicated variable
-
Interrupt-Driven Timer
- Joystick module supports interrupt timer mode
- Ensures smooth analog input handling without polling in main loop
- MicroPython
- ESP32 microcontroller
- Wokwi Simulator
- Serial Communication via UART
- PWM-based Servo Control
- Interrupt and Timer handling
- Upload the code to your ESP32 board using Wokwi or a supported MicroPython IDE.
- Slide the switch to toggle LED state and control logic.
- Use the joystick to move camera angles.
- Press the joystick button to input gain (1–10) from Serial Terminal.
- Watch the servo motors rotate with speed based on gain.
- You could run directly from the link below.
Note: Only one analog sensor (joystick) is connected and used at a time. The system reads from the actual device connected to the input pin, not all devices simultaneously.
I implemented all core functionalities including analog reading, servo motion with gain scaling, hardware interrupt integration, and organized modular Python files for reusability. I also ensured proper circuit layout and responsiveness in the Wokwi simulation environment.
.
├── main.py # Main control loop: handles switch, LEDs, joystick button, servo movement
├── joystick.py # Joystick class: ADC reading, direction detection, optional interrupt handling
├── servo.py # Servo control class: angle movement, gain integration