Connect linuxcnc with STM32 or ESP32

More
04 Jun 2021 07:45 #211129 by TheRoslyak
Good day.
Tell me how you can connect signals from the controller to linuxcnc.
I have the first controller with IMU that sends a bluetooth signal to another controller connected to linuxcnc.
Question number one: What is the best way to commute a controller with linuxcnc.
- Connect linuxcnc with com port and send value by UART.
- Connect linuxcnc with analog input by (Ethercat Beckhoff EL30** or analog input like MESA (if such exists)).
- Program the controller as USB HID and connect with linuxcnc
- Or etc
Can you give tips or guides on how to do something like this? And which way is better?

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

More
04 Jun 2021 08:00 - 04 Jun 2021 08:05 #211130 by BeagleBrainz
UART is pretty easy and has been discussed a while back.
forum.linuxcnc.org/18-computer/23166-arduino-i-o-with-linuxcnc

As a USB HID controller is doable, you need to find a USB stack for your MCU

I used LUFA USB stack from here www.fourwalledcubicle.com/index.php with an Arduino Leonardo a while back.

More Arduino related stuff
www.oz1jhm.dk/content/linuxcnc-and-arduino
emc2arduino.wordpress.com/

ESP32 with ethernet
You could try this github.com/Deotti-cl/linuxcnc-esp32
and modify the code to do just I/O rather than stepgen. Decide how you want to pack the data in a packet and off you go. Technically you could decide on how you pack the data and really whether you send it via blue tooth, UART, Ethernet or smoke signals would not matter.
Last edit: 04 Jun 2021 08:05 by BeagleBrainz.

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

More
04 Jun 2021 13:37 #211156 by TheRoslyak
Ok Thank you so much.
I decided to go first way.
But I can't understand How to compile serialreceive.comp.
I try to compile this file and get this (pic1) -> then in *.hal I get (pic2)
Attachments:

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

More
05 Jun 2021 00:14 #211183 by scotta
You might be interested by Remora. It's LPC1768 based and uses SPI for the communication between LinuxCNC and the MCU.

github.com/scottalford75/Remora
remora-docs.readthedocs.io/en/latest/

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

More
05 Jun 2021 01:27 #211189 by BeagleBrainz
Why did you stop the compilation process ?

I used the code from that thread and it went through halcompile ok.
rmurphy@thinkPad-t530:~/temp$ sudo halcompile --install serialreceive.comp 
gcc -I/usr/include -I/usr/include/linuxcnc -URTAPI -U__MODULE__ -DULAPI -Os  -o serialreceive /tmp/tmp5WG7oK/serialreceive.c -Wl,-rpath,/lib -L/lib -llinuxcnchal 
serialreceive.comp: In function ‘user_mainloop’:
serialreceive.comp:49:17: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]

As serialreceive is a userspace component you need to use loadusr not loadrt
The following user(s) said Thank You: TheRoslyak

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

More
05 Jun 2021 20:03 #211246 by TheRoslyak
Ok. Thank you so much.
Before these are all own components use "loadrt"
This made me think that there might be a USB-HID component. Someone probably used linuxcnc with a dualshock or xbox controller. I found this project hidcomp.sourceforge.net/
it perfect for me)
The following user(s) said Thank You: Doogie

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

More
06 Jun 2021 01:09 - 06 Jun 2021 01:13 #211266 by BeagleBrainz
That's not the easiest code to compile.

When I did use it I had to modify the make file and mess around with some libraries, unfortunately I can't find my notes.

There is also this:
linuxcnc.org/docs/2.8/html/man/man1/hal_input.1.html

And this tho a little old:
wiki.linuxcnc.org/cgi-bin/wiki.pl?A_New_...oypads_With_LinuxCNC

You can also use the forum search function, I'm pretty sure someone recently asked about using an xbox controller.

Might be some info here you can use.
forum.linuxcnc.org/38-general-linuxcnc-q...ne-controller#209884

Maybe if you add a post asking for some help the author may answer.
Last edit: 06 Jun 2021 01:13 by BeagleBrainz.
The following user(s) said Thank You: TheRoslyak

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

More
07 Jun 2021 09:31 #211410 by TheRoslyak
Thank you.
It was easy, I don't understand that others are tense.




The problem is the following:
"Tearing" speed - The robot jerks slightly at medium speed
I try to use filter kalman - It didn't help much.
If the way to smooth out the speed?
Attachments:
The following user(s) said Thank You: Doogie

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

More
28 Jun 2021 14:56 #213147 by TheRoslyak
hi everyone.
In the continuation of the conversation.
The next question is only partially related to linuxcnc. But maybe there are tips on how to implement it.
In globaly I want to make "Data transmission device".
The alignment scheme is shown in pic.
Question number 1:
How reliable will the uart package be if I send simple text. or maybe there are other options
Question number 2:
If the made devices that perform "HC-6 + Arduino Leonardo".

I do not understand how in such a device. I can set a fixed value for joysticks and buttons and etc.
And returning to the first question, what does this get at the input? ("Data Transmit" I mean)
Attachments:

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

Moderators: PCWjmelson
Time to create page: 0.135 seconds
Powered by Kunena Forum