This is just complaining, mostly: unrepeatable problems

I wired up an arduino to a L298, and hooked that to a stepper motor, and put together a simple half-stepping sketch, and it worked beautifully first time. yay. That was last night. Tonight I was going to add an on/off and direction reverse functionality, so I plugged everything in, and the stepper didn’t rotate. It just jigs back and forth.
I replaced:
the arduino,
the wiring harness,
the L298
The wiring from the 298 to the stepper
the stepper motor itself
the power supply
and ohmed out every wire to make sure it was still connected
and checked the signals on my scope to make sure that there were no shorts and the signals at the input to the stepper motor were out of phase with each other on each winding.
And everything is correct, so I give up. Tomorrow I’ll check the windings on the stepper motors to see if one magically burnt out running on 1/5 the amperage it’s rated for and the other was already damaged before I picked it up but I’m too annoyed right now.

I feel like most days I should just stick with software.

Ugh!

Stupid question time: Why an h-bridge instead of a dedicated stepper driver? Just because you can, or is there an engineering reason that it’s better for the task you are using it for?

In short, because I bought a dozen l298 boards at one point for experimenting with servo drive algorithms, so I had them available.

1 Like

“All electronic problems are repeatable once you know what causes them” …

Hang in there we all have these what I call “clown days”!

1 Like

when stepper motors jig forth and back than you have swapped or cross wired the motor coils. A1A2 and B1B2 are coils, likely it’s connected as A1B1 and A2B2. I made this mistake many many times…
good luck!

Well, I guess now I have to stop complaining. Tonight I checked the windings on the stepper, which were fine, and I hooked it back up to the L298 and used a bit of wire to trigger the inputs, and made the motor rotate, so I hooked the arduino back up and wrote some simple code of the drive one pin high and all the others low, and that worked, and I rewrote that several more times until I was back at the same program I’d been running last night, and it’s working just fine, as it was two nights ago, and I can’t get it to fail. Connections the same, as verified by photos I took when I was debugging it. Argle bargle. But at least it’s working. This is going to turn into a simple stand-alone driver to power a second screw I added to my lathe years ago, so I can power-feed the carriage without wearing out the nice, expensive, not-made-in-50-years leadscrew I use for threading. I’d previously been using a gearhead motor. Now I can put together a little driver with a speed control potentiometer, a forward/reverse button, and a drive/stop button, and have a very fine auto feed. (I simply cannot feed as smoothly by hand as an autofeed. I’ve tried for decades. The leverage of the traverse handle changes as it rotates, no matter how careful I am to wrap my hand around the entire handle and try to rotate it rather than cranking it.)

1 Like

I’ve accidentally changed code in the arduino IDE without realizing it in the past. I don’t like the editor. Also, given all the magic copy-files-to-/tmp-to-build magic in the IDE, it’s also conceivable that there’s a caching bug. (We all know that the two hardest problems in computer science are naming things, cache invalidation, and off-by-one errors…) I’ve been considering PlatformIO to drive Arduino builds. I haven’t looked into whether it just wraps one more layer around the same build process or has somehow re-implemented it. But I make fewer editing mistakes in vi where my fingers have lived for decades… :slight_smile:

Clearly, you also need a bigger lathe, so that you can make a new leadscrew. :roll_eyes:

I’ve kept an eye out for components I could use to add power feed to my compound, to improve surface finish on tapers. But that’s hard space challenge. So far I’ve adjusted tool angle and/or nose radius to improve finish as my workaround.

Having seen resonance effects on surface finish, I’m wondering whether you would really end up much happier with a modern stepper driver with substantial microstepping. Since the point is surface finish, you might benefit from swapping out the L298 for a modern Trinamic driver.

2 Likes

I do need a better lathe. It’s on the list of things to acquire, but a heated shop that can fit a decent lathe is ahead of it.
It’ll be interesting to see how the finish compares to the finish I was getting with the gearhead motor. I think the right solution is probably a servo motor being driven by a DAC and an amp.
Realistically, for all of these, a cnc lathe is probably the right answer. But I like running a lathe!

1 Like

I was just describing over lunch to a colleague how mentally cleansing I find it to run a lathe. It requires enough concentration that I slough off mental noise and end up mentally refreshed…

I was thinking that the noise suppression and back-emf sensing in the modern trinamic drivers might give similar results to a servo with way lower cost.

Sometimes when I’m in a bad mood I’ll go out and fire up the lathe just to work on technique: hey can I make a cut to within 0.005" and then repeatably set up to have the next cut accurate to a press fit, 0.0003" oversize? Or can I set up to bore to a given ID repeatably? That takes enough concentration I stop being upset about whatever stupid work thing had been bothering me.

A few times, I’ve had the 3d printer running, the laser cutter running, the cnc mill running, and I’m working on the lathe, and I’m all “right at this moment I am four times more productive than I usually am.” That’s a good feeling.

2 Likes

I hadn’t heard of PlatformIO, but it looks really cool! I’m a pretty big fan of Visual Studio Code (VSCode) and the fact that this installs as a plugin means you get all of the other code completion goodness that is so frustratingly absent in the Arduino IDE. I don’t have any plans for doing Arduino work at the moment, but I do have some Arduino boards lying around and if/when I do something with them, I am definitely going to look into using this.

Related: I found this video helpful: [#264 PlatformIO for Arduino, ESP8266, and ESP32 Tutorial]

1 Like

Generally I just use the Arduino IDE (simple projects don’t need much more). I have used Visual Studio with Visual Micro when I needed a debugger and was pretty impressed with it.
Have to also give Platform I/O a try.

1 Like

Only slightly related, and perhaps this belongs elsewhere, but Marlin 2.0 was recently released, and they support PlatormIO, too!