Page 40 of 41

Re: LinuxCNC

Posted: Thu Apr 28, 2016 1:59 am
by enesterov
Hello Everyone,

I have a bit more information and need your help once again. I have a lathe setup with just X and Z configured as active low through M542H drivers. When I use keyboard to jog both axis motors spin not as I expect:

Code: Select all

Arrow UP:  X ->CCW
Arrow Down: X->CW, Z->CCW
Arrow Left: Z->CCW
Arrow Right: X->CW
In addition when Arrow Right is pressed at least ones it changes UP/Down behaviour as follows:

Code: Select all

Arrow UP:  X ->CCW, Z->CW
Arrow Down: Z->CW
After I press Arrow Left everything comes back to how it was before Arrow Right was pressed.
My configs are based on dega's files and attached to this post.

If someone faced same behaviour I would appreciate any hints.

Re: LinuxCNC

Posted: Thu Apr 28, 2016 7:38 am
by kinsa
I'm not sure anyone here has a lathe setup.

You'll get better response if you post here:!forum/machinekit

Make sure you include all info about your setup.

Re: LinuxCNC

Posted: Wed May 04, 2016 4:03 pm
by enesterov
Hello Everyone,

Small update in case anybody is interested - I've removed "not" from both X and Z and everything seems to behave now.

The only problem I have is that I am using "The official Raspberry Pi touch display" with my RPI2 and because it is 800x480 the bottom part of the GUI is chopped off. What are you guys using for display with your Machinekits? Just plain good old HDMI monitor or maybe something like "Eleduino Raspberry Pi 7 Inch 1024x600" display?


Re: LinuxCNC

Posted: Wed May 18, 2016 8:21 pm
by Jean-Renier
Hello everyone,

Very cool project, splitting the fast real time routines of LinuxCNC into a separate hardware entity is in my humble opinion the way to go, especially if one could circumvent the need of the now really deprecated parallel port. Especially also as the hardware is just a handful of components costing less than 20 USD.

Myself (I am a retired electrical engineer), I have been busy with microcontrollers as a hobby almost my entire live, lately with the AT mega series. Last year I purchased a “hobby” mill, a HBM Super X1 (a rebranding of the better known Sieg X1) which I converted to CNC by adding steppermotors and home build driver electronics. I currently run it from a old desktop running the Ubuntu 12 / LinuxCNC combination. This all works fine but it would be so much better if I could control my little mill out of my laptop through my home LAN and a headless Raspberry Pi , hence my interest in this forum.

A few questions if I may.

I am reading this rather lengthy messages thread learning a lot and have been trying a few things. Amongst other I tried to compile the PIC32 firmware from the sources from the Github. I downloaded/installed the entire MPLab X-IDE and XC32-gcc (the free not optimising version). I fiddled somewhat with the make file (to cope with the different location of the gcc in my set up), Eventually a *,hex file was created which was some 20% larger than the one include on the Github. Also I got a huge amount of warnings about the PLIB functions to be soon deprectated. Any comment on this ?
Also I guess that the files picnc.h and picnc.c are in fact part of the driver software on the Raspberry Pi and as such not a part of the actual firmware of the PIC32.

I didn't try to install Linux CNC on my Raspberry Pi V2 yet as it is still used for some other project. I will eventually purchase another one, what about a Raspberry Pi V3 ? I wonder is if StepConfig is still working on this setup. In other words do the several stepper settings: speed, acceleration, … propagate in some way into the PIC32 ?

As I understand it, there is no PICnc-V2 hardware available for sale, not a big deal, I can build my own, but really has nobody build this ?

Many thanks on beforehand for your comments and all the best,

Re: LinuxCNC

Posted: Wed May 18, 2016 11:37 pm
by Wire
On the hardware side depending on what you need there may be some hardware for sale. I did a OSH run of board for my laser cutter and the min order was 3. I don't have a use for all 3 so have 2 unspoken for.


These cards were set up for my laser cutter so there are no onboard stepper drivers (just step and dir on the screw terminals) and extra IOs for laser control and interlock sensing. This drove the need for a different pic and some IO mapping. Last time I worked on it I had step gen and IO control working. Just have not been back to it in a bit due to other work getting priority over my hobbies.

When I get home tonight I can link to the PDFs for the logics and my gethub repository for the firmware.

