25 - 10 - 2020

USB Dongle Licence

USB Dongle for AltonaLab software Licence

 

Without the USB dongle, the AltonaLab software will work in DEMO mode, which is very restricted. So all you have to do is - just insert the USB dongle into the USB port of your computer. Then your software will work under the Hobby licence:

 

 

 

Water level measurement

Experiment: Measuring the water level in a tank.

AltonaLab diagram: KIT_TankLevel.nsm

Used hardware:

  • Numato 8 channel USB GPIO Module;
  • Connector board for ADC 5V;
  • AltonaLab Soil humidity sensor;
  • Soil humidity probe;
  • 5V multi connector power supply board;
  • 220V to 12V, 2A power supply;
  • You also need to have a plastic tank with a depth of at least 10 cm (The tank is not included in the KIT).

This is the first experiment with a water. For this very simple experiment, we will use the Soil humidity sensor, which converts the resistance of a Soil humidity probe to a voltage in range 0..5V. The sensor is supported in AltonaLab diagram with a block SoilHumiditySenror. The block shows how much is the actual resistance of the Soil probe at its RSoil output. The idea is that the deeper the Probe is in the water, the lower is its resistance. As it is visible, at this experiment we will use the Soil humidity probe as a Water level probe. According to the resistance of the Probe, we will calculate the water level in the tank.

The hardware diagram is shown below. GPIO 0 of a Numato board is used to read the values of a Soil humidity sensor. The sensor is sensitive in range 50 ohms to 50,000 ohms.

 

 

 The used AltonaLab diagram is:

The Numato block reads the sensor's value in range 0..1023 by its 10 bit ADC. On every read its output OnRead becomes to a high level for a short time and signals the next block SoilHumiditySensor to convert the read ADC value to ohms on its output RSoil. Because the relation between a Probe resistance and a water level is not linear, we will make an easy preliminary experiment.

1. Run the diagram and just touch the Probe to a water. Then look at how much resistance is shown on the running diagram. In this case in AltonaLab laboratory it is around 10,000 ohms;

2. Insert the sensor deeper into the water so that it covers it halfway. The probe resistance is around 6,700 ohms.

3. Insert the sensor so that it is completely covered with water. Its resistance now is around 5,700 ohms;

As is visible from the measurements, the relation between a resistance and a water level is really not linear. Because the Probe is short, three points are enough.

Now double click on the block Approximation with the mouse and set its property Settings with three points, as is shown below:

XValue, YValue:

10000  0

6700  50

5700  100

The Approximation block will convert the Probe resistance in range 10,000 ohms .. 5,700 ohms to a water level 0..100%. The actual water level will be shown in a Tank control on a running AltonaLab diagram.

For the experiment, fill a container with at least 10 cm of water, then start moving the Probe slowly into the water, then slowly remove it, so you will simulate the change of the water level in the tank. Observe the level of the vessel on the computer screen visualized by the Tank control.

Of course, the Probe available in the KIT is not suitable for real measurements because to its short size. But for real tanks, you can easily make your own Probe with two long cables located close to each other. If you have made a Probe with a length of 1 meter, it is good to find the approximation points on every 5 or 10 cm along the length of the Probe.

 

 

Home Automation

Experiment: Home Automation.

AltonaLab diagram: KIT_HomeAutomation.nsm

Used hardware:

  • Numato 8 channel USB GPIO Module;
  • Connector board for ADC 5V;
  • AltonaLab temperature sensor;
  • Mini PIR motion sensor;
  • 5V multi connector power supply board;
  • One load relay board 8A
  • 220V to 12V, 2A power supply;

Home automation is very interesting area, because each of us wants something to be automated in his home. In the previous experiments, we learned how to control and monitoring some simple processes. In this experiment, we will learn how to build a complex system to automate our home. For this purpose we need a computer, which runs not stop and an AltonaLab software running on the same computer. The controlled devices at home will be - heather in bathroom, fan in bathroom, light in yard. Of course we will monitoring the temperature at a home and will have a security PIR sensor. Some of the devices will be controlled automatically from the computer, but if we want, we can control them in manual mode from the buttons located at the AltonaLab diagram or using our phone with android OS. So with this experiment, we will demonstrate a simple to use but very powerful block AndroidRemoteControl, which will allow you to control what you want by phone.

 

