Creating a PWM (Pulse Width Modulation) cooling fan controller with over-temperature protection using an LM35 temperature sensor and an ATtiny13 microcontroller involves a series of steps. The LM35 is a precision IC temperature sensor with an output proportionate to the temperature in Celsius. The ATtiny13 is a small, low-power microcontroller from the AVR family.
Here's a general outline of the steps and components you would need to create such a system:
Components Required:
- ATtiny13 microcontroller
- LM35 temperature sensor
- Cooling fan with PWM control input
- Transistor or MOSFET to drive the fan (if required by fan)
- Power supply for the fan and microcontroller
- Resistor(s) for current limiting and pull-up/down functions
- Capacitor(s) for decoupling
- Development board and programmer for ATtiny13 (if not programming on the circuit directly)
Design Steps:
-
Power Supply Decisions:
- Determine the voltage requirements for the LM35, ATtiny13, and cooling fan.
- Ensure that the power supply can deliver enough current for all the components.
-
Sensor Reading:
- Connect the LM35 to one of the ADC (Analog to Digital Converter) pins of the ATtiny13.
- The LM35 provides an analog voltage output that is linearly proportional to the Celsius temperature (10 mV/°C).
-
Microcontroller Programming:
- Set up an ADC to read the temperature from the LM35 sensor.
- Write the program to run on the ATtiny13 that will:
- Read the LM35 sensor
- Convert the analog signal to a digital value
- Calculate the temperature based on the LM35's scaling factor
- Decide on the PWM duty cycle based on the temperature read
-
PWM Control:
- Utilize one of the PWM-capable pins on the ATtiny13 to control the fan speed.
- Adjust the duty cycle of the PWM signal to change the speed of the fan.
- Implement a nonlinear fan control curve if needed for better thermal/acoustic performance.
-
Over Temperature Protection:
- Define a temperature threshold in the program.
- If the temperature exceeds this threshold, you can either set the fan to run at full speed or shut down the system to protect it from overheating.
-
Fan Driver Circuit:
- If the cooling fan requires more current than the ATtiny13 can supply directly, use a transistor or MOSFET as a switch to drive the fan.
- Ensure that the gate/base drive voltage is appropriate for the switching device.
-
Circuit Protection and Stability:
- Include a pull-down resistor on the gate of the MOSFET to ensure it remains off when the microcontroller pin is in a high-impedance state.
- Use a flyback diode if driving an inductive fan directly with a transistor.
- Include decoupling capacitors close to the power pins of both the LM35 and ATtiny13 to filter out noise and provide power stability.
-
Debugging and Testing:
- Once assembled, test the circuit with a controlled heat source to ensure that the temperature readings and fan control behave as expected.
-
Programming Interface:
- Add header pins or an interface to program the ATtiny13 without removing it from the circuit.
-
Mounting and Enclosure:
- Plan how the sensor will be mounted to effectively measure the temperature and how the entire circuit will be enclosed for safety and durability.
This summary is quite general, and the actual implementation might require additional considerations depending on the specific details of the fan, the target environment, and any additional features you'd like to implement. Remember to consider the electrical characteristics of all components, such as voltage and current ratings, and to program the ATtiny13 with attention to timing and resource constraints given its small size and more limited set of features compared to larger microcontrollers.