Source code and a compiled HEX file can be downloaded here. Now let’s see how this circuit actually works.If you look closely you’ll notice that fan speed changes according to DIP switch position.The default speed setting is High. You can also connect a DVM at the PWM output of the microcontroller and verify that changing duty cycle causes the average voltage to vary from around 1.9 V to 5V.