Using OWFS to read onewire
Which device is used on this example
1-Wire Busmaster / USB Hostadapter DS9490R, Eco-Line; Art-Nr: 0167
Important links to bring it up:
Hello,
I like to read several 1wire Sensors. In this project it is only possible to read one sensor (sOneWireAdress := 'xxxxxxx').
Can someone help me to add some more sensor adresses?
regards, johannes
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Reading RFID's with an USB RFID reader.
(KKmoon Berührungslose 14443A IC Kartenlesegerät Kartenleser Card Reader mit USB Schnittstelle )
(Webvisu is mandatory for doing this - we use the visu key Event handling)
Author: TON
Communiction with Sonos speakers
Program made with:
- PlayBar (Woonkamer)
- PLay 1 (Left)
- PLay 1 (Right)
- Sub (Subwoofer)
- Play 3 (Keuken)
- Play 1 (Badkamer)
- Play 1 (Slaapkamer)
Uses UDP socket for upnp Discover, TCP Server for events and TCP Client for commands.
Visualization for each group.
Display play status each group.
Control Play, Pause, Next, Previous each group.
Control Volume and Mute for each player.
See property each speaker by dialog.
Max 10 groups, 10 speakers with 3 satellites(LR, RR en SW).
Play doorbel
Functions:
- Find Sonos players with upnp discovery
- Find correct local ip if more then one network adapters
- Subscribe/Unsubscribe upnp events
- ZoneGroupTopology (for enumerate groups)
- AVTransport (get actual play status)
- RenderingControl (get volume/mute)
- Get XML player info
- Dialog box to display player info
- Webvisu. http://xxx.xxx.xxx.xxx:8080/webvisu.htm m
Author: TON
Push notification to Android/ios/desktop withPusover. https://pushover.net/.
Push notification to your device with title, message, sound and application.
For $5 (once) you can push 7500 notifications per month.
With this account you can create notification for applications.
This application has name, token, icon,.. So you can create a clear structure.
In this example you see a notification for three applications.
I use this for over a year and works like a charm.
Using an opcua python client for communcation with plc symbols (either on the same PI or remote PI)
How to use it: 1. Install OPCUA python: sudo apt-get install python3-lxmlpip3 install opcua
2. download CODESYS Project to the Pi and start it:
Use the OPCUA Project from the Pi examples
"c:\Users\<windowsusername>\CODESYS Control for Raspberry PI\3.5.12.0\Examples\OPCUA.project"</windowsusername>
Sample Python OPC UA Client.py example for browsing the variables/symbols
Could this be turned into a library? I'd love for a way to have the main program call a function block method using the program's I2C_master device.
I assume I should be passing the master as a variable for the function block, but I don't see how that could be achieved
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Play Sound on Raspberry PI. PiFace Interface is used.
RaspiSound_nonblocking Play several sound on the same time.
It uses the Omxplayer, should be installed.
dmesg | grep -i tty
to check which serial interface is available / connected
remove ';' /etc/CODESYSControl_User.cfg in the section [SysCom] and adapt ttyS to your used device
for example if you use USB which is connected to USB0 then it should /dev/ttyUSB in this config file
[SysCom] ;Linux.Devicefile=/dev/ttyS
If you use the serial port which is on the GPIO's (3.3V!) then you need to enable it in
sudo raspi-config ( Interface options - login shell disabled and serial hardware enabled)
even on Pi this is not really needed,
you could use on Raspian Stretch and use Chromium in full screen mode - this feels then similar to
targetvisu.
how to do this?
Add a CODESYS Project with webvisualisation and then:
Target VIsu is not possible but a good solution is on Rasbian(not Rasbian lite):
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
or sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
(depends on the installed RASBIAN Version)
lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@xset s off
@xset s noblank
@xset -dpms
I just spent the day installing two identical serial devices. One was a RS-485 dongle and the other an RS-485 to TTL adapter for a power supply. Both come up as an "QinHeng Electronics HL-340 USB-Serial adapter" with identical ID's according to "lsusb". The root problem was that occasionally, they would end up swapped. Since they are both identical, there was no distiguishing characteristics for my "udev" rules for the devices. Between this thread and some Linux sites I found a work around. I wanted to share it here in case it may help others, and also so that I can refer back to it after I forget how I made it work
In essence, instead of giving the device a permanent linux device, I gave a permanent linux device to the USB port. It seems each port on the Pi board has a unigue ID. This is shown below as port 1.2-1.5 at the following link: https://askubuntu.com/questions/49910/h ... ters#50412
Armed with this knowledge I then created and edited /etc/udev/rules.d/99-usb-serial.rules. This file contains the following:
The 1.5 device is my RS-485 dongle and the 1.3 device goes to the USB-TTL board.
Next I edited /etc/CODESYS_User.cfg. The following lines were added:
[SysCom]
Linux.Devicefile=/dev/ttyUSC
With this configuration the USB port number (as shown in the link), USB 1.5 will always be Codesys port 1. Likewise USB port 1.3 will always be Codesys port 2, etc. With the tests Ive performed, the comm adapter addresses are now tied to a USB "port" (or slot) rather than being first come first served. With all said and done the Modbus server connected to my dongle is now at (and as long as I dont change slots will be) com device 1. Likewise the Modbus at the other adaptor is and should remain comm 2. Long story short, I know what com port it is based on which slot the device is plugged into.
A word of caution, I dont know how this will act with a USB hub or device besides a com device. My thought is if it causes problems, delete the lines from usb-serial-rules that are not needed. Also, the devices seem to no longer be "hot swappable". From what I have seen a reboot is required if a device is removed and reinserted. Hope this helps someone else also.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
An example with an arduino mega as a modbus tcp slave with an ethernet shield. This example uses Analog pin 0 and pwm pin 5. These are connected to a webvisu meter and slider within the program Control_Stuff. Analog pins 0-7 and pwm pins 5-9 are available with the included sketch and project.
Have a look at our tutorial, where ATIM LoRaWAN device is used to uplink values to TTN network server : https://www.thethingsnetwork.org/labs/s ... tim-acw-xb
Hello, I searched a lot on codesys forge how to get the values of a barcodescanner into my codesys project.
I hava a barcodescanner which is configured as USB Virtual COM. On the linux terminal in "cat /deb/ttyACM0" I can see the scanner is sending the information of the QR-Codes. I want to send a command to scan and get the value of the code. I have a Manual in the attachments.
But I simply don´t know how to get the values in Codesys.
Which settings or tools do I need in Codesys? I have absolutely no idea. I dont understand the example projects. Can someone explain how I must go on? Probably with screenshots step for step?
Using OWFS to read onewire
Which device is used on this example
1-Wire Busmaster / USB Hostadapter DS9490R, Eco-Line; Art-Nr: 0167
Important links to bring it up:
DS9490R:
http://pdfserv.maximintegrated.com/en/d ... S9490R.pdf
http://owfs.org/index.php?page=usb-ds9490r
Info and wiring (Parasitic Power):
https://shop.wiregate.de/1-wire-bus
Installation:
https://www.raspberrypi.org/forums/view ... 9&p=505250
additional Infos:
https://www.fischer-net.de/hausautomati ... eil-2.html m
OWFS Pi.project [127.64 KiB]
Hello,
I like to read several 1wire Sensors. In this project it is only possible to read one sensor (sOneWireAdress := 'xxxxxxx').
Can someone help me to add some more sensor adresses?
regards, johannes
more posts ...
Raspberry Pi communication with Ethernet /IP Scanner and Adapter
EtherNetIP_Example_2Raspis.project [92.42 KiB]
Reading RFID's with an USB RFID reader.
(KKmoon Berührungslose 14443A IC Kartenlesegerät Kartenleser Card Reader mit USB Schnittstelle )
(Webvisu is mandatory for doing this - we use the visu key Event handling)
RFIDKeyEventHandler_RASPI.project [110.56 KiB]
Author: TON
Communiction with Sonos speakers
Program made with:
- PlayBar (Woonkamer)
- PLay 1 (Left)
- PLay 1 (Right)
- Sub (Subwoofer)
- Play 3 (Keuken)
- Play 1 (Badkamer)
- Play 1 (Slaapkamer)
Uses UDP socket for upnp Discover, TCP Server for events and TCP Client for commands.
Visualization for each group.
Display play status each group.
Control Play, Pause, Next, Previous each group.
Control Volume and Mute for each player.
See property each speaker by dialog.
Max 10 groups, 10 speakers with 3 satellites(LR, RR en SW).
Play doorbel
Functions:
- Find Sonos players with upnp discovery
- Find correct local ip if more then one network adapters
- Subscribe/Unsubscribe upnp events
- ZoneGroupTopology (for enumerate groups)
- AVTransport (get actual play status)
- RenderingControl (get volume/mute)
- Get XML player info
- Dialog box to display player info
- Webvisu. http://xxx.xxx.xxx.xxx:8080/webvisu.htm m
Sonos.projectarchive [851.95 KiB]
Author: TON
Push notification to Android/ios/desktop withPusover.
https://pushover.net/.
Push notification to your device with title, message, sound and application.
For $5 (once) you can push 7500 notifications per month.
With this account you can create notification for applications.
This application has name, token, icon,.. So you can create a clear structure.
In this example you see a notification for three applications.
I use this for over a year and works like a charm.
I just use some of the possibilities, there a more. See https://pushover.net/api.
Pushover.projectarchive [109.59 KiB]
Using an opcua python client for communcation with plc symbols (either on the same PI or remote PI)
How to use it:
1. Install OPCUA python:
sudo apt-get install python3-lxmlpip3 install opcua
2. download CODESYS Project to the Pi and start it:
Use the OPCUA Project from the Pi examples
"c:\Users\<windowsusername>\CODESYS Control for Raspberry PI\3.5.12.0\Examples\OPCUA.project"</windowsusername>
Sample Python OPC UA Client.py example for browsing the variables/symbols
simpleclientRaspi_write_SP13.py [1.95 KiB]
simpleclientRaspi_SP13.py [1.77 KiB]
simpleclientRaspi_write.py [1.95 KiB]
Sample Python OPC UA Client.py [2.17 KiB]
simpleclientRaspi.py [1.77 KiB]
This is an example using the Unicorn HAT:
How to add python script and download them to the Pi and execute them on the PI.
https://www.youtube.com/watch?v=R9x-QX2 ... e=youtu.be m
DownloadPythonScript_and_Exec_onPI.project [80.68 KiB]
This example shows how to use a port-expander PCF8574 I2C without library/device description
from the application code.
Control Christmas lights:
https://www.youtube.com/watch?v=6vsxV-Bj6-4 m
Weihnachtskrippe.project [104.73 KiB]
Could this be turned into a library? I'd love for a way to have the main program call a function block method using the program's I2C_master device.
I assume I should be passing the master as a variable for the function block, but I don't see how that could be achieved
Demo Project for VisuUaserManagement, show statistic who is logged in,
Change logged in user by iec code.
KeySwitch_VisuClient_Change_v1.project [462.01 KiB]
Using enocean with the Raspberry Pi
See:
https://youtu.be/mYaqMY8ddAk m
EnOceanRasPiExample.project [158.69 KiB]
RaspiEnocean.pdf [1.74 MiB]
How to use IO-Link devices with Ethercat and Gateway EL6224
https://www.youtube.com/watch?v=GadTtFrnUEc m
IO LinkRaspi_nurDevices.projectarchive [1.25 MiB]
IO LinkRaspi.project [213.61 KiB]
Play Sound on Raspberry PI. PiFace Interface is used.
RaspiSound_nonblocking Play several sound on the same time.
It uses the Omxplayer, should be installed.
Original post:
https://forum-de.codesys.com/viewtopic. ... 723#p18206 m
RaspiSound_nonblocking.project [131.8 KiB]
RaspiSound.project [130.82 KiB]
RaspiSound_nonblocking_stop.project [141.18 KiB]
Login by ssh to the PI:
dmesg | grep -i tty
to check which serial interface is available / connected
for example if you use USB which is connected to USB0 then it should /dev/ttyUSB in this config file
[SysCom]
;Linux.Devicefile=/dev/ttyS
If you use the serial port which is on the GPIO's (3.3V!) then you need to enable it in
sudo raspi-config ( Interface options - login shell disabled and serial hardware enabled)
User https://store.codesys.com/serial-com.html as example on how to use the serial port in CODESYS
even on Pi this is not really needed,
you could use on Raspian Stretch and use Chromium in full screen mode - this feels then similar to
targetvisu.
how to do this?
Add a CODESYS Project with webvisualisation and then:
Target VIsu is not possible but a good solution is on Rasbian(not Rasbian lite):
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
or
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
(depends on the installed RASBIAN Version)
lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@xset s off
@xset s noblank
@xset -dpms
@chromium-browser --noerrdialogs --kiosk --incognito http://localhost:8080/webvisu.htm m
CmpCharDevice snippet
RaspberryPI_CharDeviceSnippet.project [153.96 KiB]
Raspberry Pi: Play sound on Webvisu connected device:
SoundCheck_FileCopy_v1.2.project [883.41 KiB]
I just spent the day installing two identical serial devices. One was a RS-485 dongle and the other an RS-485 to TTL adapter for a power supply. Both come up as an "QinHeng Electronics HL-340 USB-Serial adapter" with identical ID's according to "lsusb". The root problem was that occasionally, they would end up swapped. Since they are both identical, there was no distiguishing characteristics for my "udev" rules for the devices. Between this thread and some Linux sites I found a work around. I wanted to share it here in case it may help others, and also so that I can refer back to it after I forget how I made it work
In essence, instead of giving the device a permanent linux device, I gave a permanent linux device to the USB port. It seems each port on the Pi board has a unigue ID. This is shown below as port 1.2-1.5 at the following link:
https://askubuntu.com/questions/49910/h ... ters#50412
Armed with this knowledge I then created and edited /etc/udev/rules.d/99-usb-serial.rules. This file contains the following:
SUBSYSTEM=="tty", ATTRS{devpath}=="1.5", SYMLINK+="ttyUSC0"
SUBSYSTEM=="tty", ATTRS{devpath}=="1.3", SYMLINK+="ttyUSC1"
SUBSYSTEM=="tty", ATTRS{devpath}=="1.4", SYMLINK+="ttyUSC2"
SUBSYSTEM=="tty", ATTRS{devpath}=="1.2", SYMLINK+="ttyUSC3"
The 1.5 device is my RS-485 dongle and the 1.3 device goes to the USB-TTL board.
Next I edited /etc/CODESYS_User.cfg. The following lines were added:
[SysCom]
Linux.Devicefile=/dev/ttyUSC
With this configuration the USB port number (as shown in the link), USB 1.5 will always be Codesys port 1. Likewise USB port 1.3 will always be Codesys port 2, etc. With the tests Ive performed, the comm adapter addresses are now tied to a USB "port" (or slot) rather than being first come first served. With all said and done the Modbus server connected to my dongle is now at (and as long as I dont change slots will be) com device 1. Likewise the Modbus at the other adaptor is and should remain comm 2. Long story short, I know what com port it is based on which slot the device is plugged into.
A word of caution, I dont know how this will act with a USB hub or device besides a com device. My thought is if it causes problems, delete the lines from usb-serial-rules that are not needed. Also, the devices seem to no longer be "hot swappable". From what I have seen a reboot is required if a device is removed and reinserted. Hope this helps someone else also.
Autor: nikk4s
Date: 28.01.2019
Version: 1.0.0.0
Link to the post: l viewtopic.php?f=23&t=9483 l
An example with an arduino mega as a modbus tcp slave with an ethernet shield. This example uses Analog pin 0 and pwm pin 5. These are connected to a webvisu meter and slider within the program Control_Stuff. Analog pins 0-7 and pwm pins 5-9 are available with the included sketch and project.
mega_mudbus_analog_slave.zip [80.59 KiB]
Autor: wollvieh
Date: 03/2019
l viewtopic.php?f=23&t=9628 l
Small Sample program writing a CSV file on the raspberry
under /home/pi/Desktop/test.csv.
CSV_Writer.project [135.55 KiB]
Autor:bqSNIR
Date: 03/2019
l viewtopic.php?f=23&t=9427 l
Have a look at our tutorial, where ATIM LoRaWAN device is used to uplink values to TTN network server :
https://www.thethingsnetwork.org/labs/s ... tim-acw-xb
Find in attachement, our CoDeSYS project file.
storyCodesys.project [144.77 KiB]
..
Hello, I searched a lot on codesys forge how to get the values of a barcodescanner into my codesys project.
I hava a barcodescanner which is configured as USB Virtual COM. On the linux terminal in "cat /deb/ttyACM0" I can see the scanner is sending the information of the QR-Codes. I want to send a command to scan and get the value of the code. I have a Manual in the attachments.
But I simply don´t know how to get the values in Codesys.
Which settings or tools do I need in Codesys? I have absolutely no idea. I dont understand the example projects. Can someone explain how I must go on? Probably with screenshots step for step?
I am German, if you want to answer in German.
here the manual