kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Tue May 20, 2014 12:32 pm

Let me check tomorrow.

Also check the spi signals on both sides (RPi and PICnc) as sometimes the issue is with the connectors.
42

Lerche
Posts: 24
Joined: Mon Apr 28, 2014 1:25 pm

Re: LinuxCNC

Tue May 20, 2014 12:36 pm

kinsa wrote:Let me check tomorrow.

Also check the spi signals on both sides (RPi and PICnc) as sometimes the issue is with the connectors.
Thanks Kinsa!

I'll have a go on the code, maybe something I forgot (I did try your code also).

Thanks!

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Tue May 20, 2014 2:54 pm

You need to enable the axis, issue the command:

Code: Select all

setp picnc-jr.0.enable 1
The complete test would be:

Code: Select all

loadrt threads name1=test period1=1000000
loadrt hal_picnc_jr

setp picnc-jr.0.scale 100
setp picnc-jr.0.maxaccel 10
setp picnc-jr.0.mode 1

addf picnc-jr.read-spi test
addf picnc-jr.stepgen test
addf picnc-jr.write-spi test
start
loadusr halmeter
Monitor the value of picnc-jr.0.position-fb and issue the command:

Code: Select all

setp picnc-jr.0.position-cmd 1000
setp picnc-jr.0.enable 1
42

Lerche
Posts: 24
Joined: Mon Apr 28, 2014 1:25 pm

Re: LinuxCNC

Tue May 20, 2014 3:09 pm

kinsa wrote:You need to enable the axis, issue the command:

Code: Select all

setp picnc-jr.0.enable 1
The complete test would be:

Code: Select all

loadrt threads name1=test period1=1000000
loadrt hal_picnc_jr

setp picnc-jr.0.scale 100
setp picnc-jr.0.maxaccel 10
setp picnc-jr.0.mode 1

addf picnc-jr.read-spi test
addf picnc-jr.stepgen test
addf picnc-jr.write-spi test
start
loadusr halmeter
Monitor the value of picnc-jr.0.position-fb and issue the command:

Code: Select all

setp picnc-jr.0.position-cmd 1000
setp picnc-jr.0.enable 1
Wow, that worked!
I haven't checked with the scope, but I certainly have feedback now!

Thanks! :D

Now I need to install the HAL driver for LinuxCNC or can i run it straight out of the box?

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Tue May 20, 2014 3:32 pm

The HAL driver is already installed. You just need to create a machine configuration.

Have a look under picnc/configs, it contains some sample config for the original picnc. Just replace any reference to *picnc* to *picnc_jr* or *picnc-jr* where appropriate.
42

Lerche
Posts: 24
Joined: Mon Apr 28, 2014 1:25 pm

Re: LinuxCNC

Tue May 20, 2014 4:19 pm

kinsa wrote:The HAL driver is already installed. You just need to create a machine configuration.

Have a look under picnc/configs, it contains some sample config for the original picnc. Just replace any reference to *picnc* to *picnc_jr* or *picnc-jr* where appropriate.
Really really nice work here Kinsa! I finally got to see what LinuxCNC Looks like!
I changed like you said, no more startup errors!
Now I'll go ahead and test some motors on it :D

Guvner
Posts: 19
Joined: Tue May 13, 2014 2:21 pm
Location: Netherlands - Rotterdam

Re: LinuxCNC

Tue May 20, 2014 8:21 pm

Can anyone tell me what type of PIC32 I need?

Roque is providing me with a board of him, but what type of PIC32 need to be put on that?

PIC32MX150F128B-50I/ML
PIC32MX150F128B-50I/SO
PIC32MX150F128B-50I/SP
PIC32MX150F128B-50I/SS
PIC32MX150F128B-I/ML
PIC32MX150F128B-I/SO
PIC32MX150F128B-I/SP
PIC32MX150F128B-I/SS

These are the different types I found

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Wed May 21, 2014 1:57 am

Get the PIC32MX150F128B*I/SP part.
42

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Wed May 21, 2014 12:06 pm

kinsa wrote:This is the pinout of the CNC shield:
Image
Using the breadboard schematic as reference:
  • Connect the direction and step pulse pins to STEP/DIR (P3).
  • Connect the inputs (*), except for reset/abort to INPUTS (P4). Note that the limit switches are normally closed (NC).
  • Connect the coolant, stepper, spindle enable and spindle direction to OUTPUTS (P5).
The pin ordering for (P3) is normally step and dir for axes X Y Z (i.e 1- step x, 2- dir x, 3- step y, ... ).

