WOLFRAM SYSTEM MODELER
This example is a simple ON/OFF controller and can be used for either heating or cooling. It uses an LM35 to read the temperature, and based on that temperature, the controller switches a relay on or off. You can attach a fan or a heater to the relay, depending on the operation you want to perform. You can find the diagram in the figure below.
The target temperature is set by a constant component. The measured temperature is subtracted from the reference in order to obtain the error. The error signal is fed into the hysteresis component, which will send a Boolean signal to control the relay. If you want cooling instead of heating, you need to invert the logic of this signal.
Pin A0 for the Arduino UNO corresponds to pin number 14 for the Firmata. For other boards, the pin numbering may be different. If you have a different board, you can refer to the board capabilities that is printed when the simulation is started to see what pins are mapped to what ports. For the Arduino Lenoardo, A0 is mapped to pin number 18.
Note: You need to be careful when using relays that control electrical equipment using AC voltage, as an incorrect connection may damage your board.