Close

Communication Concept

A project log for plotbot

Plotting machine build to be hung from a wall. Uses a delta-arm design to save on parts and to improve elegance.

seisei 03/16/2020 at 18:490 Comments

As I wrote in the description, I want to write as little code on the microcontroller as possible. Since I learned coding in Python, programming in C/C++ just feels tedious and I want to minimize it. So the idea was to do all complicated calculations in language that I like more, like Python or Nim (which is awesome!).

As far as my understanding goes, usually gcode is sent to the microcontroller, which uses some variation of Bresenhams algorithm to calculate the timings for the stepper motors.

My Idea is to instead calculate all the timings on the computer and send them to the microcontroller which stores them in a buffer and uses a timer to step the motors. For this, one needs fast serial connection and this is one reason why I chose to use a teensy for this project.

The communication protocol for filling the buffer of the microcontroller with n timings looks like this:

size

function

example/description

byte
command
'b' , for filling the 'b'uffer
byteaxis'a' , for the upper stepper
float
timing 0
0.0001 seconds
byteaction 0
'd',  lowering the pen
......
floattiming n0.0005 seconds
byteaction n
'u',  lifting the pen


So there are two buffers, one for either stepper, that get filled independently. And the buffers hold the time in seconds until the next step should be done and some action that should be done at that point in time.

Discussions