How to configure THCAD2 encoder on Z axis on 7i96s board?

  • programador
  • programador's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
20 Oct 2024 15:44 - 20 Oct 2024 15:57 #312688 by programador
I am retrofitting a machine, where I need to control the precise movement of the Z axis, I am using the feedback from the THCAD2 electronic board to transform the signal from the analog ruler from 0 to 10 v into frequency, the frequency is being read by the 7i96s board, the speed information hm2_7i96s.0.encoder.00.velocity appears. How do I configure the connection in the HAL file to recognize this signal as a Z axis position encoder? Please, if you have any examples, I appreciate it.

Before applying it to the real machine, I am performing some simulations in the laboratory. Below are the examples

In this image, we have a stepper motor connected to the shaft with a potentiometer that provides a voltage of 0 to 10 volts to simulate what will happen in the machine.

 

In this image, we have a THCAD2 electronic board that receives 0 to 10v from the potentiometer and converts it into a frequency of 100 to 1000 KHZ

 


In this image, we have a 7i96s electronic board that receives only one signal A in ENCA+ and ENCA+ from 100 to 1000KHZ

 


It seems to me that only the hm2_7i96s.0.encoder.00.velocity signal is usable to inform the position.  Because the other signs are always counting and adding infinitely regardless of the movements.

 


I didn't find any example on the internet to apply this hm2_7i96s.0.encoder.00.velocity signal in Z position return position setting, please, can someone help me with example?

 

explanation video translated by artificial intelligence, sorry if there is any misunderstanding
https://youtu.be/5GN0cps-YLc
Attachments:
Last edit: 20 Oct 2024 15:57 by programador.

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

More
20 Oct 2024 16:27 #312694 by PCW
You would use the encoder velocity as the joint feedback source for the joint used for the Z Axis

Basically, if you make a configuration (using pncconf or MesaCT) with Z being a
normal step/dir axis, you would replace the feedback coming from the stepgen
with the encoder velocity. What drives the Z axis?

Note that you need to scale the encoder velocity so it reads in machine units.
In addition, you will likely need to offset the reading
(perhaps using the scale or offset components)

The encoder scale will probably be a large negative
number, I can give you the math for this later. just stepping out
the door...

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

  • programador
  • programador's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
20 Oct 2024 17:56 - 20 Oct 2024 18:09 #312700 by programador
Thank you, Master PCW
In the factory, the Z axis is driven by the 7i77 board connected to 7i96s.

It works with a positive voltage of 10 V, the punch goes up, and with a negative voltage of 10 V, it goes down.

I am in my laboratory, hundreds of kilometers away from the factory. Unfortunately, I do not yet have two 7i77s to do all the simulations here. But I do have two 7i96s to do the simulations here in the laboratory, while the other one has already been installed on the customer's machine. However, before I travel again, I need to have the programming ready to apply it to the machine.

I have been working on this for a long time. You advised me to use THCAD2 to receive the signal from the magnetic ruler.

The big challenge with this machine is that the Z axis is a hydraulic cylinder that hits the punch and pierces the metal sheet, but this movement has to be done with millimeter precision. If it exceeds the limit, it pulls and deforms the metal sheet. I think your idea of ​​using THCAD2 is great, because it has some similarities in the way the machine works, because the purpose of THCAD2 is to control the height of the plasma torch and in my case it is to control how far the punch can reach the metal sheet. However, I am new and inexperienced in configuring Hal to connect this and the LinuxCNC system understands that the speed of the frequency is the displacement of the Z axis, for example at 100KHZ the cylinder advanced all the way and at 1MHZ the cylinder returned all the way. Because the future interest is that with the G code, I can determine the depth that can reach the metal sheet. I will check your recommendations, but if you can give me some examples, I would be very grateful.

Last edit: 20 Oct 2024 18:09 by programador.

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

  • programador
  • programador's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
20 Oct 2024 19:14 #312705 by programador
Thank you Master PCW
I used (pncconf) to get some sample code to apply to the project. The code looked like this:

 

The frequency reading is appearing on the panel, but when trying to move it, this Z-axis movement calculation error appears:

 

Please, how should I proceed? What alternative and configuration for this?

 
Attachments:

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

More
20 Oct 2024 22:15 #312713 by PCW
One obvious change is that the Z axis feedback must come from the encoder velocity
(= scaled THCAD2 frequency)

net z-pos-fb hm2_7i96s.0.encoder.velocty
 

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

  • programador
  • programador's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
21 Oct 2024 09:06 - 21 Oct 2024 11:29 #312725 by programador
Good morning Master PCW

I made the suggested change and it was not successful, an error appears, can you please help me?

The image below is before changing the line 214

 

The image below is after changing line 214

 

The image below is the error reported after the change

 

Attached are the error and hal configuration files


 

File Attachment:

File Name: Plasma_202...21-2.hal
File Size:13 KB


 

File Attachment:

File Name: linuxcnc-report.txt
File Size:9 KB


Please, can you help me?
 
Attachments:
Last edit: 21 Oct 2024 11:29 by programador.

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

Time to create page: 0.189 seconds
Powered by Kunena Forum