Warning!!! Before starting the AltonaLab diagram, you must to do the next:

  • You need to have a Static IP address at your home. This will allow an external TCP/IP client as an android application running on your phone to be connected to an opened TCP/IP port from AltonaLab software. At this case, AltonaLab software is a TCP/IP Server!
  • After or before the diagram is started, you need to start the TCP/IP Server too. Just press the button next to the button for Start the process. When the TCP/IP Server is started, it will receive a commands from Android application running on your phone, and you can control or monitoring your home by phone:

 

  • Set the CommPort property of a Numato block in the diagram;
  • In block SunInfo - set the properties Latitude and Longitude with GPS coordinates of your home;
  • For block AndroidRemoteControl - you have to do a few settings, which are described below at this article;
  • In block MailSender to set all the properties related to the used mail account: Server, Port, UserName, Password, SenderEMail, RecipientMail, RecipientName. A MailSender block is well described at the article with URL below:

https://scada.altonalab.com/index.php/en/descriptions-of-the-functional-blocks/internet-library

 

To be able to send commands from your Android phone to the running AltonaLab software, you need to follow a few simple steps described below:

1. At AltonaLab software, set which IP Port will be used for a TCP/IP Server. Usually it is 707. If the checkbox AutoStart TCP/IP Server is checked, when AltonaLab software is started, the TCP/IP Server will be started automatically too:

2. Open the used TCP/IP Port 707 in Windows FireWall. For Windows 10, the steps are shown below:

Navigate to Control Panel, System and Security and Windows Firewall.
Select Advanced settings and highlight Inbound Rules in the left pane.
Right click Inbound Rules and select New Rule.
Add the port you need to open and click Next.
Add the protocol (TCP or UDP) and the port number into the next window and click Next.
Select Allow the connection in the next window and hit Next.
Select the network type as you see fit and click Next.
Name the rule something meaningful and click Finish.

You have now opened a firewall port in Windows 10!
 

At the same Inbound Rules interface, click with right mouse button over the application AltonaLab, then select Properties, then select the radio button Allow the connection. The changes are shown below:

 

3. Usually, your computer has an local IP address, because it is connected to the internet by an internet router. But for this experiment, you need to find your external IP address. You can use a WEB site as the URL below, to find your external home IP address:

https://www.whatismyip.com/what-is-my-public-ip-address/

4. You need to know a local IP address of the computer, where an AltonaLab software runs. For this purpose, click over the icon of your internet connection and find your local IP address. It looks like: IPv4 address: 192.168.2.3. The other way is - run the Command prompt application and then execute the command: ipconfig. Then at the text result of the command, find your local IP address:

IPv4 Address. . . . . . . . . . . : 192.168.2.3

5. Because we will start a TCP/IP Server of an AltonaLab software and we will use a 707 TCP/IP Port, we have to set the Port forwarding at our internet router. You need to know the local IP address of your internet router and to open its WEB interface, where some settings can be made. If you don't know how to make this, please ask your internet provider. The WEB site of my DLink internet router looks like the image below. I will use it to redirect an external IP Port from my external IP address to an internal Port of my computer which a local address I found with the command above. So if the external IP Port 707 is the same as an internal IP Port 707 of my computer with a local IP address 192.168.2.3, then the Port forwarding settings are:

6. Now is a time to start the TCP/IP Server of the AltonaLab software. For this purpose press the button of AltonaLab shown below. This will allow AltonaLab to receive TCP/IP connections from other devices over the internet:

7. You need a Smart phone with an Android OS;

8. Open an internet browser on your Android phone and open the URL below:

https://scada.altonalab.com/index.php/en/samples

The click on the second image, which is: 2. Android application for remote control:

9. You need to allow an installation from an unauthorized source and to install the application.

10. When the android application is installed, run it and press the button Settings. On the image below is shown the Android's application interface. The settings interface is the right page. At the Server IP Address you have to set an external IP address of your home. Usually we use the port 707 for AltonaLab TCP/IP Server, but it is not problem, if it is other number. ObjectID and Password has to be same asthe properties ObjectID and Password at the block AndroidRemoteControl from the running AltonaLab diagram.

