PWM Cooling-FAN Control and Over Temperature Protection using LM35 and ATTiny13

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:

  1. ATtiny13 microcontroller
  2. LM35 temperature sensor
  3. Cooling fan with PWM control input
  4. Transistor or MOSFET to drive the fan (if required by fan)
  5. Power supply for the fan and microcontroller
  6. Resistor(s) for current limiting and pull-up/down functions
  7. Capacitor(s) for decoupling
  8. Development board and programmer for ATtiny13 (if not programming on the circuit directly)

Design Steps:

  1. 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.
  2. 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).
  3. 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
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. Programming Interface:

    • Add header pins or an interface to program the ATtiny13 without removing it from the circuit.
  10. 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.