My PICnc Build
- dennis.lewis5
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 5
05 Nov 2021 03:11 - 05 Nov 2021 16:18 #225342
by dennis.lewis5
My PICnc Build was created by dennis.lewis5
Raspberry Pi 4 with LinuxCNC
While researching platforms to upgrade my 3 axis machine my attention was drawn to the prior work of Kinsamanka and Wireb on the github platform.
Wireb built off of the prior Kinsamanka work.
Searching for examples of projects using PICnc did not get any results. Is the project dead? It seems to be inactive for 7 years as of this writing.
My investigation into the project convinced me that it was a good starting point. So it was decided to go ahead and use this as the starting point for a Pi – PIC LinuxCNC controller.
The goal of the project was to:
Find reliable, readily available, inexpensive compute hardware.
Reduce the footprint of the controller.
Learn a little.
Have some fun.
Add as much flexibility to the system as possible.
There are two hardware platforms, the Pi and the PIC which necessitates two different software platforms.
The Pi code was built using Geany and compiled with halcompile.
The PIC code was ported to use a PIC32MZ, specifically the PIC32-HMZ144, clocking at 200 mHz, from Olimex. This work was done using Microchip MPLAB X IDE v5.40.
The build has resulted in a system that has:
32 optically isolated I/O pins, individually selectable as input or output.
5 optically isolated step & dir outputs
4 optically isolated pwm outputs
Stepgen 80kHz default
SPI clock 5 mHz default
Purchased Components:
RTELLIGENT R60X3 3 Axis Stepper Driver, powered by external linear supply.
Pi 4, 4gB
Olimex PIC32-HMZ144
12 V Supply, generic
5 V Supply, Mean Well LRS 35-5
My Components: I/O Block – an 8 bit interface, optically isolates the field devices from the logic The block used to interface the stepper driver does not have indicator leds nor their associated resistors installed. This is to reduce potential emi on these high speed lines. The yellow parts are the isolators which are flipped 180 degrees to switch from input to output. This is the electrical function, to change the logic a parameter file is used.
Bridge – This provides 5V to the Pi and it connects the Pi to the PIC with spi and handshake signals.
PIC32-HMZ144 Carrier- This board provides the pic to system connections via IDC connectors and it supplies 5 V to the cpu.
12 V Distribution- a modified I/O Board providing 16 tie points.
Reference:
github.com/kinsamanka/PICnc-V2
github.com/Wireb/PICnc-5axis
github.com/LinuxCNC/linuxcnc/blob/master...hostmot2/hm2_rpspi.c
While researching platforms to upgrade my 3 axis machine my attention was drawn to the prior work of Kinsamanka and Wireb on the github platform.
Wireb built off of the prior Kinsamanka work.
Searching for examples of projects using PICnc did not get any results. Is the project dead? It seems to be inactive for 7 years as of this writing.
My investigation into the project convinced me that it was a good starting point. So it was decided to go ahead and use this as the starting point for a Pi – PIC LinuxCNC controller.
The goal of the project was to:
Find reliable, readily available, inexpensive compute hardware.
Reduce the footprint of the controller.
Learn a little.
Have some fun.
Add as much flexibility to the system as possible.
There are two hardware platforms, the Pi and the PIC which necessitates two different software platforms.
The Pi code was built using Geany and compiled with halcompile.
The PIC code was ported to use a PIC32MZ, specifically the PIC32-HMZ144, clocking at 200 mHz, from Olimex. This work was done using Microchip MPLAB X IDE v5.40.
The build has resulted in a system that has:
32 optically isolated I/O pins, individually selectable as input or output.
5 optically isolated step & dir outputs
4 optically isolated pwm outputs
Stepgen 80kHz default
SPI clock 5 mHz default
Purchased Components:
RTELLIGENT R60X3 3 Axis Stepper Driver, powered by external linear supply.
Pi 4, 4gB
Olimex PIC32-HMZ144
12 V Supply, generic
5 V Supply, Mean Well LRS 35-5
My Components: I/O Block – an 8 bit interface, optically isolates the field devices from the logic The block used to interface the stepper driver does not have indicator leds nor their associated resistors installed. This is to reduce potential emi on these high speed lines. The yellow parts are the isolators which are flipped 180 degrees to switch from input to output. This is the electrical function, to change the logic a parameter file is used.
Bridge – This provides 5V to the Pi and it connects the Pi to the PIC with spi and handshake signals.
PIC32-HMZ144 Carrier- This board provides the pic to system connections via IDC connectors and it supplies 5 V to the cpu.
12 V Distribution- a modified I/O Board providing 16 tie points.
Reference:
github.com/kinsamanka/PICnc-V2
github.com/Wireb/PICnc-5axis
github.com/LinuxCNC/linuxcnc/blob/master...hostmot2/hm2_rpspi.c
Attachments:
Last edit: 05 Nov 2021 16:18 by dennis.lewis5. Reason: text formatting
The following user(s) said Thank You: Bari
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19196
- Thank you received: 6434
07 Nov 2021 22:21 #225594
by tommylight
Replied by tommylight on topic My PICnc Build
Sorry but i have to ask, what does all that cost as i would think that it will surpass the price of a tailor made Mesa board for RPI ???
Looks neat though.
Looks neat though.
Please Log in or Create an account to join the conversation.
- dennis.lewis5
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 5
08 Nov 2021 02:51 #225618
by dennis.lewis5
Replied by dennis.lewis5 on topic My PICnc Build
I knew that question was going to show up. I did not keep good records so I have a back of the napkin answer for you.
The I/O board was the most expensive to build and I calculate that it cost $8.90.
The Bridge was $3.00
The Pic Carrier $4.75
The PIC32-HMZ144 cost $20.00 (currently about $29 at Mouser).
So what you see of my PCBs the cost is about $35.00. That makes the total cost of the controller in the order of $55.
I know of Mesa but I do not know Mesa products. I think that if you look at total hardware cost you would see advantages to my approach.
If you miss-wire from the field to the Mesa what is the cost?
What is the cost to add opto isolation to the Mesa card?
Mesa cards have fixed number of inputs and outputs (from what I see). The limits of this project is 32 in any combination.
Mesa cards are much faster. Is that important in this project ?
I can add functionality to the pic. Not sure I could do that with a Mesa.
The PIC is currently using less than 2% of data space and less than 2% program space. Lots of room to grow.
I had to repurpose a chassis and was lucky to get everything shoe horned into it.
The I/O board was the most expensive to build and I calculate that it cost $8.90.
The Bridge was $3.00
The Pic Carrier $4.75
The PIC32-HMZ144 cost $20.00 (currently about $29 at Mouser).
So what you see of my PCBs the cost is about $35.00. That makes the total cost of the controller in the order of $55.
I know of Mesa but I do not know Mesa products. I think that if you look at total hardware cost you would see advantages to my approach.
If you miss-wire from the field to the Mesa what is the cost?
What is the cost to add opto isolation to the Mesa card?
Mesa cards have fixed number of inputs and outputs (from what I see). The limits of this project is 32 in any combination.
Mesa cards are much faster. Is that important in this project ?
I can add functionality to the pic. Not sure I could do that with a Mesa.
The PIC is currently using less than 2% of data space and less than 2% program space. Lots of room to grow.
I had to repurpose a chassis and was lucky to get everything shoe horned into it.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19196
- Thank you received: 6434
08 Nov 2021 09:41 #225646
by tommylight
Replied by tommylight on topic My PICnc Build
Well if you have the time, the price is OK then. And you have the nice feeling of building it yourself.
As for Mesa, they are by far the best company to deal with on earth, and PCW, the owner, is here on the forum helping all the time, and he does help with some strange requests, and never ever gets angry, although a few days back he had every reason to be angry!
I am not affiliated with them in any way shape or form, but i do have plenty (probably over 50) of their boards installed on new and old machines, never ever had a single issue with them for roughly 6-7 years.
Thank you for the details, i did venture into building some THC a while back, the time it took cost me way more than what a new one at Mesa costs, and Mesa one is fully integrated into LinuxCNC, mine was not. Nice experience though.
As for Mesa, they are by far the best company to deal with on earth, and PCW, the owner, is here on the forum helping all the time, and he does help with some strange requests, and never ever gets angry, although a few days back he had every reason to be angry!
I am not affiliated with them in any way shape or form, but i do have plenty (probably over 50) of their boards installed on new and old machines, never ever had a single issue with them for roughly 6-7 years.
Thank you for the details, i did venture into building some THC a while back, the time it took cost me way more than what a new one at Mesa costs, and Mesa one is fully integrated into LinuxCNC, mine was not. Nice experience though.
Please Log in or Create an account to join the conversation.
- dennis.lewis5
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 5
08 Nov 2021 14:57 #225697
by dennis.lewis5
Replied by dennis.lewis5 on topic My PICnc Build
Time? That is pretty much all I had the last 24 months. Had to do something to keep from going totally bonkers.
The following user(s) said Thank You: tommylight, Grotius
Please Log in or Create an account to join the conversation.
09 Nov 2021 01:48 #225750
by cakeslob
Replied by cakeslob on topic My PICnc Build
Looking good, did you just use wireb's code as is?
Ive had my eye on this picnc fork for a little bit github.com/cnc4less/PICnc-5axis
picnc hasnt had any updates in a while , but its spirit lives on in some of the newer things going on with other microcontrollers.
mesa is great and i will continue to give him my money because you honestly cant beat what they offer(he must be the most patient man alive) , but there is a surprising lack of entry level hardware diversity with linuxcnc , so keep on trucking , olimex is a solid choice also.
Ive had my eye on this picnc fork for a little bit github.com/cnc4less/PICnc-5axis
picnc hasnt had any updates in a while , but its spirit lives on in some of the newer things going on with other microcontrollers.
mesa is great and i will continue to give him my money because you honestly cant beat what they offer(he must be the most patient man alive) , but there is a surprising lack of entry level hardware diversity with linuxcnc , so keep on trucking , olimex is a solid choice also.
Please Log in or Create an account to join the conversation.
- dennis.lewis5
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 5
09 Nov 2021 02:52 #225759
by dennis.lewis5
Replied by dennis.lewis5 on topic My PICnc Build
The code was modified.
Added a parameter file to define:
i/o pins (p1...p32) as input or output.
specify number of axes, default = 3
specify spi clock rate, default 5mHz
specify stepper rate, default = 80 kHz
Changes were made to the Pi to move the i/o to the pic, synchronize the startup/config process, additional config command, additional config parameters, increased the spi buffer, beacon handling (fault checking) and to check for Pi 4, read and parse the new parameter file.
Changes to the pic was to handle the i/o (glue logic), increased the spi buffer, get the pwm functional, synchronize the startup/config process, additional config command, additional config parameters, no need for compile when changing number of axes.
Thanks
Added a parameter file to define:
i/o pins (p1...p32) as input or output.
specify number of axes, default = 3
specify spi clock rate, default 5mHz
specify stepper rate, default = 80 kHz
Changes were made to the Pi to move the i/o to the pic, synchronize the startup/config process, additional config command, additional config parameters, increased the spi buffer, beacon handling (fault checking) and to check for Pi 4, read and parse the new parameter file.
Changes to the pic was to handle the i/o (glue logic), increased the spi buffer, get the pwm functional, synchronize the startup/config process, additional config command, additional config parameters, no need for compile when changing number of axes.
Thanks
Please Log in or Create an account to join the conversation.
Time to create page: 0.097 seconds