11. AltonaLab can receive TCP/IP commands only from registered android phones, so it is a time to register all the phones of your family. Please be sure, the TCP/IP Server of AltonaLab software is started, then navigate to Settings->Allowed android devices at AltonaLab software. Run the android application shown at the image above, click the button Settings and if the Server IP and Port are set with valid values, click the button Register to host, at this moment the uncial ID of your phone will appeared at the edit Android device ID. At the next edit set a Description and Add the device to the allowed devices. Now your phone is allowed to send TCP/IP commands to a running AltonaLab software.

12. The last step is to read the button configuration, which is set at the block AndroidRemoteControl. For this purpose be sure the TCP/IP Server of AltonaLab is started, then run the AltonaLab diagram too. At this moment press the button Get configuration from a Settings interface of an Android application. Then go back to the main interface of Android application and you will see control buttons of your home devices. When you press some of the buttons from the main interface of Android application, the corresponding TCP/IP command will be send to a AltonaLab TCP/IP Server and some of your devices will be turned ON.

 

 

The used hardware is shown below. GPIO 0 and GPIO 1 of a Numato board are used to read the values of a Temperature sensor and a PIR Sensor. The 2 relays controller has two digital inputs, connected to GPIO 4 and GPIO 5 of a Numato board. GPIO 4 is used to control the Yard Light, GPIO 5 controls a bathroom heater. The Yard light is simulated with a 12V lamp, the Bathroom heater is controlled by powerful 12V 8A relay, available in the KIT equipment. The wire between 2 relay controller and One load relay board 8A can be very long. AltonaLab diagram controls GPIO 6 of a Numato board, but in this hardware diagram it is not connected to a real hardware.

 

Please be very careful with PIR sensor! It is very small and it has not good readable texts on its board about its pins. Its board has two sides, one with electronic elements and other with soldering. The image below is with electronic elements on top side. The left pin is Positive power supply, the middle pin is signal output, then is GND. The pins of a PIR sensor are connected to the Connector board by cables Male to Female!!!

 

 

The used AltonaLab diagram is:


AltonaLab diagram has a few areas:

- A top area with controls - there is a text control, which shows the current temperature, Lamp for current state of a PIR sensor, three lamps for Heater in bathroom, Fan in bathroom, Yard light. There are three buttons, if one of them is pressed, the corresponding device will be Turned ON for 10 min. The diagram has two lamp, which show whenever the e-mail is send or not, when there is a security event generated from a PIR sensor.

- Read sensor data and control relays - the area includes Numato block, block AltonaSensorTemp, which converts the read RAW value from the ADC to degree centigrade, SchmittTrigger block, which convert ADC value to digital signal. The high value of this digital signal means there is a security event generated from a PIR Sensor. Because the diagram has to work non stop, Numato block is not in Fast mode and its parameters are CommunicatePerSec=1, FastMode - unchecked;

- Send e-mail - the area is well explained in the experiment Simple home security system. The purpose of the area is when there is a security event, generated from the PIR Sensor, the home owner to receive an e-mail with information of the temperature of the house too. If there is not a secure event, the owner will receive every day an e-mail at 20:00h. This e-mail is very important, if you receive the mail this means, the computer is still running and additional you will know what is your home temperature. The information is interesting is case you are at a holiday or at a business trip;

Control heater - if your bathroom is cold at a winter time, you can turn ON the heater for 10 min by pressing a button Heather in bath located on top of a running AltonaLab diagram or to press the button Heater of your Android application, running on your smart phone. The both events are connected to the inputs of a OR block, then the TimeOut block will be turned ON for a 10 min and GPIO 5 of a Numato block will become to a high level. The main purpose of this area is to demonstrate how simple is to control a device using a TCP/IP command, which is sent from a phone;

- Control Yard Light - the area has a similar logic as a Control heater area, additional is added a block SunInfo. At this block are set parameters Latitude and Longitude with GPS coordinates of your home. As is known, the sun set and sun rise are changing every day and are different on all the world locations. When outside is night or twilight, your Yard light will be turned ON. The time of Turn ON/OFF will be different every day. The Yard light can be turned ON for a 10 min by pressing the button Yard light of an android application;

