Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.
The Arduino Mega behind the LCD panel communicates serially through the Serial1 hardware, leaving the USB connection available for its usual console + program loading functions. The cable also carries +7 VDC for the Mega’s on-board regulator, plus a few bits that might prove useful, and enough grounds to be meaningful.
The pinout on the DE-9 female back-panel connector:
TX (Mini -> Mega)
RX (Mini <- Mega)
Current sense amp
D4 Enable ATX
Gnd
+7V regulator
Gnd
Gnd
Gnd
Which looks like this:
Kenmore 158 UI – cable at motor controller
One could argue that I should use insulation-displacement connectors and pin headers, but there’s something to be said for a bit of meditative hand-soldering.
The 7 V supply drops about 90 mV through its slightly too thin wire. With current around 100 mA, that works out to 900 mΩ, including all the connectors and gimcrackery along the way. Close enough.
More cogently, one could argue that I should have used a DE-9 male connector, so as to remove the possibility of swapping the cables. So it goes. The pinout attempts to minimize damage, but ya never know.
The green jumper on the Mini’s serial pins reminds me to unplug the UI cable, lest I plug the USB adapter into it and put the serial drivers in parallel.
The 7 V regulator stands over on the left, powering both the Arduino Pro Mini and the Mega + LCD panel. My thumb tells me that piddly little heatsink isn’t quite up to its new responsibilities, unlike the now vastly overqualified heatsink on the ET227. On the other paw, that’s why I used a pre-regulator: so that same heat isn’t burning up the SMD regulators on the Arduino PCBs. Time to rummage in the Big Box o’ Heatsinks again.
That lets me position the whole affair to the right of the sewing machine, in what seems to be its natural position, without having the cable form a loop that would push it off the platform. It’s not entirely clear how we’ll keep a straight cable from pulling it off, but that’s in the nature of fine tuning.
Anyhow, rotating the LCD isn’t a big deal, because the Adafruit library does all the heavy lifting:
// LCD orientation: always landscape, 1=USB upper left / 3=USB lower right
#define LCDROTATION 3
... snippage ...
tft.begin();
tft.setRotation(LCDROTATION); // landscape, 1=USB upper left / 3=USB lower right
Flipping the touch screen coordinates required just interchanging the “to” bounds of the map() functions, with a conditional serving as institutional memory in the not-so-unlikely event I must undo this:
#if LCDROTATION == 1
p->x = map(t.y, TS_Min.y, TS_Max.y, 0, tft.width()); // rotate & scale to TFT boundaries
p->y = map(t.x, TS_Min.x, TS_Max.x, tft.height(), 0); // ... USB port at upper left
#elif LCDROTATION == 3
p->x = map(t.y, TS_Min.y, TS_Max.y, tft.width(), 0); // rotate & scale to TFT boundaries
p->y = map(t.x, TS_Min.x, TS_Max.x, 0, tft.height()); // ... USB port at lower right
#endif
The solid model shows two screws holding the PCB in place:
Arduino Mega PCB Mount
I decided to edge-clamp the board, rather than fuss with the built-in screws, just because 3D printing makes it so easy.
Of course, the UI needs a real case that will hold it at an angle, so as to make the LCD and touch screen more visible and convenient; this mount just keeps the PCB up off the conductive surface of the insulating board we’re using in lieu of a Real Sewing Platform.
This sewing machine project involves a lot of parts…
The Kenmore 158 sewing machine crash test dummy has plenty of light:
Kenmore 158 LED Lighting – first light
Well, as long as you don’t mind the clashing color balance. The needle LEDs turned out warmer than I expected, but Mary says she can cope. I should build a set of warm-white LED strips when it’s time to refit her real sewing machine and add another boost supply to drive them at their rated current.
Much to our relief, the two LEDs at the needle don’t cast offensively dark shadows:
The DC-DC boost power supply for the LED needle lights has four mounting holes, two completely blocked by the heatsink and the others against components with no clearance for screw heads, soooo …
3D printing to the rescue:
Boost converter – installed
Now that the hulking ET227 operates in saturation mode, I removed the blower to make room for the power supply. Two strips of double-stick foam tape fasten the holder to the removable tray inside the Dell GX270’s case.
It’s basically a rounded slab with recesses for the PCB and clearance for solder-side components:
Boost converter mount – as printed
The solid model shows the screw holes sitting just about tangent to the PCB recess:
XW029 Booster PCB Mount
That’s using the new OpenSCAD with length scales along each axis; they won’t quite replace my layout grid over the XY plane, but they certainly don’t require as much computation.
I knew my lifetime supply of self-tapping hex head 4-40 screws would come in handy for something:
Boost converter in mount
The program needs to know the PCB dimensions and how much clearance you want for the stuff hanging off the bottom:
PCBoard = [66,35,IntegerMultiple(1.8,ThreadThick)];
BottomParts = [[1.5,-1.0,0,0], // xyz offset of part envelope
[60.0,37.0,IntegerMultiple(3.0,ThreadThick)]]; // xyz envelope size (z should be generous)
That’s good enough for my simple needs.
The hole locations form a list-of-vectors that the code iterates through:
That’s the first occasion I’ve had to try iterating a list and It Just Worked; I must break the index habit. The newest OpenSCAD version has Python-ish list comprehensions which ought to come in handy for something.
The “Z coordinate” of each hole position gives its rotation, so I could snuggle them up a bit closer to the edge by forcing the proper polygon orientation. The square roots in the second two holes make them tangent to the corners of the PCB, rather than the sides, which wasn’t true for the first picture. Fortunately, the washer head of those screws turned out to be just big enough to capture the PCB anyway.
I ran across your blog on Smart Beaconing and saw something that needed correction.
You state the Turn Slope is in units Degrees / MPH
This is incorrect. Although the term Turn Slope is not a real slope (such as rise/run classically) that is what the originators used albeit incorrectly. They do however correctly attribute the units to MPH * Degrees (a product and hence not really a slope).
In their formula they calculate a turn threshold as:
turn_threshold = min_turn_angle + turn_slope / speed
Looking at the units we see:
= Degrees + (MPH * Degrees) / MPH
which yields
= Degrees + Degrees
Which makes sense. It is too bad that the originators used the wrong term of Turn Slope which confuses most people. A better term would have been Turn Product.
In looking back over that post, I have no idea where or how I got the wrong units, other than by the plain reading of the “variable name”.
As he explained in a followup note:
As for units… I was introduced to making unit balance way back in 1967-1968 science class in HS by a really fine science teacher. It has served me all my life and I’m thankful for that training.
I have ever since told that teacher so!
A while back, our Larval Engineer rammed an engineering physics class head-on and sent me a meme image, observing that I’d trained her well: if the units don’t work out, then you’re doing it wrong.
Aren’t those just the ugliest buttons you’ve ever seen?
The garish colors identify different functions, the crude shading does a (rather poor) job of identifying the states, and the text & glyphs should be unambiguous in context. Obviously, there’s room for improvement.
The point is that I can begin building the UI code that will slap those bitmaps on the Arduino’s touch-panel LCD while responding to touches, then come back and prettify the buttons as needed. With a bit of attention to detail, I should be able to re-skin the entire UI without building the data into the Arduino sketch, but I’ll start crude.
The mkAll.sh script that defines the button characteristics and calls the generator script: