This project transforms the Arduino Pro Micro into a multi-channel pulse generator. It outputs low-frequency, short-duration pulses on multiple pins (D3, D5, D6, D9). These pulses are ideal for triggering other devices or creating timing signals, such as clock pulses or pulse-per-second (PPS) signals.
- Four independent pulse channels on D3, D5, D6, and D9.
- Adjustable pulse frequency for each pin (0.5 Hz to 5 Hz by default).
- Adjustable pulse width (10 ms by default).
- Non-blocking code with
millis()for stable and continuous operation. - Easy customization to change frequencies, pulse width, or add more channels.
- Arduino Pro Micro (or any Leonardo-compatible board).
- USB cable for connecting to your computer.
- Optional: LEDs for visual feedback on pulse output, or an oscilloscope/logic analyzer to monitor the pulses.
- Open the
multi_pulse_generator.inofile in the Arduino IDE. - Connect the Arduino Pro Micro to your computer using the USB cable.
- In the Arduino IDE:
- Select Tools > Board > Arduino Leonardo (the Pro Micro uses the same architecture as the Leonardo).
- Select the appropriate COM port under Tools > Port.
- Click Upload to upload the code to the Pro Micro.
- Optionally, attach LEDs to the output pins (D3, D5, D6, D9) to see the pulses visually.
| Pin | Frequency | Interval | Pulse Width | Description |
|---|---|---|---|---|
| D3 | 0.5 Hz | 2000 ms | 10 ms | 10 ms HIGH every 2 seconds |
| D5 | 1 Hz | 1000 ms | 10 ms | 10 ms HIGH every 1 second |
| D6 | 2 Hz | 500 ms | 10 ms | 10 ms HIGH every 0.5 s |
| D9 | 5 Hz | 200 ms | 10 ms | 10 ms HIGH every 0.2 s |
The default frequencies and pulse widths are set in the code, and can be easily modified by changing a few values:
- Frequencies: Edit the
intervalXvalues in milliseconds. - Pulse Width: Change the
pulseWidthvariable to increase or decrease the pulse duration.
To change the frequency of Pin 1 (D3) to 1 Hz and set the pulse width to 20 ms, modify these lines:
const unsigned long interval1 = 1000; // 1 Hz (1000 ms interval)
const unsigned long pulseWidth = 20; // 20 ms pulse width