- Control FAN - if you get a shower every working day around 8:30h and leave from home around 9:00h, it is a good idea the FAN of your bathroom to work at time period 9:05h..9:20h. But only in working days, because at a holiday it is not clear when you will get a shower. This logic can be easy achieved by a block TimeInterval, which parameter OnOffInterval is set to 9:05;9:20. This means at this interval of time every day, the output of the block will be in high level. The mentioned output is with AND logic with output WorkDay of a block DayOfWeek. The output WorkDay is in a high level from 00:00:00h of Monday to 23:59:59 of a Friday. The fan can be turned ON for a 10 min by pressing the button Fan of an android application;

- Remote control by phone - the area contains a block AndroidRemoteControl, which is well explained at the URL below:

https://scada.altonalab.com/index.php/en/descriptions-of-the-functional-blocks/android-library-blocks

 

The properties of the block AndroidRemoteControl are shown below.

The properties are:

  • Properties ObjectID and Password has to be the same as the settings ObjectID and Password in the android application. One AltonaLab diagram can has more than one blocks AndroidRemoteControl, but this blocks need to have different ObjectID properties, which means some phones can send some commands, other phones can send other commands;
  • PhoneSettings - using this property we add at the top grid the monitoring signals, which values can be visible at the phone. The names of this values have to be added to the text of property TextOut of the block. At the bottom grid we add the buttons, which will appeared at the android application, when the button Get configuration is pressed at the Settings page of the android application. The added monitoring values appeared as inputs of the block AndroidRemoteControl, the added Buttons appeared as digital block's outputs. When the corresponding button at the android application is pressed, the same block's output becomes at a high value;
  • TextOut - at this diagram, the property is set to a text:

Temp is: <InTemp;1> C
Heather bath: <InHeather>
Fan bath: <InFan>
Lamp yard: <InLampYard>

When the button Read of an android application is pressed, or some other button sending a command to AltonaLab software is pressed, the running diagram replaces the names of the input signals of the block AndroidRemoteControl with theirs values and sends the result to the phone. For example the text is replaced with:

Temp is: 23.5 C
Heather bath: Off
Fan bath: On
Lamp yard: Off

More information about how to format text can be read at the article Text formatting conception:

https://scada.altonalab.com/index.php/en/conceptions/text-formatting-strategy

 

 

Home Irrigation

The used hardware for all the Irrigation experiments is the same:

  • Numato 8 channel USB GPIO Module;
  • Connector board for ADC 5V;
  • AltonaLab Soil humidity sensor;
  • Soil humidity probe - two pieces;
  • Water level sensor;
  • PWM Regulator with digital input starter;
  • Mini water pump 5V;
  • Watering hose - 1 meter and Sprinkler;
  • 5V multi connector power supply board;
  • 220V to 12V, 2A power supply;
  • You also need to have a pot with soil (Not included in the KIT).


Warning!!! The Jumper of the PWM Regulator has to be removed for Irrigation experiments. This is because the power supply of the PWM Regulator is 12V, but the Water pump power supply is 5V. With removed jumper, the output power of the PWM regulator will be 0..6V. When the diagram is run for a first time, please adjust the PWM Screw to the needful power of the pump. The pump is cheap and not very powerful, but it is perfect to present the idea of a complete irrigation system. It can be easy replaced with more powerful pump for your future and real system.

 

For all the Irrigation experiments:

GPIO 0, 1, 2, 3 of a Numato board are set as analog input. GPIO 4, 5, 6, 7 are set as digital outputs. 

  • Control the water in tank - GPIO 0 of Numato block is used to control the water level in the tank.GPIO 0 is connected to the output of a Water level sensor. The output of this sensor is NOT analog, it is digital. This means, when the probe is in a water, the output of the sensor becomes to a high level +5V, when there is not water, the output is in low level 0V. The analog output IO00 of Numato block is converted to a digital signal by the block AnalogToBool, so when the probe of the Water level sensor is contacted with a water, the output of the block AnalogToBool will become to a high level, if the tank is without water, the output will be in a low level. The use of this sensor is very important to avoid the damage of the pump because of missing water in the tank.
  • Soil humidity - GPIO 1 of Numato board is used to read the voltage output 0..5V of a Soil humidity sensor. The sensor is sensitive in range 50 ohms to 50,000 ohms. The block SoilHumiditySensor of the diagram is used to convert the ADC value 0..1023 of IO01 output of a Numato block to soil resistance - output RSoil (in ohms) and soil humidity - output Humidity (0..100%). The block SoilHumiditySensor has two very important parameters: HiLevelHum and LowLevelHum. We use this parameters for hysteresis effect - for example, let set the parameters HiLevelHum = 70%, LowLevelHum=30% and thenrun the diagram. If the current soil humidity is 20%, the system will start to irrigate until the soil humidity increased over 70%, then the irrigation will be stopped until the soil humidity decreased below 30%, then the irrigation will be started again. The block SoilHumiditySensor has an output Irrigate, which becomes to a high level, according to the explanation above.

