Apologies. Moved from Sensor section. Topic removed.
The camera CMOS cooling project is nearing completion. Recapping, a Peltier cools a copper finger attached to the back of the CMOS. Max deltaT is 34C from ambient with no temp control. A TMP36 is located near the CMOS on the cold finger.
I want to control the temperature of the cold finger using the readings from the TMP36 using (as previously suggested) a Logic Level N-Channel MOSFET low rds(on) controlling current to the TEC (-ve to Drain).
This is working at the moment by setting a digital pin HIGH and LOW. Effectively hard banging. There is a lag in response to the TMP analog input and switching the digital pin equal to the frequency of polling the temperature. This doesn't seem ideal and using PWM is making more sense for smoother results.
As I understand PWM pulse width is related to current flow and therefore a fixed temperature for a given system. The cold finger is very sensitive to temperature deviation at minus temperatures, and a different temperature may be required for each imaging session (dew point).
I am not clear on the best approach or how to write a PWM sketch. In-fact understanding how to implement PWM is not clear to me at all. Missing something here?