Raspberry Pi: List of available example applications

Runtime
2015-06-19
16 hours ago
1 2 > >> (Page 1 of 2)
  • Moderator3S

    Moderator3S - 2015-06-20

    -How to use Oscat calendar and timer2 for starting Outputs once a day or only on specific weekday
    -How to Show the raspberry pi current ip address on / internal visu and webvius page
    -Rotate bitmap in visu

    IMG: ShowPI_IPADDR.jpg

    TimerExample2.project [147.6 KiB]

     
  • Moderator3S

    Moderator3S - 2015-06-20

    Beside CAASerialCom using Syscom.library is possible too.
    Here is the example for it.
    (See l viewtopic.php?f=21&t=5699 l for CAASerialCom example)

    on Linux side you need to indentify your serial port and activate it in /etc/CODESYSControl.cfg

    How to do this:
    1. you need to check on linux side which tty port is available.

    Example a USB to serial converter:
    Check under Linux with 'dmesg' which device is used for it:

    in my case it reports: ttyUSB0

    so you need to add in /etc/CODESYSControl.cfg
    (Attention you need to remove the 0 from USB0)

    [SysCom]
    Linux.Devicefile=/dev/ttyUSB
    portnum := COM.SysCom.SYS_COMPORT1;

    this was the pi side under Linux

    1. then after reboot or restart plc, you could communicate via serial com

    SysComTestRaspi.project [50.56 KiB]

     
  • Moderator3S

    Moderator3S - 2015-06-20

    Example how to use SoftMotionLight with Raspberry Pi.
    (no realtime is needed for SoftMotionLight - drive should support DS402)
    Check your drive for SoftMotionLight capability with:
    "c:\Program Files (x86)\3S CODESYS\CODESYS\Projects\SoftMotion\SoftMotionLight\SML_CompatibilityCheck_DS402.project"

    SML.project [89.44 KiB]

     
  • Moderator3S

    Moderator3S - 2015-08-05

    FTP Client example.
    (OSCAT Network and OSCAT Basic is used)

    FTPCLient.project [156.61 KiB]

     
  • Moderator3S

    Moderator3S - 2015-08-06

    Read ProcessorTemperature of the Pi and Show cpuinfo in IEC -
    add in /etc/CODESYSControl.cfg the [SysProcess] section
    Output of the executed command will be filled into pszStdOut

    IMG: security.jpg

    IMG: cpuinfo.jpg

    SysProcessExecuteCommand2.project [211 KiB]

     
  • Moderator3S

    Moderator3S - 2015-12-31

    here I can show example of saving INT values int txt file on Raspberry Pi SD

    I have used pymodbus TCP to create modbusMaster(client) on port 503, with 10 holdt_register and 10 input_registers
    in Cosesys v3 create ModBusSlave TCP also with 10 holdt_register and 10 input_registers,

    if raspberry pi shut down , at start you can get 10 int values from file vars.txt on SD

    How to make start at boot pymodbus master(client)

    using PuTTY:
    #sudo nano /etc/init.d/autorun

    and paste text from autorun.txt
    Ctrl + x
    y
    Enter

    #sudo chmod 777 /etc/init.d/autorun
    #sudo update-rc.d /etc/init.d/autorun defaults

    #cd /home/pi/Documents/pymodbus/examples/common

    root@raspberrypi:/home/pi/Documents/pymodbus/examples/common# sudo nano test.py

    and paste text from test.py.txt
    Ctrl + x
    y
    Enter

    before ShutDown RaspberryPi Download CodesysProject and try:

    #sudo /etc/init.d/autorun start

    output:

    Starting autorun
    done
    wait to start ethernet , wait for Codesys Slave to start 20sec
    cycle: 1
    Input0: 57648
    Input1: 57649
    Input2: 57650
    Input3: 57651
    Input4: 57652
    Input5: 57653
    Input6: 57654
    Input7: 57655
    Input8: 57656
    Input9: 57657
    line0: 57648
    line1: 57649
    line2: 57650
    line3: 57651
    line4: 57652
    line5: 57653
    line6: 57654
    line7: 57655
    line8: 57656
    line9: 57657
    cycle: 2

    IMG: CodeSys_v3Sceen.png

    WebvisuMBtcpSlave.project [478.19 KiB]

    steps DB master.txt [4.24 KiB]

    test.py.txt [3.47 KiB]

    autorun.txt [910 Bytes]

     
  • Moderator3S

    Moderator3S - 2017-01-04

    In this project eth1 interface is used for the profinet connection to the ProfinetMaster
    you need to add in /etc/CODESYSControl.cfg (Version <3.5SP12)

    = 3.5Sp12 /etc/CODESYSControl_User.cfg

    [SysSocket]Adapter.0.Name="eth1"Adapter.0.EnableSetIpAndMask=1

    and execute in the Linux console

    <3.5Sp13
    ifconfig eth1 promisc
    das in /etc/rc.local einbauen

    If you use a Pi3B+ you Need the following steps:

    Using VLAN-Tags Need to be enabled:

    sudo apt install vlan # install VLAN-Packetsudo modprobe 8021q # load 8021q Kernelmodul

    for having this in every Startup automatically:

    sudo su -c 'echo "8021q" >> /etc/modules'

    2RaspiProfinetController_PNDevice.project [100.18 KiB]

     
  • Moderator3S

    Moderator3S - 2017-01-11

    Read the onewire sensor in an own onewire Task / scan connected sensors

    Rescan while running is possible by reset - x
    IF NOT x THEN
    x := TRUE;
    //scan function
    Onewire_master.Scan();
    FOR ui:=1 TO MIN(Onewire_master.uiScannedDevices, 20) DO
    astrID[ui] := Onewire_master.pasScannedDevices^[ui-1].StringRepresentation;
    //dynamic write the scanned sensors to the configuration
    DS18B20.ID := Onewire_master.pasScannedDevices^[ui-1];
    END_FOR
    END_IF

    actDate := DS18B20.stdTimeStamp;
    SysTimeRtcConvertDateToUtc(actDate,dwActDate);
    dtTimestamp := DWORD_TO_DT(dwActDate);

    IMG: onewireproject.jpg

    Onewire_twoTasks.project [74.01 KiB]

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.