For all the irrigation experiments, the parameter FastMode of a Numato block is turned OFF, CommunicatePerSec is set to 0 sec. For a real irrigation system, CommunicatePerSec can be set to 1 or more seconds, because the real irrigation process is not very fast and the computer can get its decisions slowly. 

 

The hardware diagram for all the Irrigation experiments is shown below:

 

 

The real picture of the Tank, Pump and Water probe is:

 

For the experiments, the Soil humidity probe and the Sprinkler are placed close to each other, because at this case, the measured soil humidity will be changed very fast when the irrigation is started:

 

Experiment: Irrigation by Time.

AltonaLab diagram: KIT_IrrigationByTime.nsm

Please read the common information for all the irrigation experiments at the top of this article!

This experiment uses only a sensor for Water level, to avoid the pump operation without water. The Soil humidity sensor is not used, the diagram is organized logic for watering by time, without feedback about a soil humidity.

The used AltonaLab diagram is:

The control logic by a Time is presented by blocks DayOfWeek and TimeInterval. The idea is:

  • At the days Monday, Wednesday and Friday the output of the block OrUni will be at a high level, because of this days, one of the connected outputs of the block DayOfWeek will be at a high level;
  • In the time period 22:00..22:02, the output of the block TimeInterval will be at a high level, because its parameter OnOffInerval is set to 22:00..22:02. The idea is the irrigation process to be set at the night time, because at this time there is not a sun radiation and the water evaporation will be low, the time to the morning is enough, the water to be absorbed from plants. Please note, the pump running time is very short in this experiments, only 3 min, because this is just a demonstration experiment and the pump is very weak. At the real live, the time interval could be longer and the pump to be more powerful. At the block TimeInterval, unlimited time intervals can be added in the parameter OnOffInterval.

As is described at the beginning of this article, AnalogToBool block, represents existing of a water in the tank. If the output of the block is in a high level, there is a water in the tank. 

The outputs of the AnalogToBool, OrUNI and TimeInterval blocks are inputs of the block AndUNI. This means, if there is a water in the tank, the current day is Monday, Wednesday or Friday and current time is in interval 22:00..22:02h, the pump will be started. For the demonstration purpose, just connect the output of the DayOfWeek block, which represents the current day to the OrUni block, then open the parameter OnOffInterval of the block TimeInterval, delete the existing interval and add a new one, which is a few minutes after the current moment. Then run the diagram.

The pump can be started with a button Pump too (available on the AltonaLab diagram), because the output of a AND block and the output of a button block are connected to the inputs of a OR block. The output of the OR block is connected to the digital input IO4 of a Numato block. When the Numato input IO4 is in a high level, the input of the PWM board will be enabled and the pump will start to irrigate.

 

Experiment: Irrigation by Soil humidity.

AltonaLab diagram: KIT_IrrigationByHum.nsm 

Please read the common information for all the irrigation experiments at the top of this article!

The experiment is very interesting, using the diagram below, the soil moisture of the home plants can be adjusted in very precise boundaries. In this experiment we will use two soil humidity probes - one inserted into the soil and one to control the presence of a water in the tank.

 

The used AltonaLab diagram is:

 

