Programmed an 8051 microcontroller unit using C for controlling the speed of a computer fan using pulse-width modulation based on the physical switch input by a user. A readout of the fan's speed was obtained by programming the appropriate interrupts such that the system could accept inputs from the user and update the 7-segment displays simultaneously.
For the electrical wiring setup, a breadboard was used to simplify the build. The following components were used:
Three 7-segment displays to display the speed of the fan
A DIP switch with 8 switches for the user to physically set the desired speed of the fan
Transistors to alternate between updating the displays and to regulate the signal sent to the 8051 MCU
The code for the 8051 was written using C, using low-level commands to manipulate the microcontroller to do the desired task. Functions were written to manipulate the 8051's interrupts, machine cycles, and timers so that the system could simultaneously read the input from the DIP switch, update the PWM accordingly, and update the 7-segment displays accordingly. The software will not be uploaded due to academic integrity reasons.
This project was completed with a partner.
Wiring setup using a breadboard, 7-segment displays, transistors, and DIP switch
Duty cycle readout to oscilloscope