[Tutor] Pen plotter data format
Phil
phillor9 at gmail.com
Sat Apr 1 19:45:30 EDT 2023
On 1/4/23 16:20, Dennis Lee Bieber wrote:
Thank you Dennis for your additional thoughts.
The weather cooled a little last night and so I concocted some code that
I'm keen to test.
> What is the resolution of the stepper motors themselves -- I'd hope an
> attempt at a pen plotter has finer resolution than 1mm steps.
I'm building the plotter from Lego parts so the motors are analogue and
not digital stepping motors. I don't expect much, it's just a project.
> (and technically,
> the R-Pi is not a "microcontroller" -- a microcontroller would be an
> Arduino, Adafruit Metro M4*, and things of that ilk;
I do know the difference between an SBC and a microcontroller, I just
didn't correct what Cameron assumed.
> Granted, with the rarity of serial ports these days, that could mean
> having a USB<>serial adapter on both the host and R-Pi, with a null-modem
> adapter between them <G>
Communication from the laptop to the microcontroller is via Bluetooth.
> Either find the source code for a g-code 3-D printer controller (should
> be lots, since a lot of such printers use R-Pi boards as the controller)
> and hack it to isolate just the 2-D operations
I started down that route when I first thought of building a plotter but
ended up deciding to go my own way. I believe what I now have will work.
> def penUp(parameters):
> try:
> x, y = parameters.split(",")
> except <pick the appropriate exception for too many/few parameters>:
> return "Incorrect number of parameters provided; expected 2"
Your suggestion is along the lines that I now have except for the try
and except blocks. I haven't built the pen lifting mechanism yet because
I'm waiting for parts and I only have a vague idea how I might build it
at the moment.
> if cmd == "PU":
> #issue servo command to raise pen
> else:
> #issue servo command to lower pen
The Z command is a single coordinate so if it's 0 the pen is down
otherwise it's up. I could change the '0' to 'pen_up' to make the code
more understandable when I look at it again next week.
> * The (Arduino Uno/Due style) Adafruit Metro M4 Express
> https://learn.adafruit.com/adafruit-metro-m4-express-featuring-atsamd51/overview
I have several older Arduino boards (including the first ever Arduino
board), a Raspberry Pi Pico, an Adafruit board and one older ESP32
board. I've been thinking about putting micropython on the ESP32 board
but since it's easily programmable from the Arduino IDE I haven't bothered.
I'd better get back to VScode before the day warms too much.
--
Regards,
Phil
More information about the Tutor
mailing list