GPIO 0, 1, 2, 3 of a Numato board are set as analog input. GPIO 4, 5, 6, 7 are set as digital outputs. 

  • Control the water in tank - GPIO 0 of Numato block is used to control the water level in the tank.GPIO 0 is connected to the output of a Water level sensor. The output of this sensor is NOT analog, it is digital. This means, when the probe is in a water, the output of the sensor becomes to a high level +5V, when there is not water, the output is in low level 0V. The analog output IO00 of Numato block is converted to a digital signal by the block AnalogToBool, so when the probe of the Water level sensor is contacted with a water, the output of the block AnalogToBool will become to a high level, if the tank is without water, the output will be in a low level. The use of this sensor is very important to avoid the damage of the pump because of missing water in the tank.
  • Soil humidity - GPIO 1 of Numato board is used to read the voltage output 0..5V of a Soil humidity sensor. The sensor is sensitive in range 50 ohms to 50,000 ohms. The block SoilHumiditySensor of the diagram is used to convert the ADC value 0..1023 of IO01 output of a Numato block to soil resistance - output RSoil (in ohms) and soil humidity - output Humidity (0..100%). The block SoilHumiditySensor has two very important parameters: HiLevelHum and LowLevelHum. We use this parameters for hysteresis effect - for example, let set the parameters HiLevelHum = 70%, LowLevelHum=30% and thenrun the diagram. If the current soil humidity is 20%, the system will start to irrigate until the soil humidity increased over 70%, then the irrigation will be stopped until the soil humidity decreased below 30%, then the irrigation will be started again. The block SoilHumiditySensor has an output Irrigate, which becomes to a high level, according to the explanation above.

For a real irrigation system, the parameters HiLevelHum and LowLevelHum of the block SoilHumiditySensor should have distant values, for example 70% and 30%. But at this case the time between two irrigations will be very long. If we want to make a demonstration of the irrigation, we can set the parameters with close values HiLevelHum=70%, LowLevelHum=67%. At this case, the Start/Stop process will be more intensive. 

The outputs Irrigation of the block SoilHumiditySensor and an output of the block AnalogToBool are connected to the inputs of a block AND. This means, the current soil humidity has to be under LowLevelHum, which will rise the level of the output Irrigate of the block SoilHumiditySensor and has to have a water in the tank, in order to start the pump. If the output of the block AND is in a high level, it starts the pump.

The pump can be started with a button Pump too (available on the AltonaLab diagram), because the output of a AND block and the output of a button block are connected to the inputs of a OR block. The output of the OR block is connected to the digital input IO4 of a Numato block. When the Numato input IO4 is in a high level, the input of the PWM board will be enabled and the pump will start to irrigate.

 

Experiment: Irrigation by Soil humidity and Forecast.

AltonaLab diagram: KIT_IrrigationByHumAndForecast.nsm 

Please read the common information for all the irrigation experiments at the top of this article!

The used AltonaLab diagram is:

The diagram of this experiment is very close to the experiment: Irrigation by Soil humidity At the curent experiment, an additional logic is added by a block ForecastMyWeather2. The block ForecastMyWeather2 is well explained at the URL:

https://scada.altonalab.com/index.php/en/descriptions-of-the-functional-blocks/weather-library

  • Create an account in the WEB site: MyWeather2.com and get you Access code;
  • Enter your Access code to the parameter UniqueAccessCode of the block ForecastMyWeather2;
  • Enter the parameters Latitude, Longitude of the block ForecastMyWeather2 with GPS coordinates of your living place;  

When the diagram is run, the output CanIrrigate of the block ForecastMyWeather2 will be at a high level, in the cases below:

  • if the forecast for today is not for a raining weather;
  • if the yesterday's forecast for today, which is remembered from yesterday running of the diagram, is not for a raining weather. This condition is possible only if the diagram is not stopped from yesterday!


So the irrigation process will be started if the next three conditions are available: there is a water in the tank, the soil humidity is low and the forecast for today is not for a raining weather.

 

 

Simple home security system

Experiment: Simple home security system.

AltonaLab diagram: KIT_SimpleHomeSecurity.nsm

Used hardware:

  • Numato 8 channel USB GPIO Module;
  • Connector board for ADC 5V;
  • AltonaLab temperature sensor;
  • Mini PIR motion sensor;
  • 5V multi connector power supply board;
  • 220V to 12V, 2A power supply;

