IO interface with Arduino over Ethernet

More
15 Feb 2017 07:57 - 15 Feb 2017 07:58 #87986 by mariusl
Have a look at the server side code as well to see that the Arduino is configured on the fly at startup. It does not know the pin type or direction or pullup value when it starts itself. So things seem to bee a bit disjointed if you only look at one side of the code.
There are some files included further up in this thread.

Regards
Marius


www.bluearccnc.com

Last edit: 15 Feb 2017 07:58 by mariusl.

Please Log in or Create an account to join the conversation.

More
15 Feb 2017 10:02 #87989 by DocStein99
Ok I'm getting the hang of it. I'm having trouble with network transmissions from Arduino to the python script. I can manage to clean up the Arduino code pretty tight, so that it sends the whole packet in one line, instead of spreading across the code causing fragmentation (for reasons unknown - is my first esp8266, and uncertain I soldered the circuits without noise).

I'm trying to go over the python part - and learn that language at the same time, struggling to get print() & debug messages out to the screen. At the moment, is returning an error on that "recv(150)" command.

Please Log in or Create an account to join the conversation.

More
15 Feb 2017 10:48 #87990 by mariusl
The main problem is not the speed at which you can send the message or receive the message on either side. You will find that the servo loop running on linuxcnc does not have sufficient time to decode complete messages at every pass. You get lag or buffered data that makes it very difficult to do timing dependent I/O.

Optimizing the code is a fruitless endevour as the results will remain the same in the end. Sorry chap but this whole thing was meant to be a test to see what one can get out of the system and many have tested it ending up with the same results.

Dont stop your efforts though as you will learn a lot about the inner workings of Linuxcnc if you try to make improvements.

Keep us posted here.

Regards
Marius


www.bluearccnc.com

Please Log in or Create an account to join the conversation.

More
15 Feb 2017 10:52 #87991 by mariusl
There is a lot of debug prints in the Python code already. If you run linuxcnc from a terminal you will see the output of the component.

Regards
Marius


www.bluearccnc.com

Please Log in or Create an account to join the conversation.

More
15 Feb 2017 13:50 #87996 by DocStein99
I'm using a core i5 at 64 bits. The number of operations executed in an idle millisecond are way more than I need to UDP messages for push-buttons and LED indicators..... I'll figure it out. My roadblock is learning this python language.

I ran halcmd from a terminal. Also executed the code directly from the prompt, hal on a different process. I've tried what I thought was obvious at first, going through debugging and logger imports.... Argh, I spent too much time on this tonight - need to give it a break. At least I made some progress.

Please Log in or Create an account to join the conversation.

More
15 Feb 2017 19:53 #88015 by mariusl
There are many good tutorials for Python on the web. Python syntax is what makes it work so knowing that is important. I suggest that you find a good tutorial ans start there.

Here are two to look at
docs.python.org/3/tutorial/
www.learnpython.org/

Regards
Marius


www.bluearccnc.com

Please Log in or Create an account to join the conversation.

More
16 Feb 2017 05:11 #88036 by DocStein99
Ok I made some more progress. It's all about a good test platform here, and knowing the exact data that is transmitted between the two devices - and timing, etc... It's about the speed I can deliver the data into the python script. So I have to spend a day tooling around with a network router/hub-switch with a 3rd computer loaded with wire-shark in "promiscuous mode" to analyze the network packets.

It's alot of work and testing, but it's worth it. I've used linuxCNC for many years, with a big fat cable and about 2-dozen wires running from a metal control panel into the electric cabinet - for me to trip over and get caught on each and every object in the workshop.

Please Log in or Create an account to join the conversation.

More
03 Mar 2017 12:41 #88923 by M4MazakUser
as you wrote..
( The main problem is not the speed at which you can send the message or receive the message on either side. You will find that the servo loop running on linuxcnc does not have sufficient time to decode complete messages at every pass. You get lag or buffered data that makes it very difficult to do timing dependent I/O.)
soo how do the mesa ethernet cards do it?
if there was a method of using arduino over a network card, it would bring a whole swag of interest into linuxcnc !
even if you needed a uno per axis, -a uno from china is only $5...whereas a mesa card (ive used them and they are brilliant) is over $100 us -plus you usually need daughter cards.

Please Log in or Create an account to join the conversation.

More
06 Mar 2017 02:58 #89082 by DocStein99
I'm clocking great speeds now, through the ESP 8266, using Arduino into the python script, to the HAL pins. Mesa cards solve problems for people with more money than time.

Please Log in or Create an account to join the conversation.

More
06 Mar 2017 08:29 #89086 by M4MazakUser
so.. going to post any code/setup notes? ---very keen.

Please Log in or Create an account to join the conversation.

Time to create page: 0.217 seconds
Powered by Kunena Forum