Note these instructions are all old and need updating (written before the Pi2 came out)
Pic Firmware build env (NOTE he did not use the Microchip enviroment and I have never gotten any of the code to compile there) ... sp=sharing
Random notes about my board (not to be confused with the original ones) ... sp=sharing

Re: LinuxCNC

Posted: Thu May 19, 2016 3:30 am
by Wire
my 5axis firmware is here:

Board logics and some other info can be found here:

Re: LinuxCNC

Posted: Fri May 20, 2016 10:11 am
by Jean-Renier
Dear wire,

Many thanks for the reply, it will certainly serve as a source of inspiration. I will most probably make my own hardware, my driver electronics is working ok and I just need the PICnc circuit between it and the RPI.
I succesfully compiled the firmware using the MPIDE compiler as you describe it, Still wondering about the benefits of the "official" XC32-gcc though.
I''ll keep this forum posted about my progress with this project.


Re: LinuxCNC

Posted: Fri May 20, 2016 4:09 pm
by bfree

I have a few of my RASPI Kits available, if interested. You can see my project/application here: . Look for the RASPI Kit down the page. The kit included everything needed for the PICnc-v2, including the RPi B+ and some extras.

Have fun!

Re: LinuxCNC

Posted: Tue May 24, 2016 2:31 pm
by VikTan
dinkata wrote:I installed it on Raspberry pi2 minibian and machinekit
viewtopic.php?f=37&t=33809&p=941129&hil ... nc#p941129
after that I installed gmoccapy_lcd7
http://machinekit-gmoccapy-lcd7.blogspo ... to-la.html
I am trying run configs ,gmooccapy opens ,but error mesage :
Found an error!
The following information may be useful in troubleshooting:

Traceback (most recent call last):
File "/usr/bin/gmoccapy", line 4153, in <module>
app = gmoccapy()
File "/usr/bin/gmoccapy", line 241, in __init__
File "/usr/bin/gmoccapy", line 1038, in _init_audio = player.Player()
File "/usr/lib/python2.7/dist-packages/gmoccapy/", line 36, in __init__
self.player = gst.element_factory_make("playbin", "player")
ElementNotFoundError: playbin

please help !
what it takes to work gmoccapy ?
GUI Axis work !
For me helped:

Code: Select all

sudo apt-get install gstreamer0.10-plugins-base

Re: LinuxCNC

Posted: Mon May 30, 2016 6:18 pm
by mung
I don't know why I post this on youtube as it does not really help or inform anyone and a simple easy machinkit dist is still a long way off, but I finally got around to messing with a circuit board this weekend so made a video of results.

I don't think any question would be worthwhile, if I release anything it will be when it is ready, which is not yet.

I still think the picnc maybe a better route though.

Re: LinuxCNC

Posted: Sat Jun 04, 2016 8:38 am
by VikTan
Hi Kinsa,

I tried to create an updated Machinekit installation based on Raspbian Jessie, by your steps, but my instalation freezes or stops responding after from minutes to few hour. I tested it on both RasPi2 and RasPi3. I tried your older image RPi2-machinekit-1.0 on same RasPi2 everything works fine.

Please, would be possible do make this updated instalation img in same style like older image RPi2-machinekit-1.0? I need machinekit instalation working on Raspi3
Thanks in advance, Viktor

Re: LinuxCNC

Posted: Sat Jun 04, 2016 9:31 am
by kinsa
Is the old image using the updated mk debs?

If not, try updating it using the official mk repository and test again.

For RPi3, I don't have the hardware and I'm not sure preempt-rt kernel works on it.

Re: LinuxCNC

Posted: Sun Jun 12, 2016 5:58 am
by VikTan
Ok, it's working on RPi3 correctly, I made a silly mistake in typing commad.. :D

Re: LinuxCNC

Posted: Sun Jul 03, 2016 8:26 pm
by Jean-Renier
Hi Kinsa, and everyone,

I am afraid I need your help, as I am a bit stuck for the moment.

I just finished my own PICNC-V2 hardware and flashed the firmware. Then I made a clean install on a RasPi2 of Rasbian Jessie, RT-PREEMT, PICNC driver and Machinekit as per the instructions in this forum of March 5. When powering the combined RasPi2 + PICNC system, the led on the PICNC-V2 board blinks at about 1Hz.

