Interger/ Float data input from/ to Arduino

More
02 Nov 2021 16:07 #225005 by rajsekhar
Hello..everyone.

I am trying to prepare a oxyfuel torch height controller with a TOF VL53LOX sensor. After few days effort with arduino coding to filter the readings, finally it is producing stable INTEGER value upto 1mm resolution. 1mm is acceptable from the process point of view. I am using serial communication via USB between arduino & computer (Linuxcnc installed).

Now, I planned to feed this deviation in the INTEGER value from Arduino to LINUXCNC Z axis position command to compensate the gap difference between plate and nozzle.

In addition to this, I had planned to control another stepper from velocity command data of X-Y axis to maintain the sensor in cutting direction just like tangential control. This require float data from LINUXCNC to arduino.

But, How those are possible??

Resources I have: 1 no. chinese parallel port breakout board, 1 C10 bi directional parallel port breakout board, 1 arduino UNO

Thanks in advance for any help.

 

This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:

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

More
02 Nov 2021 16:59 - 02 Nov 2021 17:00 #225017 by PCW
You can convert from integer float in hal with these components:


conv_s32_float
conv_u32_float

So the Arduino can send integer values and linuxCNC can convert them to floats
in the hal file, but for what you are doing, you probably want to use external offsets
which are specified as integers.
Last edit: 02 Nov 2021 17:00 by PCW.
The following user(s) said Thank You: rodw

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

More
06 Nov 2021 16:27 #225508 by rajsekhar
Replied by rajsekhar on topic Interger/ Float data input from/ to Arduino
thanks for the reply.

But how Arduino can send integer data to Linuxcnc? what is the exact mechanism?

I followed some posts and installed HAL/Python from Jeff Epler. But that is not serving my purpose. It is allowing to receive analog signals to arduino analog pins and then connecting the same to Arduino HAL pins.

Although I want the interger data, that I am receiving/watching in Arduino IDE serial monitor from my sensor, directly to HAL pins.
As I am not a computer programming expert, anyone worked on such idea may please help.

Thanks.

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

More
06 Nov 2021 19:14 #225519 by Henk
Maybe you can try the modbus route. I'm not in front of a PC now but I played around with it using a Uno. You should find the example with a quick search. 

If I recall correctly you can send and receive float values.

Henk

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

More
06 Nov 2021 19:19 #225521 by Henk
github.com/LinuxCNC/linuxcnc/tree/master...omps/mb2hal/examples

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

More
08 Nov 2021 03:57 #225621 by rajsekhar
Replied by rajsekhar on topic Interger/ Float data input from/ to Arduino
Friends,

I succeeded in importing serial data to Python..lot of video tutorial in youtube.

But the
"import hal" is not working in Python3.9.2. So, creating new HAL pin could not be done.
I tried so many suggesstions online.

"pip install hal" command is yielding some red lines in terminal, but nothing installed.

Any help is welcome.

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

More
08 Nov 2021 13:40 #225687 by andypugh
Replied by andypugh on topic Interger/ Float data input from/ to Arduino
HAL is not a separate package, but should be available if LinuxCNC is installed.

Is it the case that the examples here do not work too?
linuxcnc.org/docs/2.8/html/hal/halmodule.html

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

Time to create page: 0.119 seconds
Powered by Kunena Forum