Set Temperature Actuator Responds Arduino Using Lcd

About the project

In this Visuino project, you will learn how to control a linear actuator automatically based on temperature.

Project info

Difficulty: Easy

Platforms: ArduinoDFRobotSparkFunVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Arduino UNO Arduino UNO x 1
Jumper wires (generic) Jumper wires (generic) x 1
DFRobot Gravity: DHT11 Temperature Humidity Sensor For Arduino DFRobot Gravity: DHT11 Temperature Humidity Sensor For Arduino x 1
DFRobot I2C 16x2 Arduino LCD Display Module DFRobot I2C 16x2 Arduino LCD Display Module x 1
9V 1A Switching Wall Power Supply 9V 1A Switching Wall Power Supply x 1
SparkFun Full-Bridge Motor Driver Breakout - L298N SparkFun Full-Bridge Motor Driver Breakout - L298N x 1
Linear actuator Linear actuator x 1

Software apps and online services

Arduino IDE Arduino IDE
Visuino - Graphical Development Environment for Arduino Visuino - Graphical Development Environment for Arduino

Story

Step 1: What You Will Need

  • Arduino UNO (Or any other Arduino)
  • Linear Actuator
  • DHT11 Temperature and Humidity sensor
  • LCD I2C Display (Optional)
  • LN298N DC Motor Driver
  • Jumper wires
  • Power Supply or batteries
  • Visuino program: Download Visuino

Step 2: The Circuit

  • Connect Power supply (batteries) pin (gnd) to motor driver controler pin (gnd)
  • Connect Power supply (batteries) pin (+) to motor driver controler pin (+)
  • Connect Power supply (batteries) pin (+) to Arduino pin (VIN)
  • Connect GND from Arduino to motor driver controler pin (gnd)
  • Connect digital pin(3) from Arduino to motor driver pin (IN1)
  • Connect digital pin(4) from Arduino to motor driver pin (IN2)
  • Connect Linear Actuator to the motor driver as you can see on the schematic
  • Connect LCD Display pin [SCL] to Arduino pin [SCL]
  • Connect LCD Display pin [SDA] to Arduino pin [SDA]
  • Connect LCD Display pin [VCC] to Arduino pin [5v]
  • Connect LCD Display pin [GND] to Arduino pin [GND]
  • Connect DHT11 sensor pin[S] to Arduino digital pin[2]
  • Connect DHT11 sensor pin[-] to Arduino ground pin[GND]
  • Connect DHT11 sensor pin[+] to Arduino positive pin[5V]

Step 3: Start Visuino, and Select the Arduino UNO Board Type

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 4: In Visuino Add Components

  • Add "Humidity and Thermometer DHT11/21/22/AM2301" component
  • Add "Analog Value" component
  • Add "Compare Analog Value" component
  • Add "Detect Edge" component
  • Add "Text Value" component
  • Add "Speed and Direction To Speed" component
  • Add "Dual DC Motor Driver Digital and PWM Pins Bridge (L9110S, L298N)" component
  • Add "Liquid Crystal Display (LCD) - I2C" component

Step 5: In Visuino Set Components

  • Select "AnalogValue1" and in the properties window set "Value" to 1 <<this will be the speed of the motor, you can adjust it, the minimum is 0 and maximum is 1
  • Select "Compare1" and in the properties window set "Compare Type" to ctSmallerOrEqual and "Value" to 27 <<this is the temperature to compare, feel free to adjust this according to your needs
  • Select "DetectEdge1" and in the properties window set "On Rising/True" to False
  • Double click on the "TextValue1" and in the Elements window drag "Set Value" to the left side and in the properties window set "Value" to OPEN
  • Drag another "Set Value" to the left side and in the properties window set "Value" to CLOSED
  • Double click on the "LiquidCrystalDisplay1" and in the Elements window drag "Text Field" to the left side and in the properties window set "Initial Value" to TEMP: and "Width" to 5
  • Drag another "Text Field" to the left side and in the properties window set "Row" to 1
  • in the Elements window drag "Analog Field" to the left side and in the properties window set "Column" to 7 and "Width" to 10 and "Precision" to 0 <<this are temperature decimals, if you plan to use sensor with decimal output you can change this value

Step 6: In Visuino Connect Components

  • Connect "HumidityThermometer1" pin[Temperature] to "Compare1" pin[In]
  • Connect "HumidityThermometer1" pin[Temperature] to "LiquidCrystalDisplay1" > "Analog Field1" pin[In]
  • Connect "HumidityThermometer1" pin[Sensor] to Arduino digital pin[2]
  • Connect "AnalogValue1" pin [Out] to "SpeedAndDirectionToSpeed1" pin [Speed]
  • Connect "Compare1" pin [Out] to "DetectEdge2" pin [In]
  • Connect "Compare1" pin [Out] to "DetectEdge1" pin [In]
  • Connect "Compare1" pin [Out] to "SpeedAndDirectionToSpeed1" pin [Reverse]
  • Connect "DetectEdge1" pin [Out] to "TextValue1.Elements.Set Value1" pin [In]
  • Connect "DetectEdge2" pin [Out] to "TextValue1.Elements.Set Value2" pin [In]
  • Connect "SpeedAndDirectionToSpeed1" pin [Out] to "DualMotorDriver1.Motors.Item[0]" pin [In]
  • Connect "LiquidCrystalDisplay1" pin [I2C Out] to "Arduino.I2CChannels.I2C" pin [In]
  • Connect "DualMotorDriver1" > [Motors.Item[0].Direction] pin [Out] to "Arduino" pin Digital pin [4]
  • Connect "DualMotorDriver1" > [Motors.Item[0].Speed] pin [Out] to "Arduino" pin Digital > Analog PWM pin [3]

Step 7: Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Step 8: Play

If you power the Arduino module and the Linear Actuator will start to move according to your settings for the temperature, and the display will show the current Temperature and Actuator status.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it here and open it in Visuino: https://www.visuino.eu

Schematics, diagrams and documents

Visuino File

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...