Author Topic: Controlling Raspberry Pi using AHMI  (Read 8736 times)

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Controlling Raspberry Pi using AHMI
« on: September 07, 2015, 11:12:25 PM »
Hi

I am extremely new to Advanced HMI and I am running it on a Windows 7 PC. I wanted to know if it is possible to control a Raspberry Pi using the Advanced HMI on my PC, such as turning on/off LEDs connected to the RPi or other things like that. I am aware that AHMI can be run on a RPi to control a PLC, however, can it control a RPi while running on a Windows computer/laptop ?

Thanks in advance for the responses.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Controlling Raspberry Pi using AHMI
« Reply #1 on: September 08, 2015, 12:07:05 AM »
Not necessarily AdvancedHMI, but this may be something that may lead you to the right direction:

https://github.com/andycb/PiSharp

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #2 on: September 08, 2015, 09:41:10 AM »
Thanks for the response Archie. So what you mean is adding the PiSharp.LibGpio.dll file to the Visual Studio project and then using it from within Advanced HMI (I don't even know if that is possible) or just using Pi# as a standalone program ?

Thanks

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Controlling Raspberry Pi using AHMI
« Reply #3 on: September 08, 2015, 09:53:37 AM »
Do you want to run the HMI on a separate PC or directly on the Raspberry Pi?

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #4 on: September 08, 2015, 10:15:29 AM »
The HMI will be running on a separate Windows 7 PC and I want to control a Raspberry Pi which is connected to the Ethernet. The RPi has some inputs and outputs connected to it, and I want that I can control that from my Windows PC using Advanced HMI

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Controlling Raspberry Pi using AHMI
« Reply #5 on: September 08, 2015, 10:22:20 AM »
PiSharp wouldn't be the solution. You would need some kind of program running on the PI that can listen for communications from AdvancedHMI and translate those messages into control of the IO pins.

The most likely easiest to find would be a library that implements Modbus.You would need a Modbus server (slave) application. Maybe something like this:

http://jacekhryniewicz.wix.com/website#!raspberry-pi-with-modbus-tcp/c1d2y

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #6 on: September 08, 2015, 10:31:16 AM »
Thanks for the help Archie. I will try looking into it. Will keep you posted.

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #7 on: September 11, 2015, 10:26:18 AM »
Hi Archie

I tried out the Kepware Modbus TCP/IP server on my PC and the pymodbus library on the RPi and I do have some sort of communication established. It is reading the 5 holding registers and I see the values on the Kepware window on my PC. Would you be able to point me in the right direction regarding now connecting Advanced HMI to the RPi and communicating with the RPi through AHMI ?

Thanks a lot

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #8 on: September 11, 2015, 12:39:06 PM »
Aviraj,

Since you have a Pi, would you ever mind testing a solution posted here: http://advancedhmi.com/forum/index.php?topic=938.0

You would have to load and run it directly on the Pi (if your setup allows that).

I am just curious of whether it works and I don't have a Pi to test it.

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #9 on: September 11, 2015, 03:30:55 PM »
Sure I can do that. I have downloaded the .zip folder , not really sure how to proceed after that in Raspberry Pi. Will be glad if you could tell me the steps to run it on the RPi.

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #10 on: September 11, 2015, 03:31:58 PM »
Also, I got Advanced HMI to connect to my Raspberry Pi and I can actually control GPIOs on the RPi and even outputs on the PiFace module through AHMI running on my PC.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #11 on: September 11, 2015, 05:03:47 PM »
The steps to run AHMI directly on the Pi can be seen here:

http://advancedhmi.com/forum/index.php?PHPSESSID=5b260fdc0b31f8680e52361ebd719710&topic=666.0

By doing this test you would actually learn how to run any AHMI project directly on the Pi. If you decide not to go ahead with this, I will understand and bug somebody else to try it.

If you already have mono-complete and mono-vbnc installed on the Pi then you can just follow steps 8, 9 and 10.

The solution that you downloaded is set to have pins 18 and 22 as inputs, pins 11, 13, 15 and 16 as outputs. If your Pi is setup differently then I can modify the solution or just let you know of how to do it.

This program, when run, should have output pins "high" if both inputs are "low" (check the AHMI screen since it shows how the pins are organized).

Let me know if you DON'T feel like doing this or if you decide to go ahead then what other info I would need to provide.

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #12 on: September 14, 2015, 10:13:08 AM »
Hi Godra

I was trying to run the solution on my RPi and I get an error saying "The entry point method could not be loaded"

Aviraj

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #13 on: September 14, 2015, 01:44:06 PM »
It was a vbnc issue for some reason. Re-installing it fixed the issue. However, I am seeing the following messages now:

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Controlling Raspberry Pi using AHMI
« Reply #14 on: September 14, 2015, 05:36:28 PM »
Aviraj,

Thank you for testing this solution.

If you want to give it another try, I have attached 2 files (export and unexport) that you should copy to /tmp/RasPiGpioTest/ folder on the Pi. I thought these files would be created automatically but I was wrong.

If you run the program after you copy files then those warnings might still remain but if errors continue just post them but I will not bug you to do any more testing.

If you don't feel like doing this either that is fine with me.