Installing LinuxCNC 2.9 on Raspberry Pi 4B with Preempt-RT kernel

More
06 Nov 2024 10:29 #313884 by behai

First of all, my deepest deepest sympathies,sorry to hear you live in Melbourne, the only good thing Victoria has to other is Philip Island and the roads, airports and docks that lead out of the state.

Why aren't you using the premade image for your RPi ?

The links are on the Linuxcnc home page under downloads.
 

Good evening cornholio,

Thank you for your reply and suggestions.

I love Melbourne, except the crazy weather :) I have spent more than 2/3 of my life in Melbourne.

So after about 6 failed attempts ha ha ha... I found this official instructions: The Linux kernel

And I used one of the 64 bit images offered by the Raspberry Pi imager software to get my initial OS with Desktop.

Then from the instructions above, I picked out the appropriate bits to apply.

I finally succeeded:



Then, I also use a Windows utility named "Win32 Disk Imager - 1.0" to take an image of the SD card. And restore the image to another new card, I am able to boot from this new card also. Now I have an entire back up of the original card, if both cards fail at the same time, I am still covered.

Originally, I used the native dd tool to do the image backup, I could restore the image also, but it refuses to boot.

Currently, I only have a "Nema 23 Closed Loop Stepper Motor 3Nm (424.83oz.in)" and the CL57T-V41 driver.

I am learning by trying to program it using Python... I am having trouble getting it to work properly as a closed loop motor. I can get it to work as an open loop motor, we just switch on the the 6th dip switch SW6.

Thank you and best regards,

...behai.


 

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

More
06 Nov 2024 13:48 #313902 by tommylight
A shot from the hip, but usually those drive/steppers will have wrong encoder wiring, would be prudent to double check.
The following user(s) said Thank You: behai

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

More
08 Nov 2024 08:04 #314066 by behai

A shot from the hip, but usually those drive/steppers will have wrong encoder wiring, would be prudent to double check.
 

Hi tommylight,

It just so turned out you were right: one of my encoder wire were loose, I tightened it on the CL57T-V41 driver and it behaves now.

This is the wiring diagram:




My References for the Wiring Diagram:

1.


From 34:14 CL57T Driver Overview.

2. help.stepperonline.com/en/article/wiring...tepper-motor-4cddqy/

The first CL57T diagram.

3. pypi.org/project/cl57t-raspberry-pi-stepper-drive/

See the table for signal pins to the Raspberry Pi 4B.

And I have learned to work the ENA+ pin: setting it to low to enable, to high to disable.

The Python code below turns the motor 1 revolution, pauses for a little then keeps on turning till Control C to stop.

If I changed [ gpio.output( ena_pin, gpio.LOW ) ] to [ gpio.output( ena_pin, gpio.HIGH ) ] the motor won't turn.

Now I am trying to figure out why I need 1600 to do one revolution, it is about how the DIP switches are set, I have to understand the table in the manual :)

Thank you and best regards,

...behai.

[
# 08/11/2024
#
# Enable by setting ENA+ pin to low. Expected: motor will run.
#
# /usr/bin/python3 nema23_04_ena_enabled.py
#
from time import sleep
import RPi.GPIO as gpio

direction_pin   = 13
pulse_pin       = 6
ena_pin         = 19
cw_direction    = 0
ccw_direction   = 1

gpio.setmode( gpio.BCM )
gpio.setup( direction_pin, gpio.OUT )
gpio.setup( pulse_pin, gpio.OUT )
gpio.setup( ena_pin, gpio.OUT )
gpio.output( direction_pin, cw_direction )

# Enable.
gpio.output( ena_pin, gpio.LOW )
# ENA pin must be ahead of DIR by at least 200ms.
sleep( 0.5 )

try:
    while True:
        print( 'Direction CW' )
        sleep( .5 )
        gpio.output( direction_pin,cw_direction )
        for x in range( 1600 ):
            gpio.output( pulse_pin, gpio.HIGH )
            sleep( 0.0001 )
            gpio.output( pulse_pin, gpio.LOW )
            sleep( 0.0001 )

except KeyboardInterrupt:
    # Disable.
    gpio.output( ena_pin, gpio.HIGH )
    gpio.cleanup()
]

 

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

Time to create page: 0.078 seconds
Powered by Kunena Forum