This site uses cookies for functional purposes. To continue please read and agree to our Data Privacy.

By closing this message, you consent to our use of cookies on this device.

  1. Noah Greene
  2. PLCnext Technology & PLCnext Controls
  3. Tuesday, 13 March 2018
  4.  Subscribe via email

Has anyone tried to dabble with using python on the AXC 2152?

What was the application and did you have any success?

Accepted Answer
Martin PLCnext Team Accepted Answer Pending Moderation
1
Votes
Undo

I tried Python with the AXC F 2152 mid-last year, at the start of the Early Adopter program.

One of our customers is investigating Machine Learning using Python, so I was hoping to install something like SciPy for them. The recommended installation method is to use pip (Python's standard package manager). But pip doesn't seem to be included with PLCnext. So I tried installing pip using the get-pip.py script. I ran into problems there with something I can't quite recall ... I do remember spending several hours installing a whole string of dependency packages by hand, but eventually I hit a dead-end. So I didn't get too far. I left it hoping that a future PLCnext firmware release would include pip, or at least that someone would find a way of installing it.

My Python skills only extend to a semester of lectures and assignments in college, so I may be missing something obvious.

- Martin.

Phoenix Contact Electronics Headquarters - Support Center

Frank PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Moved to PLCnext thread.

We've many requests regard Python and have it for evaluation on stack (Phoenix Contact Electronics Headquarter) but had unfortunately not time to do some tests.

Maybe someone else has already made experiences?


Phoenix Contact Electronics Headquarter - Support Center

Vincent PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi ngreene,

 

Basically Python3 is on the target. It greatly depends on which dependencies you are focussing on. Did you have anything in mind, if so, please let us know, so we can see if we can shed some light onto the way to get those deps going.Like scikitlearn, django, simplehttp, ...

 

Cheers 

 

 

Phoenix Contact Netherlands - Technical Consultant

Noah Greene Accepted Answer Pending Moderation
0
Votes
Undo

There was an idea thrown out here to use the USB-C port on the controller to control an LED strip.  I'm thinking it could be programmed to flash in different colors/patterns using python.  

This post was honestly just a soft question to see if anyone has had success with doing anything with it.

Dzmitry Ivaniuk Accepted Answer Pending Moderation
0
Votes
Undo

Maybe better use Lua? We had some success using it for our tasks.

Vincent PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Ledstrips are always nice, but  i'm wondering, if you'll be able to run the Ledstrip via the USB-C port, I don't think you can use it for general purposes.

 

 

Phoenix Contact Netherlands - Technical Consultant

Noah Greene Accepted Answer Pending Moderation
0
Votes
Undo

I'm not sure if the USB-C is general purpose either.  Doesn't hurt to find out.

cgebhardt@cadfem.de Accepted Answer Pending Moderation
0
Votes
Undo

Hello,

similar question from my side: I would like to send MQTT packages via a python script and need MQTT libs. Is there any advice in the meantime, how to install pyhton packages? With pip/ensurepip I was not able to install...

Thanks in advance

Christof

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hello Christof,

Since my earlier post in this thread, I've discovered the ipkg package manager, and it looks like this can be used to help with python projects on the AXC F 2152.

Outline of the procedure you should try:

- Install ipkg package manager, following the procedure shown in this video.

- Use ipkg to install python27:

ipkg install python27

- Install pip (python package manager):

ipkg install py27-pip

- Now use pip to install your mqtt package, for example:

pip install paho-mqtt

 ==================================

Please give this a try and let us know how you get on.

- Martin.

Phoenix Contact Electronics Headquarters - Support Center

cgebhardt@cadfem.de Accepted Answer Pending Moderation
0
Votes
Undo

Hello Martin,

great, that was the missing information. In general, I'm not a fan of videos, that's why I just have overseen this great and helpful explanation.

Thanks a lot. That's perfect.

 

Have a good holiday season.

Christof

 

cgebhardt@cadfem.de Accepted Answer Pending Moderation
0
Votes
Undo

Hi,

 

with Martin's help, I was able to make some steps forward. I was able 

- to install ipkg

- to install pip3

- to install openSSL

- to install paho-mqtt

- to install AWSIoTPythonSDK

 

Where I struggle right now is running my python3 script, which should send some data via MQTT to an AWS Broker. The first line with an "import of json" fails ("no module named json").

 

Does somebody have a hint for me?

Best regards

Christof

 

 



 

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Christof,

Some of this answer will be speculation, because I didn't bring an AXC home with me for Christmas ...  :)

I'm guessing that the version of Python 3 that is factory-installed on the AXC is a minimal version that doesn't include the required json module.

When you installed the py3-pip package using ipkg, I'm guessing it also installed python3 as a dependency, since ipkg doesn't realise that python 3 is on the PLC already. The version of python installed by ipkg (in the /opt/ directory, I think) may be the "complete" version that does include the json module you need. You didn't say what command you are using to start python, but you should make sure that the python you are starting is the one installed by ipkg (in the /opt/ directory), not the factory-installed python. You may want to update some sym-links to make this easier.

Hope this helps.

- Martin.

Phoenix Contact Electronics Headquarters - Support Center

cgebhardt@cadfem.de Accepted Answer Pending Moderation
0
Votes
Undo

Hi Martin,

sorry for the late answer; I only have certain periods of time to follow up this project. 

For me, you are the Hero of the Month. Your answer was completely right. Perfect.

With the other python in /opt/bin , my script is running now and I am able to send data from the PLCnext to the AWS IoT Platform. Great, that's really great. 

Thanks a lot. 

Super.

Christof

 

 

 

 

  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

We have 65 guests and 2 members online