Typing “Machinekit -v /home/pi/Desktop/MF70.ini” in a terminal window start Axis OK, the rhythm of the PICNC led does not change however. The machine can be powered/enabled by the button in Axis (though nothing happens as the stepper drivers are not connected yet), the rhythm of the PICNC does not change here either.
Whenever a movement is attempted (e.g. by jogging) an error “emc/task/ 617: Error on axis …” appears and the machine is subsequently disabled.

There is some continuous activity on the SPI (as I can seen with the scope on the actual pins of the PIC32), a few bytes are exchanged every 1ms or so, the SPI clock is about 10MHz.

Actually there is no difference of behaviour when the PICNC-V2 hardware is connected or not. Also, enabling or not the SPI interface in the RasPi preferences does not seem to matter.

A question about the limit switches. Are they implemented in the current firmware ? I do not use them, I just would like to know if the limit switch entries op the PICNC-V2 should be tied to the GND or to the VCC.

Grateful for any clue or suggestion.


Re: LinuxCNC

Posted: Mon Jul 04, 2016 12:25 pm
by kinsa

Please try the sd image at to rule out issues with the OS. Also post a picture of your setup.

Most of the problems are due to the spi wiring. The wiring have to be kept short as it is sensitive to electrical noise.


Re: LinuxCNC

Posted: Tue Jul 05, 2016 9:45 am
by Jean-Renier
Hi Kansa,

Many thanks for your fast answer and suggestions.

I did a quick test with the RPi2 (1.1 of April 10, 2015) image on the repository.
This appears to be built on Debian (that is OK), I had to install the PICNC drivers and the MF70 files.
To be short: it works now. The status led now blinks at twice the speed when Machinekit is running. I pushed a few buttons on Axis GUI and all seems to work, stepper pulse and direction signals are generated as they should. I"l do some more test later today.

Now I have the following problem: my stepper driver board needs a active high enable signal, currently it is active low. I could reverse the polarity of this signal (in the *.hal file or in the firmware) but this would not help since the output of pin6 of the PIC32 (PB2, signal EN) is also used to enable the 74HCT367 drivers. Any advise here ? Is there a particular reason to have the outputs in tri-state during idle ?

See the picture of my set-up, left is the stepper driver board, home built based on TB6560 chip (it is fed independently and includes a power sequencer). The PICNC board is in the middle and the RasPi2 is at the right (obviously).
As you will appreciate, the connection between the PICNC and the RasPi2 is really short, it is a small board with nothing more than a 8pin and a 40pin female connector. The SPI signals are wired between both connectors together with the the GND (the ground plane) and the +5V power (to feed the PICNC).

An other thing if I may. My previous set-up (with a parallel port out of a Ubuntu desktop) uses the spindle-PWM signal, which seems to lack here. I wonder if it is possible to use one of the flood/mist signals (which are not used anyway) to output a PWM signal of say 100Hz.
I could probably manage the firmware myself for the PWM generation part using the still remaining resources of the PIC32MX150F128B chip.
Where I need guidance is on how to adapt the SPI communication part (an additional uint8 variable), the PICNC driver part and the *.hal part.
I am quite happy to modify the several files and especially to test them, I rather not reverse engineer e.g. the PICNC driver on my own.
Also, they may be other and more clever ways to implement to implement the pindle-PWM signal (the speed and accuracy not being that important), e.g. in the RasPi itself.

I am very happy with the progress so far, many thanks again for all the work on this fine project and for your help.

Cheers, Jean-Renier.

Re: LinuxCNC

Posted: Tue Jul 05, 2016 10:17 am
by kinsa
Can't see your pic ;-)

The instructions to enable the PWM on the output pins can be found here.

For an active high enable output, disconnect pin 4 of U2 and connect it to v+. If you're using an IC socket, just lift pin 4 and solder a jumper wire directly to the pin.

Re: LinuxCNC

Posted: Wed Jul 06, 2016 8:18 pm
by Jean-Renier
Hi Kinsa,

