Controlling a servo's movements based on a temperature reading. Made for a computer case mod.
This code with move a servo based on a temperature reading. The temp sensor used is a 2-wire type from an NZXT Sentry 2 fan controller.
it will run the loop only when 5v is sensed on the digital #7 input. this can be easily removed if you don't need this feature. If 5v is not sensed, the servo will be set to a pre-determined position
You'll have to adjust the "val = map" and "myservo.write(#)" values according to your specific usage.
This project is going to control a set of vents on the top of a computer case. These vents will have 2 140mm exhaust fans underneath them. When you turn the computer on, the Arduino gets 5v from the power supply. This tell is to run the loop. Based on case temperature, the fans will open/close as needed. Fan speed can be worked into this controller, but I've got a separate unit that handles my fan speeds.
The case that will be used is a NZXT Tempest EVO. The case mod can be seen here at The Best Case Scenario: