Example: Greenhouse Simulator
Product: CODESYS IIOT Libraries SL
This example uses a greenhouse simulator to show how to use cloud communication with AWS IoT Core AWS Service.
Description
The example uses a greenhouse simulator to show how to use communication with the "AWS IoT Core" AWS service via the AWS IoT Core Client SL
library. The library is part of the CODESYS IIoT Libraries SL product. The program simulates two greenhouses which read the target values from the cloud and send the actual values to the cloud. The visualization of the "Observation and control unit" (OCU) can be used to monitor actual values of the greenhouses and write target values to the greenhouses.
The program needs three devices on "AWS IoT Core", two for the simulated greenhouses, and one for the control unit. The simulators and the control unit are implemented via function blocks and can be operated independently of each other. In the example, the function blocks are called via a single program. The control unit (OCU) has a visualization to set target values (configuration view) and monitor actual values (observation view). The values are stored in "AWS IoT Core" via "Device Shadows". A "Device Shadow" is a JSON file with the actual and the target values.
For more information about "Device Shadows", see: AWS IoT Device Shadow service
Download and install the CODESYS package CODESYS IIoT Libraries SL from the CODESYS Store International.
The first thing to do with "AWS IoT Core" is to create three devices with classic device shadows (
Greenhouse1
,Greenhouse2
, andGreenhouseControlUnit
) and set up the certificates. For a detailed description of how to use certificates, see the product data sheet of theAWS IoT Core Client SL
library.Open the
Greenhouse Simulator.project
sample project.Set your "AWS IoT Core" endpoint to the variable
Main.sEndpointName
.Download the application to the controller and run it.
Open
http://localhost:8080/webvisu.htm
in a web browser.Click the
button to switch to the configuration view.
Set the target values:
Click Apply Changes and press the
button to switch to the observation view.
Watch the simulated values for the selected greenhouse:
System requirements and restrictions
Programming system | CODESYS Development System (version 3.5.18.40 or higher) |
Runtime system | CODESYS Control Win (version 3.5.18.40) |
Add-on components | AWS account with access to |
Note
DOWNLOAD Project