The INPUTS (P4) and OUTPUTS (P5) can be of any order as the assignments can be changed in software.

Note that you'll need to modify the shield and add pull-up resistors on the inputs:
Image
Any value between 1K to 3.3K will do.
I forgot to add, the supply to the CNC shield should be connected to 3.3v instead of 5v.
42

Guvner
Posts: 19
Joined: Tue May 13, 2014 2:21 pm
Location: Netherlands - Rotterdam

Re: LinuxCNC

Thu May 22, 2014 9:22 am

When i have all the items, I will make a complete schematic and will put it here for reviewing by you guys.

Lerche
Posts: 24
Joined: Mon Apr 28, 2014 1:25 pm

Re: LinuxCNC

Thu May 22, 2014 3:33 pm

Lerche wrote:
kinsa wrote:The HAL driver is already installed. You just need to create a machine configuration.

Have a look under picnc/configs, it contains some sample config for the original picnc. Just replace any reference to *picnc* to *picnc_jr* or *picnc-jr* where appropriate.
Really really nice work here Kinsa! I finally got to see what LinuxCNC Looks like!
I changed like you said, no more startup errors!
Now I'll go ahead and test some motors on it :D
Wohoo!! I got motors going! Great! Now I'll try to do it again (I need 2 RPi with CNC), so I can document my process!

Btw Kinsa: I got your boards, thanks a bunch!

Lerche

Guvner
Posts: 19
Joined: Tue May 13, 2014 2:21 pm
Location: Netherlands - Rotterdam

Re: LinuxCNC

Fri May 23, 2014 8:21 am

Just a curious one.... I heard about running LinuxCNC on two raspberry pi's.

This was done to split the load.

Anyone had some experience with this setup?

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Fri May 23, 2014 8:51 am

There's no remote gui yet except for the web interface.

One board runs lcnc and the other board runs the Web browser.
42

Guvner
Posts: 19
Joined: Tue May 13, 2014 2:21 pm
Location: Netherlands - Rotterdam

Re: LinuxCNC

Fri May 23, 2014 9:00 am

Would that be an advantage? Or is the Pi strong enough to run both?

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Fri May 23, 2014 9:08 am

Guvner wrote:Would that be an advantage? Or is the Pi strong enough to run both?
The current GUI with preview mode isn't really optimized to run under arm boards. If you stick to text based gui's, linuxcnc runs fine on a single RPi. AXIS, the default gui, is a resource hog - this also holds true for Beaglebones which is way faster than RPi.
42

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: LinuxCNC

Sat May 24, 2014 11:51 am

I have been wondering how linuxcnc works on xenomai kernel and just recently saw something that suggested there were problems that will soon be fixed.

http://www.blaess.fr/christophe/2013/02/15/

I know until recently I have found very poor performance with RT_PREEMPT kernels, have you found any problems with usb on the kernels you have been using?

Also which version of linuxcnc are you using, I have just recently looked at machinekit which seems to compile without problem on the rpi.

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Sun May 25, 2014 12:20 am

mung wrote:I have been wondering how linuxcnc works on xenomai kernel and just recently saw something that suggested there were problems that will soon be fixed.

http://www.blaess.fr/christophe/2013/02/15/

I know until recently I have found very poor performance with RT_PREEMPT kernels, have you found any problems with usb on the kernels you have been using?

Also which version of linuxcnc are you using, I have just recently looked at machinekit which seems to compile without problem on the rpi.
Xenomai works fine as long as you don't run your base period less than 100ms.

I'm using the latest machinekit on a 3.10 kernel. Works fine but I haven't exhaustively tested the USB. The 3.10 drivers are way better than the old kernels.
42

Guvner
Posts: 19
Joined: Tue May 13, 2014 2:21 pm
Location: Netherlands - Rotterdam

Re: LinuxCNC

Wed May 28, 2014 4:36 pm

Sooo happy.

Got mail today with a nice pcb from roque!!!

Saturday to the electronics shop to get the parts to put on the pcb

Inventor_Tommy
Posts: 14
Joined: Sun Jun 01, 2014 8:26 am

Re: LinuxCNC

Sun Jun 01, 2014 10:56 pm

Hi, I have a post at http://www.raspberrypi.org/forums/viewt ... 50#p558450