The idea - Imagine you have a property 100km far from you and you do not know what is going on with it. A non stop running computer equipped with AltonaLab software and needful hardware will help you to monitoring your remote property:

  • PIR motion sensor - it is very cheap but it works more than perfect. If someone passes a few meters in front of it, the sensor's output will become at a high level for a few seconds. The sensor's output signal will be measured with an analog input of a Numato board and every security event will be caught. Let say we put the sensor in the living room;
  • Temperature sensor - some time the temperature in a remote object is very important to be monitored, for example, at the winter time the water pipes can froze, so if we know the temperature in an area close to the pipes, we can avoid the problems;
  • AltonaLab diagram has a block MailSender. You will receive an e-mail each time, when the PIR sensor catches a moving. You will receive an addition e-mail every day at 20:00h. With every e-mail you will receive an information about the temperature too. An additional e-mail at 20:00h is very important, because if there is not security event, you will receive at least one e-mail daily and you will know what happen with the house temperature. If you don't receive your daily e-mail, this is an important situation too - maybe your computer is crashed and stopped to work or someone stole your computer. If you rarely delete your emails, you'll have a history of what happened to your property in the last week or month.

Warning!!! Before starting the AltonaLab diagram, you must to do the next:

  • Set the CommPort property of Numato block in the diagram;
  • In the block MailSender to set all the properties related to the mail account, which you will use: Server, Port, UserName, Password, SenderEMail, RecipientMail, RecipientName. MailSender block is well described at the article with URL below:

https://scada.altonalab.com/index.php/en/descriptions-of-the-functional-blocks/internet-library

Because at this diagram, AltobaLab is a mail client, which is connected to the mail server, please read careful at the article above: How to send e-mail via GMail account - some special settings in the e-mail WEB site are needed, in other case, AltonaLab will be blocked to send mails from your e-mail server! If you use other mail server than GMail, similar settings are needed!

 

Please be very careful with PIR sensor! It is very small and it has not good readable texts on its board about its pins. Its board has two sides, one with electronic elements and other with soldering. The image below is with electronic elements on top side. The left pin is Positive power supply, the middle pin is signal output, then is GND. The pins of a PIR sensor are connected to the Connector board by cables Male to Female!!!

 

 The used AltonaLab diagram is:

  •  Because the diagram has to work on non stopped computer up to an infinity time, a Numato block is without fast optimization, so the parameter FastMode is unchecked and a parameter CommunicatePerSec is set to 1 sec. With this settings, when there is an event from the PIR sensor, it will be caught with 1..2 sec delay, but in this security system, the short delay is absolutely not a problem;
  • GPIO 0 from Numato board is used as analog input to measure the temperature and GPIO 1 is used as analog input too to catch the event from PIR sensor. When there is not a PIR sensor event, its output is measured as around 0 ADC value, when there is a moving in front of the sensor, its output is around 610  RAW ADC value. This is the reason because a HiHysteresists parameter of the block SchmittTrigger is set to 500 and LowHysteresists is set to 300. Using the block SchmittTrigger we convert analog value from the PIR sensor to a digital signal;
  • A measured temperature and a PIR sensor condition are shown with a text control and a lamp controls on the top side of the diagram;
  • At the block MailSender, using the parameter Inputs are added three inputs: Date from datetime type, LivingRoom from digital data type and Temp from analog data type. Those three signals are appeared as inputs of the same block. Then at the block's parameter Body is set the text below, which will form after the formatting a body of the send e-mail:

 

Date: <Date;dd.MM.yyyy HH:mm:ss>

Living room: <LivingRoom>

Temperature: <Temp;1>

 

The article from the URL below explains how to use a Text formation conception:

https://scada.altonalab.com/index.php/en/conceptions/text-formatting-strategy

Into the text of the e-mail body are used names of the block's inputs. When the block's input DoSend becomes to a high level, the names of the block's inputs will be replaced with theirs values and the result text will looks like the text below:

 
Date: 12.04.2020 11:39:18
Living room: On
Temperature: 19.5

You can easy add more inputs of a MailSender block if you want to monitoring more PIR or other sensors. At the top of the diagram are located two more lamp controls, one of them Mail is sent: will Turn ON when the e-mail is successfully sent. If some of the parameters of a MailSender blocks related to an identification to a Mail server are not correct, the Lamp control Mail send error will Turn ON.

  • The block MailSender will send a mail in two reasons - if there is an event from a PIR Sensor or the output of the block TimeSchedule becomes to a high level. The block TimeSchedule is set to send a mail every day at 20:00h. This mail is very important, because if there is not a PIR event a long time - weeks or months, using the mail from 20:00h you will know the temperature of your remote house. The other purpose of this daily mail is to know the computer is still running and is not crashed;

 

Subcategories