I would like to control a DC motor's speed using the PWM output from my motherboard header.
Here's the standard pinout for a 4-wire PC fan header:
╔═══╦════════╦═════════════════╦════════╗ ║ # ║ Name ║ Description ║ Wire ║ ╠═══╬════════╬═════════════════╬════════╣ ║ 1 ║ GND ║ Ground ║ black ║ ║ 2 ║ +12V ║ Fan Power ║ yellow ║ ║ 3 ║ SIGNAL ║ Fan RPM ║ green ║ ║ 4 ║ PWM ║ Digital Control ║ blue ║ ╚═══╩════════╩═════════════════╩════════╝
Since my DC motor doesn't have a PWM input, I thought of using an
ATmega328P in my custom board to read the PWM output of the fan header -- pin 4 -- so that I can use a motor driver to control my motor's speed.
However, I'm not sure how I should read the PWM signal from the motherboard.
What is the
HIGHvoltage level of PWM output?
Do I need a voltage divider resistor for it?
A source for the fan control specifies this to be 5.25V at maximum, but since I haven't tested it out myself, I don't want to risk feeding a 12V signal to my microcontroller's input lines.
Should I use
pulseIn()function for the 25kHZ (21~28kHZ range) PWM output?
Can the ATmega328p handle this frequency range?
I prefer to use Arduino's bootloader with the wiring library, but if you have AVR-specific examples that I could follow, I'd appreciate it.