Save money on your purchases by earning redeemable points with Progressive Rewards!
A linear actuator that is controlled with a temperature and humidity sensor has many prime applications. For example, one practical application would be to set up aquaponics and hydroponics where the humidity needs to be controlled – the sensor would detect when the temperature and humidity reach a certain threshold and automatically open/close a door using a linear actuator. This project is a fun activity for novice programmers or hobbyists who would like to learn the basics of Arduino coding to control a linear actuator.
This article is part of a series by Progressive Automations, which focuses on equipping you with the knowledge needed to use linear actuators, microcontrollers, and sensors in your next automation project. Would you like to control a linear actuator using a simple keypad or something more advanced like multiple ultra-sonic sensors to detect nearby movement? We have got you covered! This articles takes you through how to pair the right temperature sensor with an actuator, and how this sensor operates. Lets get started!
A digital temperature and humidity sensor is a basic, ultra-low-cost sensor, which can be used to sense temperature and humidity in the surrounding air. The LC-226 temperature and humidity sensor from Progressive Automations uses a capacitive humidity sensor and a thermistor to output signals which a microcontroller can read.
The humidity sensing component is a moisture-holding substrate with electrodes applied to the surface. When water vapor is absorbed by the substrate from the surrounding air, ions are released by the substrate, which increases the conductivity between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity. Thus, a higher relative humidity decreases the resistance between the electrodes, while lowering the relative humidity increases the resistance.
The LC-226 can be powered with a 5 VDC source and has the following temperature and humidity specifications:
Let us go over how you can link a temperature sensor with an actuator for any application you choose. Here is a list of what you will need:
Any linear actuator can be used, but be sure the power supply is rated for the voltage and current draw of the linear actuator and can handle the power requirements when under load.
Wiring a linear actuator to a relay is simple. In this case, we have used a 2-channel relay board. The wiring consists of four steps: actuator to relay, sensor to Arduino, relay to power supply, and actuator to relay.
Be aware that a remote temperature and humidity sensor with an actuator set up in a humid environment should have its controller adequately protected or installed outside the setup. The sensor is designed to handle humidity, but your Arduino controller is not. IP-rated casings are available for the Arduino for these applications. Alternatively, run cables from your outside controller to the humidity sensor located inside, where the temperature and humidity are read.
To use the temperature sensor with an actuator, download the DHT library from within the Arduino IDE. This library will enable the use of short commands to retrieve a reading for the humidity or temperature. Once the DHT library has been downloaded, add the following code to a new project: Temperature and Humidity Controlled Linear Actuator Code.
All code before the void setup() loop sets up the pin configuration based on your wiring and includes the DHT library setup. If you decide to use a different Arduino model, match the pin numbers with the code. Moreover, you can set the temperature values for when the actuator should open or close (open_door_temp and close_door_temp). Initially, set the values closer to room temperature so that you can test if the code works by simply using a hairdryer or other heat source to reach the activation temperature.
The void setup() code loop sets the relay configuration as outputs and ensures they are deactivated when first powered up. The serial monitor is also initialised, assuming you have the Arduino connected via USB to a laptop/desktop for initial testing.
The main code loop takes readings from the sensor using the commands dht.readHumidity(), dht.readTemperature(), and dht.readTemperature(true) and stores those values in a float variable to be used for some conversions. The values are converted to Celsius and Fahrenheit and are printed to the Arduino’s Serial Monitor.
Lastly, these readings are compared with the threshold temperature values to determine if the linear actuator should open or close. The relays are set to high accordingly, else, the actuator remains stationary, and the Arduino continues to monitor the temperature and humidity readings.
Using a temperature sensor with an actuator is a great way to learn how to program an Arduino, and has proven to be a very useful application addition. You may also find various other applications besides aquaponics and hydroponics to add this sensor to! Although we showed you how to control a 12VDC linear actuator, nothing is stopping you from using an industrial, high-powered linear actuator for more demanding applications – just be sure to match the power supply with the linear actuator.
If you have any queries or comments regarding this article, or any of our products, don’t hesitate in contacting us!
We have detected your location to be from outside of the US, would you like to go to our Canadian Store?