How do I change a constant speed 12v fan to change speed based on temperature?

I have 12v endless breeze fan that plugs into a cigarette lighter socket. It has 3 fixed speeds. I would like to be able to splice some device inline into the power cord that has a temperature sensor built into the device and set the fan to it's maximum speed. When the temperature inside the vehicle drops below 68°F the fan then starts throttling down slowly until it is at the lowest power draw it needs to maintain 68°F inside the vehicle. It will intelligently modulate the power to the fan to maintain 68°F at the lowest power draw possible. If the temperature goes above 68°F it will run the fan at maximum power until an equilibrium temperature is reached. It will then slowly reduce power to find the lowest power that will maintain this equilibrium temperature. So if it's 75°F outside and the fan only needs to run at 40% power to maintain 75°F inside the vehicle it will converge on a 40% power setting and maintain it. If it's 60°F outside but sunny and it would be 90°F inside then the fan runs until it figures out how little power it can use to keep the inside of the vehicle at 68°F. What do I need to buy and how do I wire it and program it?

Please post a schematic of the current fan controls, and a link to the data sheet of the fan itself. Then we can see whether this is possible, and if so, how.

This is a nice starter project - there's a tonne of stuff on the web about how to do it.

Have read of this, as it'll explain how to control the motor speed.

Have a read of this, as it'll explain how to detect temperature (and use it to control a fan, handily enough).

The arduino probably won't be able to handle the motor current on its own, so have a read of this, as it explains why you need a motor driver and how to use it.

If you want fully proportional control of the fan speed (i.e. fan-speed = set_temperature - measured_temperature * constant), then you'll need to read up on PID control techniques. This is about the best tutorial on the web I know of - I wouldn't rush into proportional control straight away, though - get the fan working at a fixed temperature first and build up from there.

There's enough sample code in all those links for you to knock this together by cut-and-paste alone :slight_smile:

Good luck!

The arduino probably won't be able to handle the motor current on its own,