The final project in our series may seem complex, but is quite simple. We use the potentiometer to allow user input of a temperature value, and using the temperature sensor – if the ambient temperature rises above the value set via the potentiometer the relay is activated.
Connect the Temperature Sensor to the Analog A0/A1 input jack, like it was in Project 7.
The Grove produces an analog voltage on its D1 output, which is connected to Arduino A0 analog input on the A0/A1 input jack.
Connect the Potentiometer to the Analog A4/A5 input jack.
The Potentiometer produces an analog voltage on its D1 output, which is connected to Arduino A4 analog input on the A4/A5 input jack. Connect the Relay to the D2/D3 input jack.
The Arduino's D2 pin sends a signal to the Relay on the D1 connector. The Relay's red light indicates whether the relay is on or off, and the relay makes a clicking sound when it switches.
Now upload the following Arduino sketch:
// Project Eight - Thermostat
float b, q, resistance, temperature;
Try turning the potentiometer to the right and left and see if the relay turns on or off.
Tech Support & Product Discussion
Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.