Running a two axis lathe program without G-code?

well, if you start, you can start with C++ directly.

I disagree, mastering C++ will let you understand what's under the hood or write your own classes which has some benefits. (not saying you can't do it with C).

@ captrob75

If the programming goes smoothly, you can add an SD card module to your project to store some code, allowing the average person to operate the machine.
That's one way to create the project, but on the other hand, something similar already exists, more or less ready-made.
I'm talking about a small milling (engraving) machine where you can control three axes individually with a limited G-code command list.
Such a machine usually has an offline controller where you can enter the G-code and even control the axes.
So you don't need a PC to run your machine.
In your case, the X and Z axes are probably sufficient.

Sorry, I disagree. I can get by in a dozen languages and have mastered 4 and C++ is one of the worst I have seen.
In any case, I don't really care what he does at 83 time is waaaaaaaay too short.

1 Like

If you modify the motor drivers (i.e., Step & Dir) of such a milling machine to match your existing drives, you'll be well on your way.
You can also use it for limit switching and spindle control.
But most importantly, it's in your familiar, albeit limited, G-code and can work offline.

that's OK

I master also many programming languages.

I like C++ for being close to the metal yet providing strong abstractions and precise control over resources or the ability to express high-level designs without sacrificing low-level efficiency.

No. I’ll have to watch it to make sure the two indicators move as required. If the finished plug fits the gage, it’s close enough.

The app I'm using to learn is Arduino Programming Pro ($5) from the Apple App store. I also have a ASET degree from community college from about 25 years ago, so the wiring part should be a breeze too. :slight_smile:

Setting up the program in Arduino would be in effect like programming a PLC, correct?

This would work like a PLC program, correct? I had a class on PLC's in college 25 years ago...

I'm also going to look into UGS and GRBL. With this setup, I can run from an SD card if I plug in an SD reader to the Arduino Uno?

Yeah, running from an sd-card ( that already is a part of the little controller) is correct.

In fact it is yust your drawing that is translated to G-code that you put on the Sd-card.

For example, the drawing can be created with Inkscape or your usual drawing software, and then converted into G-code (which can also be done in Inkscape).
AutoCAD can probably do this as well.

Can I just type in the G-code myself? It’s 90% G00 and G01 commands. Working with github and these files is a major pain in my butt. I’d rather type code with what I have that works. :unamused_face:

Yes, definitely, you can just use Notepad for that.
I usually use NotePad++.
Off-topic: what's your native language?
And what kind of workpieces do you want to make? Just turning a few passes and then a bevel, or is it more complex?
If you plan to cutting thread with the Spindle Index Puls, that's a different story. (The Uno isn't powerful enough for that.)

I had replied that you don't need a PC for this. You can have a second Arduino send the gcode to the one running grbl.

Looks like my post never made it.

1 Like

English and G-code :blush:
no threads on this one. I built the machine specifically for turning a tapered wooden plug. Nothing fancy, just face, turn the taper, and cut it off, then park at a spot for advancing the stock so the cycle can be repeated.

If I can write a program in C++ and flash the Arduino memory, I won’t need an SD card or a PC, correct?

That is correct, but a very long ways from getting to your goal. You have not told us how you will have the program move the lathe components.

How specific do you need me to get? Hardware wise, with an Arduino Uno R3, CNC shield, 2208 drivers, nema 17 steppers and a relay to start and stop the spindle motor. Software wise, i’m not sure yet.
I’m not sure what specific information you’re looking for.. :thinking:

The stepper motors are 200 step motors driving a 2.5mm pitch ball screw module. I can do the math for the variables once I know how to write the code.

Do I need an LCD display to run the system?

That's not really necessary, but it is useful if you want some kind of feedback. It does make the code slower and a bit more difficult.
If you want to write everything yourself, familiarize yourself with a few terms: enums, structs, classes, and definitely don't forget blink without delay. Then code all of this in a finite state machine (FSM).

I am sure you know that is only the mounting size of the motor and nothing else. What are the torque requirements for the project?

The key is the ratio of steps for one axis compared to the other. That way you can do, say, one step on one axes and three on the other.