However I was wondering if my question could be answered here:
I am trying to build a CNC machine from my Raspberry Pi. I did some research, purchased some 4 phase stepper motors (28BYJ-48) with a ULN-2003 driver board. I can move these motors fine with a python script using [1,0,0,1] [1,0,1,0] etc except when I try to apply this to the real world I hit a road block. So in a nut shell I know I can move the motors smoothly with a 0.004 second delay however all applications so far with examples on the net with python all show a bipolar motor setup. I even tried compiling my own kernel with LINUXCNC drivers etc, the application works but it require 2 pins only for drive/step. I clearly need 4 GPIO pins per phase.

Tom

Guvner
Posts: 19
Joined: Tue May 13, 2014 2:21 pm
Location: Netherlands - Rotterdam

Re: LinuxCNC

Mon Jun 02, 2014 12:20 pm

On the BOM of the breadboard I saw the next items

QTY
1 PIC32MX150F128B
2 SN74LS04
2 1K resistor
4 0.1uf capacitor
1 10uf low ESR capacitor (tantalum/ceramic)

I allready have my PIC32 and SN74LS04 ic's. But now I need to get the remaining items from the electronics store.
* What voltage does the 10uf cap need to be?
* What voltage does the 0.1uf cap need to be?
* What type of resistor do I need?

Roque7
Posts: 24
Joined: Sat Jan 18, 2014 10:58 am

Re: LinuxCNC

Mon Jun 02, 2014 4:38 pm

The capacitor 10 uF 25V tantalum, was the lowest :lol: :lol: :lol:
The 0.1 uF are sufficient voltage.
The highest voltage is 5V at BB
Resistors 1/4W 5%

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: LinuxCNC

Mon Jun 02, 2014 10:10 pm

Inventor_Tommy wrote:Hi, I have a post at http://www.raspberrypi.org/forums/viewt ... 50#p558450

However I was wondering if my question could be answered here:
I am trying to build a CNC machine from my Raspberry Pi. I did some research, purchased some 4 phase stepper motors (28BYJ-48) with a ULN-2003 driver board. I can move these motors fine with a python script using [1,0,0,1] [1,0,1,0] etc except when I try to apply this to the real world I hit a road block. So in a nut shell I know I can move the motors smoothly with a 0.004 second delay however all applications so far with examples on the net with python all show a bipolar motor setup. I even tried compiling my own kernel with LINUXCNC drivers etc, the application works but it require 2 pins only for drive/step. I clearly need 4 GPIO pins per phase.

Tom
If you have linuxcnc working correctly and the stepper driver is the same for kinsa pic board as the standard linuxcnc stepgen then there are many options for alternative step types, read the linuxcnc stepgen manual for more information. http://linuxcnc.org/docs/html/man/man9/stepgen.9.html

I think step types 9 and 10 will drive 4 phase via a uln2003 type driver, or you can wire a uln with some resitors to drive in quadrature using only two gpio drive pins.

I have never looked at kinsas drivers so do not know how it works and integrates with linuxcnc or the standard stepgen driver.

I am hoping to get a reasonable stepgen driver created for the pi without the need for external hardware(with full support for all step types), unfortunately it requires a lot of work and I am trying to workout a kickstarter to fund it, I doubt it will be ready before september.

There should be some linuxcnc config files available that show how the other stepgen step types work, if you check the example config file there should be something of use otherwise try asking on the linuxcnc.org forum.

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Tue Jun 03, 2014 5:08 am

I have updated and simplified PICnc to handle small and large stepper motors.

PICnc V2, using LPT interface:
Image

PICnc V2.1, using pololu compatible boards:
Image

These can also be used on other ARM based boards, such as A13, that has an SPI interface.

I will post more info later.

Cheers!

UPDATE:
Repository: https://github.com/kinsamanka/PICnc-V2
PICnc V2 Schematic: https://github.com/kinsamanka/PICnc-V2/ ... f?raw=true
PICnc V2.1 Schematic: https://github.com/kinsamanka/PICnc-V2/ ... f?raw=true
42

Roque7
Posts: 24
Joined: Sat Jan 18, 2014 10:58 am

Re: LinuxCNC

Tue Jun 03, 2014 11:30 am

Hi, Kinsa. In v2 picnc with LPT interface, this is to program?
Regard
Luis

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: LinuxCNC

Tue Jun 03, 2014 11:54 am

Roque7 wrote:Hi, Kinsa. In v2 picnc with LPT interface, this is to program?
Regard
Luis
This is similar to the breadboard version except that it uses the same pinout that is used on the LPT port with software stepgen (linuxcnc on PC).

If you have an existing PC setup, you can easily reuse it with this board.
42

Return to “Automation, sensing and robotics”