Connecting to a Rpi2

Annihilist
2015-09-21
2015-10-28
  • Annihilist - 2015-09-21

    Hello, Codesys Forum. There is a lot of great information on this site and other places, but since I'm inexperienced with Codesys, Linux, and the RPi I run into a lot of the simplest problems; problem's that are frustrating since its likely just common sense to others here.

    The Problem:
    I don't know how to connect my RPi to the demo Codesys application on my windows 7 laptop. Under the Device tab in Codesys, I can scan my network but nothing shows up. I have internet connection via a WiFi dongle and I've tried directly typing in its IP address into the text box where it normal says my laptops name. My only experience with connection a PLC to my laptop was with a Serial-to-USB Connection, otherwise I have no idea what the PI needs. I've seen a few videos on Youtube, but they don't show the steps that I am missing.

    What I have set up so far:
    -Extracted Img file of codesys to SD card for the RPi
    -Downloaded the latest version on codesys on my laptop with the RPi package.
    -Setting up the PI with a monitor and keyboard to log in and get to desktop and seeing if I have internet connection.

    https://www.youtube.com/watch?v=_MeQBfQObgk

    For those who are curious, here's what I'm doing:
    In my class we are doing final projects that require some form on PLC to make it function. As long as Ladder logic based programming is used we are good to go. Instead of going out and buying a PLC, I've decided to see if something like the Raspberry Pi or Arduino could accomplish what I need.
    From scouring the internet for the last month, I found that Codesys is likely my best option for doing what I want. What I want to do is control 3 or 4 relays and use one or two temperature sensors so I can set up a heat regulating melting pot for a small soap making hobby/business that I have. Kind of simple, but I'm hoping I can add various things such as being able to put out certain amounts of liquid into a container on the push of a button and some other things. However, the more I read about the limitations of the Raspberry PI's GPIO's the more I think it’s not such a good idea and perhaps using a normal PLC would be best. Just thinking out loud at this point, any opinions would be greatly appreciated.

    Thank you to those who make projects like this possible!

     
  • eschwellinger

    eschwellinger - 2015-09-22

    Hi,
    I'm sure CODESYS and the Raspberry Pi is the right tool and device for your application.

    For me it sounds like you are missing the step to install the plc runtime to the
    raspberry pi (this is meanwhile different to this video which you point to):
    See the FAQ's
    l viewtopic.php?f=22&t=6345#p12791 l

    After doing this you should be able to scan the Pi by CODESYS and login and use the example projects:
    https://www.youtube.com/watch?v=6FPf3RHWyeU

    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\2.2.0.2\Examples\Webvisu.project"
    See the pdf from store download for more details on these projects:</yourwindowsusername>

    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\2.2.0.2\DataSheet\RaspberryPI_en.pdf" </yourwindowsusername>

    If this does not solve your problems please send an email to e support@codesys.com e

    BR
    Edwin

    RaspberryPI_en.pdf [1.36 MiB]

     
  • mkeller - 2015-09-22

    Hi.

    Are both devices (laptop and RaspPi) connected through WiFi?

    Some WLAN router/bridges support the feature "Wireless AP/Client Isolation" which prevents the clients of a WLAN to talk to each other. To rule that out please connect both devices by Ethernet cables to a switch.

    BR
    Martin

     
  • christos - 2015-09-29
    1. download Codesys Development system and install
    2. download Codesys package and install in development system Tools->Package manager->install
    3. write raspbian image on sd card
    4. put sd card in raspberry pi and startup
    5. Expand Filesystem and exit
    6. write sudo nano /boot/config.txt remove # infrot of dtparam=i2c_arm=on, dtparam=spi=on, dtoverlay=w1-gpio-pullup,pullup=1 Ctrl X to save
    7. sudo reboot then go to you pc
    8. Tools -> update raspberry pi -> write password : raspberry if you havent change it -> scan it should come up -> OK
    9. Done
    10. If you want i have written a manual in Swedish you can probably use google translate on it.

    //Christos

     
  • Annihilist - 2015-10-27

    @Edwin Schwellinger
    Thank you, it seems my only problem is updating the pi from codesys.

    @M.Keller
    Yes they are connected through Wifi; or at least I think so. They are both connected to the internet on the same network and my laptop has a virtual network connection for the Pi. Would the VNR rule out the Wireless AP/Client Isolation? The network at this place is odd, and I simply don't know how to connect them to switches with Ethernet cables. I'll get another cable so I can figure out how to do that.

    @christos
    Thank you for that! I formatted my card again and tried everything you said. I am curious about that step 6 is about; I'm not sure if I did that correctly either. I would appreciate seeing the manual you wrote, especially if it has something to do with connecting my devices since I am stuck on step 8, my raspberry pi does not come up after clicking scan, even if I directly put in the IP address of the Pi.

    Can anyone think of what I'm missing here or what I can try?
    And how can I tell if the Pi is updated when it works? I thought I had the Pi updated on different wireless network but it didn't seem to do anything so I rage quit for awhile hahaha.

     
  • eschwellinger

    eschwellinger - 2015-10-28

    Hi,

    Step1:
    I would recommend to login to the Pi by ssh (use putty for doing this)
    then excute
    top
    here you should see if the runtime on the pi is started/running - there is a task codesyscontrol.
    or alternatively you could execute:
    cat /tmp/codesyscontrol.log

    Step2: (If codesyscontrol is running on the pi, verified by step 1)
    Use the Pi Gateway to Login (not the Gateway which is running on your pc)
    Add a new Gateway with the IP of the Raspberry Pi, Switch the Gateway to use it for scan
    - after doing this you should see the pi on scan via the remote Gateway which runs on the PI.

    BR
    Edwin

    IMG: UsePIGateway.jpg

    IMG: switchGateway.jpg

     
  • Annihilist - 2015-10-28

    I login to the Pi with a monitor and keyboard. The VNC was mostly for fun and to see if I had connection between my laptop and Pi. Thank you for recommending putty, I'll have use for that later.

    So is Christos correct? I have the idea that the raspberry pi update is the method I use to get the runtime onto the Pi. Is there a different way to get the runtime onto the pi? That is my problem as of right now. I'm starting to think I have the wrong idea of what is doing what.

    I'll definitely use your method of checking that when I think the runtime is there.

    IMG: RPI Scan.JPG

     
  • eschwellinger

    eschwellinger - 2015-10-28

    Hi,
    Login by ssh by putty - this makes sure that the upate process could work either

    In general you have 3 Options:
    1. The Update Raspberry Pi command in CODESYS: Use 'Update Raspberry Pi' the Raspberry Pi should be conected to the same network
    than your CODESYS PC.
    This command will then install the CODESYS plc runtime to the Raspberry Pi.
    If you do not have a etwork connection to both CODESYS PC and Raspberry Pi this will not work.

    1. Copy the Debian File to the pi: Use scp to copy the Debian file to the pi and install it
      Where do you find the debian package which contains the plc runtime: "c:\Users\YourWindowsUserName\CODESYS Control for Raspberry PI\codesyscontrol_arm_raspberry_V3.5.7.x.deb"

    2. you have the option (without having a network connection) to install the runtime
      by copy it to the sd card (which you plug into the Windows PC).
      Where do you find the debian package which contains the plc runtime:"c:\Users\YourWindowsUserName\CODESYS Control for Raspberry PI\codesyscontrol_arm_raspberry_V3.5.7.10.deb"
      then boot with this sd card (Rasbian from RaspberryPi.org have been already installed before you have copied the debian package to it)
      then execute:
      sudo dpkg -i /boot/codesyscontrol_arm_raspberry_V3.5.7.10.deb

    Hope one of these options are useful to install the plc runtme.

    BR
    Edwin

     

Log in to post a comment.