Connecting sensor to Rev pi
I am a new user exploring Rev Pi for the first time. Just for tiral seek guidance on connecting a P type thermocouple temperature sensor to my Rev Pi, while also developing a Node-RED dashboard. Specifically, I would like to know whether direct Python coding suffices for this task or if CODESYS is necessary. Additionally, I am interested in recommended steps and considerations for integrating the sensor data into the Node-RED dashboard.
Re: Connecting sensor to Rev pi
Hi Ajinkya09,
here are some tips and instructions for getting started with your RevPi and a temperature sensor
Requirements: in addition to the RevPi, you need a RevPi AIO expansion module to work with a temperature sensor (RTD, Pt100/Pt1000).
The link to our documentation will help you to connect the temperature sensor (RTD, Pt100/Pt1000):
https://revolutionpi.com/tutorials/uebe ... -messung-2
The link to our documentation will help you to configure the temperature sensor (RTD, Pt100/Pt1000) input:
https://revolutionpi.com/tutorials/uebe ... gurieren-2
Once you have successfully connected your temperature sensor (RTD, Pt100/Pt1000) to the RevPI AIO expansion module, you can start programming.
Testing AIO with piTest
1. Connect via SSH to your RevPi
Temperature sensor (RTD, Pt100/Pt1000) and AIO with Node-RED
1. Open a browser on your computer and connect to your RevPi via IP or ”PISERIALNUMBER”.local
> Node-RED website opens up
3. Install the graphical user interface
Temperature sensor (RTD, Pt100/Pt1000) and AIO with Python
1. Connect via SSH to your RevPi
Temperature sensor (RTD, Pt100/Pt1000) and AIO with Codesys
1. Install CODESYS Development System V3
2. Install CODESYS Control for Raspberry Pi
Regards
Stefan
Support | KUNBUS
here are some tips and instructions for getting started with your RevPi and a temperature sensor
Requirements: in addition to the RevPi, you need a RevPi AIO expansion module to work with a temperature sensor (RTD, Pt100/Pt1000).
The link to our documentation will help you to connect the temperature sensor (RTD, Pt100/Pt1000):
https://revolutionpi.com/tutorials/uebe ... -messung-2
The link to our documentation will help you to configure the temperature sensor (RTD, Pt100/Pt1000) input:
https://revolutionpi.com/tutorials/uebe ... gurieren-2
Once you have successfully connected your temperature sensor (RTD, Pt100/Pt1000) to the RevPI AIO expansion module, you can start programming.
Testing AIO with piTest
1. Connect via SSH to your RevPi
- Type the following command into your terminal tool on your computer: bash:~ pi@”PISERIALNUMBER”.local
password: ON YOUR REVPI
- bash:~ piTest -d > Found 3 devices: […]
- bash:~ piTest -r RTDValue_1 > 2 Byte-Value of RTDValue_1: 290 dez (=0122 hex)
Temperature sensor (RTD, Pt100/Pt1000) and AIO with Node-RED
1. Open a browser on your computer and connect to your RevPi via IP or ”PISERIALNUMBER”.local
- login with user: “admin” password: ON YOUR REVPI
webstatus website opens up
click on the services tab to enable Node-RED
select Enable/Disable Node-RED “Enabled” and click SAVE ALL
> Node-RED website opens up
3. Install the graphical user interface
- Click on the burger menu
Click on “Manage palette”
Click on the “Install” tab.
Search for the entry “node-red-dashboard”
Click on “Install”
- Drag a Revolution Pi - “revpi – single – input” node into the flow
Double-Click on “revpi – single – input” node and select Input Pin: “ PIN: RTDValue_1”
search in filter nodes “debug” and add a “debug” node
Connect the two nodes
Double-Click on revpi node and click the pen symbol at the Server
Config a Server, user: “pi” password: ON YOUR REVPI and click Add or Update
- goto the dashboard menu (right)
add a Tab and a Group
add a node named “gauge”
Connect the “gauge” node to the “revpi – single – input” node (parallel to the “debug” node)
Click the deploy and the than the link symbol top right at the dashboard menu
> dashboard displays the temperature
Temperature sensor (RTD, Pt100/Pt1000) and AIO with Python
1. Connect via SSH to your RevPi
- Type the following command into your terminal tool on your computer: bash:~ pi@”PISERIALNUMBER”.local
password: ON YOUR REVPI
- bash:~ nano tmp_sensor.py
copy the following code into nano
Code: Select all
import revpimodio2, time
for count in range(6):
rpi = revpimodio2.RevPiModIO(autorefresh=True)
tmp_sensor_1 = rpi.io.RTDValue_1.value
print("Temperature: " + str(tmp_sensor_1))
time.sleep(5)
- strg+o to save the file and strg+x to close the editor
- bash:~ python3 tmp_sensor.py
Temperature sensor (RTD, Pt100/Pt1000) and AIO with Codesys
1. Install CODESYS Development System V3
- Download link: https://store.codesys.com/de/codesys.html
2. Install CODESYS Control for Raspberry Pi
- Online help from CODESYS for Control for Raspberry Pi https://help.codesys.com/webapp/_rbp_f_ ... erry_Pi_SL
Download link: https://revolutionpi.com/tutorials/downloads#driver
Downloading CODESYS Control for Raspberry Pi 4.8.0.0 (ID: 6988)
- Download link: https://revolutionpi.com/tutorials/downloads#driver
Downloading Revolution Pi Library for CODESYS V1.4.0.0 (ID: 6985)
- Start CODESYS V3.5 SP19 Patch 2
Unzip CODESYS-Control-RaspberryPi-4800.zip
Go to Tools CODESYS Installer
Click: “Install File”
Select CODESYS Control for Raspberry PI 4.8.0.0.package
Select CODESYS Control for Raspberry PI 4.8.0.0 in the menu
Accept the License Agreement and continue
Follow the instructions The add-ons were successfully installed.
Unzip revolutionpibridge-V1.4.0.0.zip
Go to Tools CODESYS Installer
Click: “Install File”
Select RevolutionPiBridgeV1.4.0.0.package in the menu
Accept the License Agreement and continue
Follow the instructions The add-ons were successfully installed.
- Start CODESYS V3.5 SP19 Patch 2
Go to Tools Update Raspberry Pi
Raspberry Pi menu: enter the password from your RevPi
Raspberry Pi menu: enter IP Adress from your RevPi
Raspberry Pi menu: select CODESYS Runtime Package: 4.8.0.0 (raspberry, armhf)
Raspberry Pi menu: click “install”
Follow the instructions The runtime were successfully installed.
- If you install the codesys version 3.15.19 or higher, you have to do the following things.
connect to your RevPi via SSH
edit the Codesys Config
bash: ~ nano /etc/CODESYSControl_User.cfg
add “PlaceholderFilePath.1=/etc/revpi, $configrsc$” under “[SysFile]”
save with Ctrl + O, close nano with Ctrl + X
restart the Codesys Service
bash: ~ sudo service codesyscontrol restart
- Start CODESYS V3.5 SP19 Patch 2
File New Project: Create a new standard project
Select Device: “CODESYS Control for Raspberry Pi MC SL (CODESYS GmbH)”
Select PLC_PRG in: “Structured Text” Click “OK”
- Right-click on "Device (CODESYS Control for Raspberry Pi MC SL)" in the Devices tab.
Click on "Add Device…".
Click on the + Miscellaneous to expand
Select your RevPi Click “Add Device”
Right-click on your added RevPi Click “Add Device”
Select piBridgeLeft Click “Add Device”
Right-click on piBridgeLeft Click “Add Device"
Select RevPi_AIO Click “Insert Device”
Select RevPi_DIO Click “Insert Device”
Important: a Device named PiBridgeEnd will be automatically generated, over this device you can add some Gateway via click “Plug Device…”
- Double-click on “RevPi_AIO (RevPi_AIO)” in Devices/PROJECTNAME/Device (CODESYS Control fpr Raspberry Pi MC SL)/RevPi_Connect (RevPi Connect)/piBridgeLeft(piBridgeLeft)
Check and change the settings
Go to tab “Revolution Pi AIO Module I/O Mapping”
Give the channels you want to use a variable name – “tmp_sensor_1”
- Double-click on PLC_PRG (PRG) in Application
add a variable named “iSensorTmp”
Code: Select all
VAR
iSensorTmp: INT;
END_VAR
- add a line code zu read the value
Code: Select all
iSensorTmp:= Temp_sensor_1; // Read RTD Channel 1
- Click on menu Online Login
Follow the instructions and click on Debug Start or F5 key
displays the temperature in the debug view
Regards
Stefan
Support | KUNBUS
Re: Connecting sensor to Rev pi
Thank you, Stefan,
for providing detailed instructions on connecting a sensor to Revolution Pi. Your guide is comprehensive and will be valuable for me and also many users.
In my case now for this project, I'm using a K-type thermocouple sensor with a MAX6675 converter when working with Raspberry Pi. Could you please advise on how this work with RevPi
1) How to connect a K-type thermocouple sensor to Revolution Pi?
2) Is it possible to directly program in Python for reading K-type thermocouple data without using Codesys?
3) Do I need to use Codesys, or are there alternative methods for programming the Revolution Pi with a K-type thermocouple?
4) How can I set up a Node for data visualization in Node-RED when using a K-type thermocouple sensor?
Your guidance is appreciated.
Best regards,
Ajinkya09
for providing detailed instructions on connecting a sensor to Revolution Pi. Your guide is comprehensive and will be valuable for me and also many users.
In my case now for this project, I'm using a K-type thermocouple sensor with a MAX6675 converter when working with Raspberry Pi. Could you please advise on how this work with RevPi
1) How to connect a K-type thermocouple sensor to Revolution Pi?
2) Is it possible to directly program in Python for reading K-type thermocouple data without using Codesys?
3) Do I need to use Codesys, or are there alternative methods for programming the Revolution Pi with a K-type thermocouple?
4) How can I set up a Node for data visualization in Node-RED when using a K-type thermocouple sensor?
Your guidance is appreciated.
Best regards,
Ajinkya09
Re: Connecting sensor to Rev pi
if possible, Pease give answer to above question as soon as possible I am slightly confused as to where I went wrong or whether it is even wrong in the first place. Hope to get a reply on this soon!