Thanks again for your advise.
For the spindle pwm signal, I should have more faith and read more carefully the message trail, sorry about that. I did also a bit of code reading (firmware and driver) and I understand now just enough how it works to fit the *.hal file to my environment.
I decided modify the hardware (ground the enable inputs of the 74HCT367 permanently) in order to keep the enable output PB2 (pin6 of the PIC32) as an active signal. This is especially useful since my stepper board needs a common “amplifier enable” signal which is deactivated e.g. after an e-stop.
So, I solved my problems partly by modifying the *.hal file and partly by modifying the firmware. For the latter, I believe it is the only way to invert a some of the signals, such as Z-dir and spindle-pwm, since they are generated by the PIC32 itself, beyond the reach of the *.hal file.

Herewith the modified *.hal and *.ini files, as they can be useful to some else. Also a second attempt for the picture.
picnc.JPG (58.2 KiB) Viewed 8343 times
(1.53 KiB) Downloaded 270 times
Many thanks again and all the best,

Re: LinuxCNC

Posted: Sat Jul 16, 2016 10:24 pm
by Kirk Fraser
I have a non-working MaxNC 15 CL which is basically a desktop XYZ table with servo-motors. It is possible to run them with a Raspberry Pi because the manufacturer sells one to replace Win98 parallel port PC's. The problem is the electronics between the RPi and the motors which costs a lot to replace. So I bought a RPi 3B and hope to learn how to make a daughter board with nearly nothing on it except IRF3708 chips to amplify the RPi output pins and maybe TC4427 interface chips if necessary. I think that would be the simplest and cheapest hardware.

Any ideas for the position sensors? The RPi pins might accept them directly. The RPi should be able to do all the signal processing. Will any other software be needed besides standard Raspian and LinuxCNC? If so how do I get installed to talk with LinuxCNC? Or can the motors be driven directly by the RPi without a daughter board? Where is a schematic that shows the pin details needed including the PinOuts under LinuxCNC and the motor/position sensor requirements? Thanks.

Possible driver software is Machine Kit and GRBL. Are they needed or desired for Linux CNC?

There are many options for not-cheap driver boards. One user recommends KFLOP as giving 700 ipm on all 3 axes. Is that speed worth extra money? I'm also concerned about reliability because this is the second time my MaxNC driver board needs replacing. I figure doing my own board would last longer and be cheap to fix. All advice welcome. Thanks.

Re: LinuxCNC

Posted: Fri Jul 22, 2016 3:54 pm
by AsaltedPnut
Hi guys

I would call myself a total noob when it comes to Raspberry Pi...

I am currently studying CNC programming, and I was wondering if my Pi 3 is capable of running a CNC simulator.

If so, does anyone have any recommendations?

I want to be able to write turning/milling code, and simulate.

Kind regrds

Re: LinuxCNC

Posted: Wed Jul 27, 2016 9:22 pm
by MrGreg
Using Linux CNC <aka Machinekit>on an RPI for gcode simulation is like using a sledgehammer to crack a peanut... Ha Ha.!

This is a suggestion, not a recommendation...

Type "gcode simulation" into the Add / Remove software (Main Menu - Preferences)
There are a few to choose from, "yagv" looks promising? Try it.

Otherwise you are into quite a bit of work installing and compiling 3rd party software. Read back through this thread to get an idea.
Depends if you are adventurous, or just want a quick solution

Re: LinuxCNC

Posted: Thu Jul 28, 2016 4:48 am
by AsaltedPnut
Hi greg thanks for the suggestion, I am usually adventurous, but at the moment my big adventure is switching to linux based OS, as I am a windows guy :o .

I will eventually learn how linux deep code works, kernels etc. Then I think I will give it a shot to compile 3rd party software tailored to my needs.

Kind regards

Re: LinuxCNC

Posted: Wed Aug 10, 2016 8:30 pm
by samuelt
Hello everyone!

I'm looking for a bill of materials to build a PICnc-V2 Pololu board with. Ordered the boards from OSH Park.

The big items I could work out (the exact pic32, 74hct367 chips etc), but the small stuff that I don't know exacly what to get.

I have looked through this whole thread, the github repository, had a brief encounter with kicad 4 on windows 7.

Still I couldn't find or generate a BOM.

Please help?

Re: LinuxCNC

Posted: Thu Aug 11, 2016 1:25 am
by kinsa
Here's the BOM that bob had used: picnc_parts.txt

Note that this is for the LPT board.

Re: LinuxCNC

Posted: Fri Aug 12, 2016 6:09 am
by samuelt
kinsa wrote:Here's the BOM that bob had used: picnc_parts.txt

Note that this is for the LPT board.
Thank you!