OK. Now I have a milling machine with a DRO (Digital
ReadOut) in my workshop so I can cut metal accurately. I like it, I like it a
lot, but this is 'hands on' machining. You turn on the spindle motor, a cutting
tool goes round and round and you work the handles so the job moves under the
cutter and is cut. Flat is pretty easy and so is straight. I first did this at
school and teenaged me was enthralled. However remember that now I have
Hitachi Seiki
, once a maker of large CNC (Computer
Numerical Control) machine tools, on my CV. I also admit that I had a
CNC controller
sitting next to my desk before
I retired so I could write and test interfaces for it. Hence, when I think of
machine tools I tend to think in terms of, at minimum, power feeds with
aspirations to full control to industry standards. CNC (Computer
Numerical Control) is the noble art of 'hands off' machining so... What I
really need is a comprehensive plan.
First point: I want a CNC option not a wholesale takeover. I want to cut
curves and (see the horrible picture on the right). Cutting curves by drawing
them on the workpiece and then juggling the X and Y handles to stay on the line
works but it doesn't really work. Conversely I see a lot of YouTube videos
where a mill has been CNCed to the point where just bunging a piece of metal on
it to flatten it off will involve writing the production g-code. That is not
what I want. I would like to do some CNC today and make a complex, designed
part, then tomorrow rough out a bit of mechanical fix-it by hand and maybe type
in a scrappy three liner to add a circle.
So, I have three axes and a spindle motor to control: I decided to go with a
simple stepper motor solution although this might/will probably call for the
positioning lead screws to be upgraded to precision ball-screws at some point
later on. Hence I need some stepper motors, plus the micro-step drivers and
PSUs to suit. I will use that Pi-5 I bought to try and a nice 15.6 inch touch
screen.
I was roughing out the software I would need to write when I came across
references to LinuxCNC. This looked rather
interesting and had to be worth a dig. Sadly the documentation is geek-ware.
That is: if you understand things already you can look up that obscure detail
you need in moments. Thankfully the manual is comprehensive, like 1400 pages of
comprehensive. Everything is there but there is no ELI5 (ELI75?) version
however. Sadly lots of the 'how I did it' videos on YouTube labour the obvious
and skip over the important.
Now after a lifetime in the business of computers and electronics they are
pretty much second nature to me now but I still need that first step to get on
board but all the examples I found jumped straight in with huge wire by wire
hook up guides and then a brisque 'use these files'. However, I sadly
discovered, that 'these files' were never quite enough to get a working
system.
I almost gave up several times but it does G-code. Real G-code! Like
proper CNCs
.
The one really good thing about LinuxCNC is the forum. Those guys have dug me
out when I was misunderstanding something and either explained it or pointed me
in the right direction to figure it out for myself. I've tried not to be a pest
and ask too many dumb questions but when I've been confused somebody always
helped.
<sigh> It looks like I'll have to write my own ELI75 guide...
Maybe this is it.
So, before we start let's be perfectly clear:
I offer this to the WWW as a totally unsupported example of 'this worked for
me' or at least I think this is what I did. If you copy it and the resulting
explosion wipes half your city and you thrown in jail forever that's not my
fault. I'm not promising this is in any way right, best practice, according to
the laws of where either you or I live nor conforms to Aristotelian ethics. It
may be fattening, cause cancer in rats and invoke the endless wrath of the
elder gods.
However may I wish you good luck. I found that rolling my own CNC was been lots
of fun.
Warning: I have put the information on how I set up the Pi-5 and the Mesa
7i95t card that I used near the end of this page so it didn't mess up with the
flow of the stepper motor installation (Click the Pi-5 on the bar at the top).
Naturally this is not how I handled it. The Pi5/Mesa combo was my tool for all
stages of testing the steppers and their signals.
Also: Watchout for the
popups
designated by the dotty underline as they are often used to clarify points.
Also when I refer to 'the archive' it is the place where I zipped up lots of
miscellaneous files and pictures that are relevant. Download
archive.zip. The usual caveats apply especially with
3D printer stuff but as you get the openSCAD source and the STL files so you
should be able to work it out. I didn't include the GCODE as isn't much use
unless you sneak into my workshop and steal my printers because it is heavily
optimised. Feel free to take off my logo and put on your own.
CNC, strategy, 42 and the Z axis
So the first thing I did was Ebay a nice 19 inch 3U cabinet in steel to install
all the components inside. I have too many very unhappy memories of things,
just connected by hook-up wire, skittering around on my bench and trying to
throw themselves on the floor while I'm trying to do software.
It didn't take long to realise that that Z feed wheel on the top, at the back,
would need to be considered first. Once installed on the bench, my bench is a
good height while my ceiling isn't, it would be a problem to even reach it so
winding in a big Z change could be tiresome to say the least. Hence the CNC
design work needed to start with deciding how to put a power feed on that as a
matter of priority.
Pick a stepper motor. There isn't a huge range available in commonly
available.
A simple check with a piece of wood, a piece of string and the old archery
'pull' gauge (probably just a rebadged suitcase scale marked up) shows the max
'stiction' torque winding upwards as variable but always less than 1.2Nm
(measured 0.27Kg at 38cms). Also an important note here is that the Z thread
gives 4mm travel per revolution.
So if I use a 4:1 belt drive with a Nema 23 stepper motor and controller I get
the motors 1.9Nm holding torque scaled up by 4 to 7.6Nm so that should be
adequate even as things get old and stiff (I know how that feels). Also the
motor's 200 steps per rev gives me 200 steps per mm (aka 0.005mm/step), more if
I want to multi-step it. The DRO also counts in 0.005mm steps aka 5
microns.
The Nema 23 is
a 58mm square, 76cm long
motor
with
a 1/4" shaft which I can get from StepperOnLine via Amazon. I will need a 10mm
wide GT2 belt to handle the tension at max torque.
I displaced the motor rearwards a bit to ensure it always cleared the
lock-screws and the support pillar.
The supplied Z axis
handwheel
is on a 10mm shaft with a 4mm keyway.
The big snag is that the whole quill assembly is hanging from the nut
holding the handwheel. (Do not undo it without locking the Z-axis clamps or
lowering the quill onto a block of wood or something first or it just hangs on
the keyway block.)
I ordered the stepper motor, a suitable controller (DM556T), an 80T 10mm bore
10mm belt wheel and a pack of 20T 6.35mm (aka 1/4inch) bore 10mm belt wheels. I
had a 48V PSU on the shelf already.
An
online calculator gives me 98.14mm between centres for a 300mm belt so I
also ordered 2 x 300mm x 10mm belts and plan around that spacing.
The stepper motor is rated for up to 1500rpm so 375rpm on the thread so 6.25rps
so 25mm/second travel at full speed. Seems adequate but we shall see.
First I will need a mounting plate. If I replace the four M8 15mm cap head
bolts holding the top onto the vertical slide with longer ones and use sleeves
to transfer the tightening load from the base of the plate to the bottom of the
counterbores I can select the length of the sleeves to align the ends of the
belt. A quick check in the nuts and bolts draw came up empty handed so I
ordered some 70mm M8 bolts. Probably too way long but they will cut down easily
enough.
OK the top of the pillar is dimensioned in funny units and made in calliper
unfriendly curves so I mocked up my initial
. It
was worth doing this as it was wrong and tweaking a number and hitting reprint
is way easier than trying to recut precise holes in steel without, as yet, a
DRO. The
final
version
was plasma cut in 4mm steel for about £30.
Well the shaft at the top of the Z-screw was long enough for the handwheel or a
pulley but not both. So I
turned the pulley boss
down
so it
was the same thickness as the handwheel and broached a keyway in it. To get the
handwheel back on I drilled and tapped the pulley for three M8 bolts, made
some more spacers in
brass
and a
top plate and
'bolt'
with matching keys to suit the handwheel and it just bolted on and felt
perfectly rigid.
So I tried to design the plate in LibreCAD but decided to write a file to be
converted into LibreCAD commands which I shall include.
Here is a list of the files for the Z-axis system in the archive.
Z-plate.dxf
Z-plate CAD file that I sent to the laser cutting people
Z-cover.scad
OpenSCAD file for the box part of the cover
Z-cover.stl
STL image for 3D printing
Z-chimney.scad
Tube to cover the handwheel mount
Z-chimney.stl
Z-sensor.scad
Microswitch mount for Z axis top/home switch
Z-sensor.stl
The 3D printer did a lovely cover and an 8 way cable carries lines for the two
motor windings, the up/down switches and the top limit switch.
There is a LED in series with the limit switch that illuminates when the limit
is reached.
I also made a carrier for a standard lever microswitch which goes at the top of
the pillar and can be seen in the picture bottom centre. It is tripped by the
top Z motion lock screw.
I set the switches on the driver module as
SW1
on
2.7A RMS
SW2
on
SW3
off
SW4
on
Full current
SW5
off
400 pulses/rev (2 pulses/step)
SW6
on
SW7
on
SW8
on
I will discuss the wiring in the Mesa section.
X axis
The X axis was more of a problem fitting stuff in. I made a plate that mounted on
the bolts astride the handwheel and shaved down the pulley to make things fit with
both the pulley and the handle on the shaft. Then I had to grind back the heads of the
(longer) bolts to clear the back of the pulley.
At the other end the cable inlet needed a specially made right angle shroud so
as not to foul the surrounding parts and still be able to flex as both X and Y
move.
In the middle I needed to make a 3D printed part to work the microswitch to
provide the limit switch. All the covers are retained by M6x30mm knurled
clamping knobs.
The motor is a Nema17 running on a TB6600 driver on a 36V PSU with a 5mm GT2
belt on 80/20 tooth pullies.
I set the switches on the driver module as
SW1
on
Step mode 2A, 400 steps per rev
SW2
off
SW3
on
SW4
on
Current 1.0A (Max 1.2A)
SW5
off
SW6
on
All the part files are in the archive using the same conventions I used for
Z.
I have considered reprinting the case to make it more closed to protect the belt
from swarf. Doing the front edge doesn't seem too hard but the opening for the
limit switch is more of a problem so it hasn't happened yet.
Y axis
The Y is a similar design concept but with a far more complicated shape to
negotiate all the mill parts and the DRO encoder. The blue round part in the
middle is a cap to go over a convenient bolt head to make it trip the limit
switch. Frankly it is not as swarf resistant and I hoped and might need a
printed backplate to improve the seal.
Also removing the little settings turner under the handwheel did not give as
much spare shaft as the X one did so the wheel intrudes into the casing a
bit.
The rest of the details pretty much match the X axis although a normal, off the
shelf, cable entry gland can be used.
Incidentally my use of 8 way plug and socket green connectors in a 3D printed
screw down clip that worked other places was a sad mistake here. It is just too
bulky and the wires just can't get round it without being carefully dressed
every time I want to put the lid back on. I can't make the case deeper as I
have already had to chamber the place where the hand wheel fits into it.
Consider it not finished but not worth rebuilding while there are more
important bits to do.
Jog Buttons
My Jog buttons aren't Jog buttons. There are perfectly good jog buttons on the
touch screen with scale, step, speed selections and step or continuous modes,
plus, of course I could use the pendant. However to use them you must first
home the motion system so it knows where things are so it doesn't do anything
stupid.
However a big part of my motivation to start this project was just that the
Z-axis wheel was definitely not in a convenient position and I wanted to power
operate it. These Jog buttons work when you just power up the system and in
fact the simple interface I use doesn't even work once the system is homed.
However I can flip on the CNC power switch and as soon as the Pi has booted and
started linuxcnc enough to actually run the stepper motors these switches will
work.
So I have my switches, nice, centre off, sprung to the centre rocker switches
built into the protective covers over the stepper motor belts and wired back to
the 7i95t.
The code is in jog.hal and all it
does is copy the debounced (slow) button signals to the halui.joint jog
inputs which do work 'pre-homed'.
Pendant
I admit I bought this toy because I remember the dials in HS machines and I
wanted one. It's a pretty simplistic Chinese device but it was relatively cheap
on AliExpress.
I bought the model with the long springy cable and a 'wires only' interface and
hooked it up to a DB15 plug so it was easy to attach. You can see the pinouts
in the files but I ended up wiring the plug
like this. and I swapped
the resistor on the LED so it ran on 5V not 24.
The pin numbers are for my DB15 and they connect to the 7i95t's input pins with
the commons taken to 5V to provide a pull-up.
Here are the connections to the 7i95t:
1
Lamp+
TB5-19
OUT03
2
A
TB6-1
IN1
3
B
TB6-2
IN2
4
A-
5
B-
6
MPG+5V
bus
7
E-STOP
TB5-11
IN23
8
GND
bus
9
X
TB5-1
IN16
10
Y
TB5-2
IN17
11
Z
TB5-4
IN18
12
4
TB5-5
IN19
13
x1
TB5-7
IN20
14
x10
TB5-8
IN21
15
x100
TB5-10
IN22
TB5-3,6,9,12 and TB6-3 are connected to +5V (they provide a 4K7 pull-up to the
pins)
The system is controlled by
mpg.hal which is a deviant form
of the mpg.hal in the LinuxCNC manual. I had to add a fast thread to
accumulate the steps, something that the 7i95t driver does not usually need,
and to convert their multiplexer friendly switch inputs to something to manage
my three wires. This is the point where I discovered I could write my own HAL
components and do it in C making it all simple (see
sel3.comp).
NB: This is the exact opposite of my jog buttons in that it only works
after you have homed the system.
I have coded the speed switch settings as x1 = .001mm, x10 = 0.01mm and x100 =
0.1mm so you can tweak to more detail than the motion system can deliver but
still do a 10cm rapid on a single turn of the handle.
I have a preliminary system to control the spindle speed from the MPG using the
axis4 channel. Press the button and move the dial and it takes over the spindle
speed. Hold the button for ten seconds without moving the dial (configured in
mgp.hal) and it drops control and reverts. Later I aim to add 'if a program is
running then use Axis4 to control the spindle override function'. This is all
software.
Spindle speed control
Well the 7i95t promises a PWM (Pulse Width Modulation) output and that is why I
am using the 7i95t_1pwmd.bin firmware load.
Halshow reveals the hm2_7i95.0.pwmgen.00.enable and
hm2_7i95.0.pwmgen.00.value pins, I connected and a quick test shows that
with .enable true .value is 0 to 1.0. Pin TB4-8 (STEP5-) being solid high at
0.0 and all low at 1.0 with TB4-9 (STEP5+) being the opposite. The oscilloscope shows these outputs when set for
300rpm on my system configured for a 1500rpm max (ie: one fifth of the time the
line is active), pin8 is at the top trace and pin 9 at the bottom.
I wrote a preliminary spin.hal and called it from postgui.hal. This did nice
tests into an oscilloscope but now I needed some hardware to drive the 0-10V
input:...
...allowing for the annoying fact that the speed
controller on this mill is live to mains power.
I decided to make a box to go under the current controller because, although
there isn't much in the existing compartment, it somehow manages to not have
much space left either. The lid of my box is permanently bolted to the bottom
of the existing spindle control box (dismantling everything to drill it while
protecting the electronics from swarf was a bit fraught). My new parts all go
in the bottom part which has 4 M3 bolts into
hot-fix brass
ferules
in the lid to make it easy to release to work on it. (Use a soldering iron tool
at 250°C.)
The original plan, due to the 'live' speed controller's disrespectable attitude
to mains power, was to use a simple opto-isolator fed resistor/capacitor
low-pass filter (charge/discharge) circuit to swap in on the three wires to the
speed control knob with no active parts. Disappointingly I could neither get it
up to 10V nor any semblance of linear. So I found a compact, uncased 24V PSU on
Amazon and put that in the box with the PWM signal feeding through an
opto-isolator and now having lots of voltage headroom made things more
manageable.
You can see from the schematics that what I did was to add
a pair of high current relays to takeover the motor
direction wires so I can subvert the existing L-0-R reversing switch,
a solid state relay to actually turn the motor system on and
off
a small relay to take the speed control potentiometer off line and
substitute the smoothed PWM signal via a high voltage opto-isolator.
NB: Remember the potentiometer is a 'high insulation' part (because mains) and
if you break it trying to get the knob off (spoiler: slacken the 10mm nut under
the cover) Amazon lists them for £43 next day and AliExpress for 49p two
weeks.
This provides for 'normal' mill operation if the CNC box is calling for spindle
rotation and full spindle control ignoring the normal controls when the on-line
relays pull in.
The spin.hal also provides delay functions so that on issuing an M3 the
direction relays are allowed a moment to settle before the power comes on and
then the spindle is allowed some more time to get up to speed before the
ensuing motion commands are allowed to be executed.
The file also contains two implementations of demanded spindle-rpm to PWM value
translation. The first is the simple linear model where 0 is 0, 1500 is 1.0 and
everything else is just factored in. I used this for initial testing and it let
me use the MPG to dial up and down but it is not realistic. The second is a
table based system to get round the differences between predicted and actual.
The controller isn't 0-10V as its documentation says but maxes out at about
5.7V in and is not very linear. I could adjust the resistors to get less than
10V on full scale but the table give quite reasonable results. This will do
until the feedback control is built.
Speed
I wanted to send the spindle speed back to close the loop and servo control the
spindle speed. I decided to accomplish this by fitting an additional
opto-sensor to the 60 tooth chopper wheel in the head (because mains) so I
pulled out the now redundant lead to the front tool guard hinge and put in a
thin 3-core cable. This involved dismantling the power controller hinging arm
and was not, I must confess, the most pleasant wiring job I've done
recently.
I powered it with the 'on-line' 5V and linked the wires in my additional
control box and fed it to encoder 5 on the 7i95t as +QA5 TB2-17.
Then I needed to switch the encoder into counter mode and scale it for rpm so
I added these lines to spin.hal:
That gives me an RPM value in hm2_7i95.0.encoder.05.velocity-rpm
It's a bit noisy...
DRO
OK so I have the DRO and its 0.005mm linear encoders and I wanted to get that
data onto the Pi and ideally for it to be of use to LinuxCNC to frig out some
of the remaining 0.15mm backlash in my lead screws.
However there are snags all the way down.
Well electrically I was pleasantly surprised. There are two ways DROs connect:
a two wire RS422 derivative or alternatively bog-standard TTL that was my bread
and butter for decades. The 7i97t has provision for both but the RS422 doesn't
share nicely so I'd need a buffer. Get out the 'scope and it's bang-bang rail
to rail 5V. Fake, but the best fake, TTL. A quick check that my earths are
safe and I can wire it straight in. I put pairs of IDC DB9s male and female
on the CNC computer box ad plugged the linear encoders into one and a M-F
extender cable into the other to go to the DRO box. Everything worked boringly
well.
There are, unfortunately, three or four wildly incompatible ways the 9 pin plug
can be wired. I google for them then prodded about with the 'scope and it was
pretty obvious which one mine was. 2 GND, 6 A, 8 B. Hence I wired:
X
Y
Z
2
TB1-3
TB1-11
TB1-19
GND
6
TB1-1
TB1-9
TB1-17
A
8
TB1-4
TB1-12
TB1-20
B
In the setup (see mesact later) I set the encoders to -200 aka 0.005mm and
negative because we want the tool position when we are really measuring the
bed.
This delivers X counts into hm2_7i95.0.encoder.00.counts and millimetres to
hm2_7i95.0.encoder.00.position
Use encoder.01 for Y and encoder.02 for Z.
Pi-5
OK if you know Linux and the Pi5 this is going to be something you just dip
into to see if I did it right.
If you use something other than a Pi then some of the discussion of
Linux/Debian may help.
Why the SSD?
Although SD cards aren't bad they have slightly dubious rep in Pi circles and
anyway, the thing runs much faster on the SSD and we all like faster. Any
reason for picking that particular interface card/hat style? None. Luck of the
early adopter draw I guess. I like this implementation because the ribbon cable
curves round the SD card holder and has allowed me to pop in a standard
Rasberryian SD and run something Raspberry specific to do test/set up
things.
Why 8G?
Same thinking. 4G will probably do but if I want to grow my own stuff on it
needing to upgrade would suck. In fact with the Mesa card doing the timings a
Pi-4 would probably more than adequate.
Add to that the Mesa 7i95t interface card that actually costs a lot more
than the Pi but it does all the heavy lifting in communicating with the Mill.
There are other ways to do it but the 7i95t has a lot of IO and does its own
internal step timing so you are not dependant on software running on the Pi to
apply precise ticks to the drivers.
I used a 16inch/40cm touch screen with oodles of resolution. Touch on the Pi
admittedly isn't good with known bugs going back years so I have experimented
with a hand held bluetooth keyboard/mousepad but it's a bit small for my fumbly
old fingers. I placed the Pi so its ports faced out of the front panel of the
case so I can revert to a standard keyboard and mouse if required.
ELI75 style
I'm assuming your not 5, not computer illiterate and
capable of googling if I use big words like sudo.
These are my notes. Brief notes or I'd be all day typing it. If you get to the
screen I'm talking about my one word comments will probably make more sense.
Yes I am 75 as I write this.
Basic Pi setup
I am assured need LinuxCNC 2.9 to handle the Mesa card I have so:
download the Pi5 version of 2.9.3 from
https://linuxcnc.org/downloads
mine was rpi-5-debian-bookworm-6.1.61-rt15-arm64-ext4-2023-11-17-1520.img.xz
Burn into a 16G SD with the Raspberry Pi Imager
I think using a smaller card helps setting up as this makes the
copy to SSD faster. You don't need big yet but use what you have.
Plug in the monitor/mouse/keyboard/power
Log on with username/password cnc/cnc
Open a terminal window.
Notice at the right of the top toolbar the
four
boxes
.
These are 'alternative' windows. You can open the configuration program in one,
edit text in another and run linuxcnc in yet another. However beware. Letting
the configuration program change a file you have open will not change that file
in that editor and just going 'save' will probably all end in tears. (Also as
the mouse wheel steps through these windows so if your display suddenly
vanishes you probably just touched the wheel)
If the text on the terminal window is stupidly small due to using a high
resolution screen, small size monitor or low resolution eyes:
select Edit | Preferences | Appearance | Font
increase the number at the end of the first line from the default 12 to 17 or
above.
run sudo menu-config
Wireless | Activate a connection | NIGNET-5G etc.
Hostname:
Pi-CNC
Networking:
Activate: NIGNET-5G
Keyboard:
Generic 105 | Other | English (UK) | English (UK) | OK OK No
Timezone:
Europe London
Quit
Then I did
sudo reboot
so I got the name, the wifi and the keyboard active
Create the usual update job:
nano update
remembering nano is not a mouse program so move the cursor with arrow
keys and put these lines in
^O<enter> to save ^X to exit
don't forget to make it executable with
chmod +x update
Then run it, there was a bit to do
./update
And run it regularly.
Turn off the 'auto power down' feature before it drives you mad
Applications | Settings | Power Manager
General
When power button is pressed: Shutdown
Display
Display power management | Off
Security
Automatically lock session | Never
Lock screen when system is going to sleep | uncheck
Now copy the SD to the SSD
These are the instructions for my unit, yours may differ but they usually put
it in the box notes
(if it refers to a Raspberryian program it's good but you don't have it
so modify my command line by changing the out-file from /dev/nvme0n1 to yours
sudo poweroff, pull out power, pull out the SD, power up again. We are
now running on the SSD with LinuxCNC in the Activate menu ready to go. Advanced Pi setup OK. What I really want to do is to access this system
from my familiar old desk top PC with its three big screens and my big
comfortable chair not standing in the workshop.
That means I want to click on an RDC client in Windows and get a user screen
into the Linux system and that the 'disk' drive comes up as a network device on
my Wifi so I can copy files about as normal.
You need the Pi's IP address
hostname -I note that is a
capital i. Mine is 192.168.1.220
Install RDC so we can access it from a PC
sudo apt install xrdp -y
it starts itself.
NB: you have to log out the screen to login to cnc/cnc over the RDP as you can
only have one user cnc logged in at a time.
Run RDC on a windows PC, put in the ip address, click Save and put it on your
desktop. Open, use advanced to put in cnc as a username, password, save my
credentials et al. You should be rewarded by a window into your Pi5.
To get rid of the "Authentication is required to create a color managed device" message
comment out with ; the [homes] section header and following 6 lines right down
to the next section
then add at the bottom (if you're using xrdp/RPC and nano just cut and stick it
from here)
[cnc]
comment=Share folder with PC
path=/home/cnc
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=no
save the file, generate a samba user called cnc with a password cnc using
sudo smbpasswd -a cnc
cnc
cnc
Now open \\Pi-CNC in the Windows Network explorer
expect to find a folder cnc
It will ask for credentials: cnc/cnc
don't forget to tick the 'Remember my credentials' box.
Drag the \\Pi-CNC folder onto your desktop for easy future access.
The screen I have needs more power so I need the Pi-5 1.6A option not the
default 0.6A mode
see
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#usb-boot-and-power-supplies
about half way down
run it
rpi-eeprom-config to view the eeprom boot settings (works on Debian)
I got
[all]
BOOT_UART=1
POWER_OFF_ON_HALT=0
BOOT_ORDER=0xf461 this is SD then NVMe boot order
I want to add
PSU_MAX_CURRENT=5000
USB_MAX_CURRENT_ENABLE=1
HOWEVER edit mode won't run on Debian (it complains it is a Pi4 for some reason)
so I plugged in a 'proper' Raspbrian Pi5 SD and it booted that
run
sudo -E rpi-eeprom-config --edit
this is nano, edit it, wait for it to finish and
Remove the SD and repower to be back on the SSD.
That fixed it.
Mesa 7i95t setup
OK so what is this rather expensive and bulky Mesa 7i95t and why do I use it?
Convenience really.
The Raspberry Pi interface looked a bit fraught to me as when I was first
planning all this I did not understand HAL or much about the way things worked.
I was worried about getting a long way down the line and finding myself on a
no-through-road situation. Knowing what I do now that might not be true now but
I am certainly pleased with the Mesa and the level of support it gets in the
LinuxCNC community.
So what does it offer?
It is a big 20K gate field programable gate array that bandies about numbers in
the 100MHz zone.
The default field programable implementation provides:
Position encoders
6
Servo/Stepper drivers
6
Input pins
24
Output pins
6
Some serial port stuff
2
I chose to use a non-default but quite standard load that swaps out the last
servo/stepper driver for a PWM implementation so I can do an analogue spindle
speed control (which you have probably already read about above).
Jumpers
W15
DOWN
Use IP address from EEPROM
W16
UP
ie:10.10.10.10
W17
UP
All P1 pins pulled up to 5V (how it came)
W18
DOWN
5V Breakout power off (default)
W21 W19 W13
LEFT
Encoder 0 single ended (for my TTL DRO)
W11 W9 W7
LEFT
Encoder 1 single ended
W5 W3 W1
LEFT
Encoder 2 single ended
W22 W20 W14
RIGHT
Encoder 3 double ended (default)
W12 W10 W8
RIGHT
Encoder 4 double ended (default)
W6 W4 W2
LEFT
Encoder 5 single ended for spindle speed
So problem 1: we need to connect it up.
Well the 5V is easy. I have 30A of the stuff available.
Networking is not so instantly obvious.
Well it is obvious.
The Mesa card plugs into the Pi with a 10cm cat6 jumper and the rest of the
world uses WiFi.
Now we just need to explain that to the Pi...
Dual networking:
I want 192.168.1.220 to be on my wifi
and 10.10.10.11 on the Ethernet stubby
The default seems not to do it so change to Network Manager
This added a networking icon on the toolbar (a sort of bar graph thingie)
A reboot killed everything but a power off, wait, on made it better
with a wifi connection.
However clicking the icon ended up with a "System policy prevents wi-fi scans"
dialog and a system hang when trying to password it.
I think I selected wired and + and selected ethernet...
Ethernet | Wired Connection 1 | gear icon bottom left
Ethernet tab
device: eth0 (should be already)
IPv4 settings
method: manual
address: 10.10.10.11 / 255.0.0.0
To get rid of the stupid lock you up message
sudo su
cd /etc/polkit-1/rules.d
nano 50-123.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.NetworkManager.wifi.scan") {
return polkit.Result.YES;
}
});
save etc.
No I haven't a clue what it does but it works.
You don't appear to be able to configure networking over the network, makes
sort of sense, so that must be done on the real screen et al.
Anyway it all seems to work now. MesaCT
OK so now we have a card with 5V and an ethernet connection we need to
configure it so that LinuxCNC know it is there and how to talk to it.
Well the official kit hasn't go that far yet but a gentleman has stepped into
the breach, understood and coded the solution to the problem and then given
it to all us freeloaders to use. Use the forum. You'll meet him there. Smart
guy and very helpful.
This is my configuration. It started as a minimum system to launch for test
with no switches et al
I just kept pushing the 'Check Config' menu item to see what is missing
Then when things worked I kept adding stuff
This is where I ended up:
it says 'not downloaded' so:
Select Download menu and Firmware and it does it.
Mesaflash tab
This offers several firmwares the default is 7i95t_d.bin so I verified
it and it matched. (deselect reselect to get display)
I changed this to get PWM outputs and so used: 7i95t_1pwmd.bin
6 Axes of Step and Direction
6 Encoder Input
1 Smart Serial Port
1 PWM (only on the PWM firmware)
24 Inputs
6 Outputs
P1 Daughter Card
Run the menu item Applications | CNC | LinuxCNC
Chose My configurations | NigMill | NigMill
and check the 'Create Desktop Shortcut'.
OK
The first time you launch it you have to 'Mark Executable.
If you don't have the card yet it configures OK but won't run.
Mesa Wiring
Click through for zoomable PDFs.
And finally
So I clicked Home All on the touch screen and...
Pride goeth before destruction, and an haughty spirit before a fall. Proverbs 16:18
So all the wiring was finished, I had written it up and that was it. The
hardware was done. Time to finally put it on the bench so it can earn its
living.
So I started to action the cunning plan for a 75 year old to reposition a
machine tool that weighs more than he does.
The winch lifted the mill to the required height and I pulled out the workmate
it has sat on for months and rolled in the platform I had arranged on the
welding trolley. Then I started to manoeuvre the trolley into a position to
slide the mill onto the bench.
Then the welding trolley collapsed in slow motion and finally dropped my lovely
mill on the floor. Trolley not as strong as I thought apparently. Oh
well.
I debated a bit (I didn't cry) and then messaged Joel (next door) and he was
home and happy to come round and help. We picked it up and got it on the bench
but there is damage. The Y control box is utterly scrapped with even the 4mm
steel plate it is based on bent and there will be lots of 3D reprinting to do
all over. Sadly the X handle wobbles as you turn it so that's
bad news on the leadscrew. However I first invested my
time in getting it bolted all down before starting on a total damage report.
It's only metal and plastic. It can be fixed.
Just don't ask what I'm doing for Christmas. My brother says 'fitting
ball-screws because they are so much more accurate than that bent acme thing'.
I'll update the last picture as the repairs continue. The current one has the X
and Y drivers dismantled and the bent Y-plate has been percussively reformed (I even got
the creases out of the welding trolley). Some redesign and 3D printing are
in progress. Currently the Pi-5 only WiFis with the driver box lid off as I
haven't got the bits yet to put an exterior aerial on it yet.