Getting Started
This directory contains example code demonstrating how to use the PWM AO4410 2-Channel Output Module with different programming platforms.
Overview
The PWM AO4410 module amplifies PWM signals from microcontrollers to control external loads at higher voltages and currents. The examples show how to generate PWM signals that can be used for:
- Motor speed control
- High-power LED dimming
- Variable power output control
- Load switching applications
Available Examples
📁 C/Arduino Examples (examples/c/
)
pwm.ino
- LED Fade with PWM Control
Platform: Arduino IDE compatible boards (Arduino Uno, ESP32, etc.)
Description: This example demonstrates basic PWM control by fading an LED up and down. It shows how to:
- Configure a PWM output pin
- Generate variable duty cycle signals
- Monitor PWM duty cycle values via Serial Monitor
- Create smooth fading effects
Key Features:
- Uses
analogWrite()
function for PWM generation - Configurable brightness step size
- Serial output for debugging and monitoring
- Simple fade up/down pattern
Hardware Connections:
- Connect PWM output pin (default: pin 9) to the module's PWM input
- Connect LED or load to the module's output terminals
- Ensure proper power supply connections
Usage:
- Open in Arduino IDE
- Select your board and port
- Upload the sketch
- Open Serial Monitor at 115200 baud
- Observe the LED fading and duty cycle values
📁 Python Examples (examples/python/
)
pwm.py
- MicroPython PWM Control
Platform: MicroPython (ESP32, Raspberry Pi Pico, etc.)
Description:
This MicroPython example shows how to control PWM outputs using the machine.PWM
class. It demonstrates:
- High-resolution PWM control (16-bit duty cycle)
- Frequency configuration
- Percentage-based duty cycle calculation
- Continuous fading loop
Key Features:
- 16-bit duty cycle resolution (0-65535)
- Configurable PWM frequency (default: 1 kHz)
- Percentage calculation for easy understanding
- Continuous fade pattern
Hardware Connections:
- Connect PWM output pin (default: GPIO 2) to the module's PWM input
- Connect LED or load to the module's output terminals
- Ensure proper power supply connections
Usage:
- Upload to your MicroPython device
- Run the script
- Observe the console output showing duty cycle values
- Watch the connected load fade smoothly
Module Specifications
PWM Input Requirements
- Voltage: 3.3V or 5V logic levels
- Frequency Range: 1 Hz - 100 kHz (recommended)
- Duty Cycle: 0-100%
Output Characteristics
- Channels: 2 independent outputs
- Maximum Voltage: 30V DC
- Maximum Current: 4A per channel
- MOSFET: AO4410 N-channel
- Control: Low-side switching
Connection Guide
QWIIC/4-Pin Header Connections
Pin | Function | Color (Standard) |
---|---|---|
1 | GND | Black |
2 | VCC | Red |
3 | PWM1 | Blue |
4 | PWM2 | Yellow |
Screw Terminal Connections
- VIN+/VIN-: External power supply for loads
- OUT1+/OUT1-: Channel 1 output to load
- OUT2+/OUT2-: Channel 2 output to load
Safety Considerations
⚠️ Important Safety Notes:
- Always ensure proper power supply ratings
- Use appropriate wire gauge for current requirements
- Verify load compatibility before connection
- Never exceed maximum voltage/current ratings
- Ensure proper heat dissipation for high-power applications
Troubleshooting
Common Issues:
-
No PWM Output:
- Check PWM signal connections
- Verify code is generating PWM on correct pin
- Ensure proper power supply
-
Insufficient Load Power:
- Check external power supply voltage/current
- Verify load requirements are within module limits
-
Erratic Behavior:
- Check for proper grounding
- Verify PWM frequency is within acceptable range
- Ensure stable power supply
Getting Started
- Choose your platform (Arduino/C or MicroPython)
- Wire the module according to the connection guide
- Load the example code for your platform
- Modify parameters as needed for your application
- Test with a simple load (LED) before connecting high-power devices
Additional Resources
Support
For technical support and questions:
- GitHub Issues: Open an issue
- Website: uelectronics.com
- Documentation: Product Wiki