Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:sw:01-mervis:attaching-1-wire-devices-hidden [2018/06/08 13:42] – martin_kudlacek | en:sw:01-mervis:attaching-1-wire-devices-hidden [2024/09/24 11:22] (current) – avsetula | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Attaching 1-Wire devices ====== | ====== Attaching 1-Wire devices ====== | ||
| + | <WRAP group> | ||
| + | <WRAP half column 81%> | ||
| In this tutorial, we are going to demonstrate, | In this tutorial, we are going to demonstrate, | ||
| + | </ | ||
| + | <WRAP half column 15%> | ||
| + | ;;# | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | ;;# | ||
| + | </ | ||
| + | </ | ||
| - | ===== Prerequisites | + | <WRAP center round box> |
| - | * UniPi controller running Mervis OS | + | < |
| + | * Unipi controller running Mervis OS | ||
| * Basic project in Mervis IDE in **Full mode** with | * Basic project in Mervis IDE in **Full mode** with | ||
| * attached controller | * attached controller | ||
| - | * created ModbusTCP channel with the UniPi controller device | + | * created ModbusTCP channel with the Unipi controller device |
| * defined **Executable project** with one program | * defined **Executable project** with one program | ||
| * setted **Autogen** on the Unipi controller device | * setted **Autogen** on the Unipi controller device | ||
| * defined task running a program from **Executable project** | * defined task running a program from **Executable project** | ||
| * successfully executed **Build** | * successfully executed **Build** | ||
| - | * [[https:// | + | * [[https:// |
| * [[https:// | * [[https:// | ||
| - | In this tutorial, we will use [[https:// | + | In this tutorial, we will use [[https:// |
| + | </ | ||
| ===== Attaching 1-Wire temperature sensor ===== | ===== Attaching 1-Wire temperature sensor ===== | ||
| - | The [[https:// | ||
| - | |||
| - | FIXME obrazek pripojeni cidla k Neuronu | ||
| - | FIXME pripojovani k Axonu | + | You can find all the informations about how to connect the DS18B20 based temeperature sensor [[en: |
| ===== Configuring 1-Wire bus in Mervis ===== | ===== Configuring 1-Wire bus in Mervis ===== | ||
| Line 43: | Line 54: | ||
| {{ : | {{ : | ||
| + | |||
| + | You now need to **deploy the solution** into the PLC to create the **OneWire** communication channel on it. | ||
| ===== Detecting 1-Wire sensors ===== | ===== Detecting 1-Wire sensors ===== | ||
| - | 1-Wire bus is a serial bus, which can interconnect many sensors. Each sensor has its unique HW address, through which the master of the bus addresses the slave and reads data from. Therefor we need to tell UniPi controller to look for a certain devices on the bus. Luckily, we can detect all the sensors on the bus and then select the ones we are interested in. | + | 1-Wire bus is a serial bus, which can interconnect many sensors. Each sensor has its unique HW address, through which the master of the bus addresses the slave and reads data from. Therefor we need to tell Unipi controller to look for a certain devices on the bus. Luckily, we can detect all the sensors on the bus and then select the ones we are interested in. |
| To detect the sensors, right click on the **1wire** channel name under the PLC in the **Solution** tab of the **Left panel**. In the context menu, click on the **Detect One Wire Sensors**. | To detect the sensors, right click on the **1wire** channel name under the PLC in the **Solution** tab of the **Left panel**. In the context menu, click on the **Detect One Wire Sensors**. | ||
| Line 65: | Line 78: | ||
| {{ : | {{ : | ||
| + | |||
| + | <WRAP center round important 90%> | ||
| + | If you have connected a Unipi 1W-TH-IB(2) sensor and after autodetection **1W-UniversalAi** is not automatically selected in the " | ||
| + | </ | ||
| The importing of the sensor will proceed and finish with restoring the PLC's mode. | The importing of the sensor will proceed and finish with restoring the PLC's mode. | ||
| Line 77: | Line 94: | ||
| ===== Debugging solution ===== | ===== Debugging solution ===== | ||
| - | The Mervis IDE has a feature called **Debugging**, | + | The Mervis IDE has a feature called **Debugging**, |
| {{ : | {{ : | ||
| - | To view the variables and their state in debug mode, click on the **Variable Browser** tab on the **Main window**. You will be presented with all the variables available in the controller. You can use searching by **Name**. Our temperature sensor has been autonamed " | + | To view the variables and their state in debug mode, click on the **Variable Browser** tab on the **Main window**. You will be presented with all the variables available in the controller. You can use searching by **Name**. Our temperature sensor has been autonamed " |
| {{ : | {{ : | ||
| Line 88: | Line 105: | ||
| We have connected the temperature sensor to our controller and verified, that we can read current temperature. Now we can use it in very simple temperature regulator. | We have connected the temperature sensor to our controller and verified, that we can read current temperature. Now we can use it in very simple temperature regulator. | ||
| - | We will be monitoring temperature and if the temperature will be under 30°C, we will turn the '' | + | We will be monitoring temperature and if the temperature will be under 30 °C, we will turn the '' |
| - | We could " | + | We could " |
| Our program will therefor need two inputs: '' | Our program will therefor need two inputs: '' | ||
| Line 98: | Line 115: | ||
| Let's start creating our program. Programming has to be done when the **Debugging** is stopped, so stop it by clicking on the **Stop Debugging** on the **Ribbon**, if you have it still running. Then double click on the name of the program in the **Left panel** to display it in the **Main window**. | Let's start creating our program. Programming has to be done when the **Debugging** is stopped, so stop it by clicking on the **Stop Debugging** on the **Ribbon**, if you have it still running. Then double click on the name of the program in the **Left panel** to display it in the **Main window**. | ||
| - | If you remember, in the **Variable browser**, the name of temperature variable was **1W-Thermometer_Temperature**. The name is autogenerated, | + | If you remember, in the **Variable browser**, the name of temperature variable was **1W-Thermometer_Temperature**. The name is autogenerated, |
| {{ : | {{ : | ||
| Line 132: | Line 149: | ||
| If you have the correct connections, | If you have the correct connections, | ||
| - | If your **Deploy** went well, you can **Start Debugging**. In the debugging mode, you can see actual values of each input and output of each block. You can see temperature in our office is 29.625°C, which is less then threshold of 30°C and therefor the heating is '' | + | If your **Deploy** went well, you can **Start Debugging**. In the debugging mode, you can see actual values of each input and output of each block. You can see temperature in our office is 29.625 °C, which is less then threshold of 30 °C and therefor the heating is '' |
| {{ : | {{ : | ||
| - | I warmed up the sensor a little bit and now it shows 30.875°C | + | I warmed up the sensor a little bit and now it shows 30.875 °C which is more than 30 °C and therefor the heating is '' |
| {{ : | {{ : | ||
| - | Also the relay on your UniPi controller should switch '' | + | Also the relay on your Unipi controller should switch '' |
| ===== Download ===== | ===== Download ===== | ||
| You can download the whole project here: {{ : | You can download the whole project here: {{ : | ||