Generated on: 2019-12-17 13:02:42
The idea is to programmatically design a speed dial to set the spindle RPM on a manual machine tool. In my case, a Delta DP220 drill press. Here’s a two speed dial for a Bridgeport mill and a three speed dial for a Powermatic 1150 drill press.
The canonical form of the problem needs to deal with the number of scales, the range of each scale, the resolution needed for machine operations, calculating ticks marks, creating the bands to fit in the available space, etc.
Inkscape’s Ruler plug-in could do this job, but it’s a fair bit of work to redo scales.
The drill press is setup with 4 step pulleys and a variable speed motor (VFD controller).
max_hz <- 70
min_hz <- 22
motor_pulley_diameters <- c(2, 3, 4, 5)
motor_rpm <- 1725
spindle_pulley_diameters <- c(7.25, 6.25, 5.25, 4.5)
The potentiometer and knob determine the dimensions below.
dial_gap_mm <- 2 # leave space around outside of dial
dial_diameter_in <- mm_to_in(45 + 2 * dial_gap_mm)
dial_rotation <- 312 # degrees
start_angle <- 270 - (360 - dial_rotation)/2
stop_angle <- 270 + (360 - dial_rotation)/2
mounting_hole_dia_in <- 0.375
dial_outer_edge_dia_in <- 3.426
Using a fixed number of divisions resulted in each of the scales having weird RPM values at major tick marks. Here is the speed range for each pulley ratio.
The table of raw data is.
First step is to normalize the scale end points. Picked a multiple of 5.
The scales data isThe Powermatic dial has a nice simple idea of showing speeds without tick marks. The slowest speed setting also has the fewest markings so it will be the smallest radius scale.
I didn’t work out a algorithm for calculating steps, but relied on experience for this trial set of values for the scale.
speeds1 <- c(700, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2235)
speeds2 <- c(480, 600, 800, 1000, 1200, 1400, 1530)
speeds3 <- c(300, 400, 500, 600, 700, 800, 965)
speeds4 <- c(170, 200, 250, 300, 350, 400, 450, 500, 555)
Experiment with Circlize to see what kind of dial can be produced. Messy code follows.
Dial rotational spacing is accurate. Need to address spacing details and fonts. Colored bands are a debugging aid.
# Define some parameters
font_size <- 14 #pt
circos.clear() # remember to always start w/this call
circos.par(
clock.wise = TRUE,
start.degree = start_angle,
gap.after = stop_angle - start_angle
)
# Outermost track/highest speeds
circos.initialize(factors = "speeds1", xlim = c(min(speeds1), max(speeds1)))
circos.track(ylim = c(0, 1), bg.col = "light blue")
circos.text(speeds1, rep(0.6, length(speeds1)), speeds1, facing = "outside", niceFacing = TRUE, cex = fontsize(font_size), font = 2, family = "serif")
circos.clear()
# plot exists at this point.
# Add center mark
lines(x = c(-0.1, 0.1), y = c(0, 0), fg = "lightgray")
lines(x = c(0, 0), y = c(-0.1, 0.1), fg = "lightgray")
# faint boundary for dial and hole for pot shaft
symbols(c(0, 0), c(0, 0),
circles = c(dial_diameter_in / 2, mounting_hole_dia_in / 2),
fg = "yellow", add = TRUE)
#circlize:::get_most_inside_radius() # For better setting canvas limits
# 2nd highest speeds
par(new = TRUE) # See code for fig 6.4, "Circular Visualization in R", https://jokergoo.github.io/circlize_book/book/advanced-layout.html#arrange-multiple-plots
circos.par(
canvas.xlim = c(-1.2, 1.2),
canvas.ylim = c(-1.2, 1.2),
clock.wise = TRUE,
start.degree = start_angle,
gap.after = stop_angle - start_angle
)
circos.initialize(factors = "speeds2",
xlim = c(min(speeds2), max(speeds2)))
circos.track(
ylim = c(0, 1),
bg.col = "yellow",
panel.fun = function(x, y) {
circos.text(
speeds2,
rep(0.6, length(speeds2)),
speeds2,
facing = "outside",
niceFacing = TRUE,
cex = fontsize(font_size),
font = 2,
family = "serif"
)
}
)
circos.clear()
# 3nd highest speeds
par(new = TRUE)
circos.par(
canvas.xlim = c(-1.4, 1.4),
canvas.ylim = c(-1.4, 1.4),
clock.wise = TRUE,
start.degree = start_angle,
gap.after = stop_angle - start_angle
)
circos.initialize(factors = "speeds3",
xlim = c(min(speeds3), max(speeds3)))
circos.track(ylim = c(0, 1),
bg.col = "red",
panel.fun = function(x, y) {
circos.text(speeds3, rep(0.6, length(speeds3)), speeds3, facing = "outside", niceFacing = TRUE, cex = fontsize(font_size), font = 2, family = "serif")
}
)
circos.clear()
# 4th highest speeds
par(new = TRUE)
circos.par(
canvas.xlim = c(-1.6, 1.6),
canvas.ylim = c(-1.6, 1.6),
clock.wise = TRUE,
start.degree = start_angle,
gap.after = stop_angle - start_angle
)
circos.initialize(factors = "speeds4",
xlim = c(min(speeds4), max(speeds4)))
circos.track(
ylim = c(0, 1),
panel.fun = function(x, y) {
circos.text(
speeds4,
rep(0.6, length(speeds4)),
speeds4,
facing = "outside",
niceFacing = TRUE,
cex = fontsize(font_size),
font = 2,
family = "serif"
)
}
)
circos.clear()
# circos.info()
Initially, won’t worry about creating PDF files because an SVG file is needed.
extrafonts packageshowfonts packageSometimes the fonts used are termed engraving fonts.
Save some paper calculations for possible later use.
# scale_tick_angle <- (start_angle - stop_angle) / scale_divisions
# stop_angle / scale_tick_angle
scale_band_width_in <- (3.4375 - dial_diameter_in) / 2 # 3 7/16 in
# min_scale_hz = round(min_hz / scaling_mod) * scaling_mod
# max_scale_hz = round(max_hz / scaling_mod) * scaling_mod
# # hertz_scale = seq(min_scale_hz, max_scale_hz, (max_scale_hz - min_scale_hz)/ scale_divisions)
#
# rpm_scale <- function(freq_scale, pulley_ratio, motor_rpm = motor_rpm) {
# return(round(motor_rpm * pulley_ratio * freq_scale / 60))
# }
# right now a band is 5/32" wide
Found 2 packages that offer some possibilities.
CRAN: https://cran.r-project.org/web/packages/BioCircos/vignettes/BioCircos.html#introduction.
Now try background track
So it seems like this package can be used to make a dial.