I have been working on a printer project that basically is a 2D printer (dot matrix type). We are using solenoids as actuators to make impressions on the paper. We are now in the process of designing custom software. But a problem that we have encountered is that we have no idea how to design software as we are a bunch of beginners in this field.

An idea we are working on is based on position-acknowledge technique. In this technique the computer sends G-code to the controller. The controller after reaching the position defined in code sends an acknowledgement and the computer then sends the next signal. This is the model we are currently working on.

  • Can anyone suggest any other ideas to make this work?
  • Is Our approach right?
  • Do 3D printers work using same technique?

You appear to be asking about rate-limiting the stream of G-code provided by the computer, but some more context in your question will help if this is not the case.

Printers tend to work in two ways.

  1. Read G-code from local storage as a text file. Here, the parser/control engine is in full control.

  2. Stream G-code over a serial port using an 'ack' handshake.

The reference for G-code used in 3D printing is the RepRap Wiki. Here you will find responses such as ok resend and fatal, these indicate when a previous command is processed and something else can be sent, if the previous message was identified as corrupt, or if recovery is impossible.

The basic rule for this style of handshake is that after every host to slave transaction, the host must wait for some response before sending another transaction. The slave could send either ACK responses, or other asynchronous transactions if you can design the system to avoid or not care about overrun in the slave to host direction.

When designing a handshake like this, you can consider all possible ways for something to go wrong (assume the interface is imperfect). How can you handle a request being missed and no ACK ever? When there is a timeout, can you make a 'benign' request to see if the printer is still connected, etc.

  • 1
    $\begingroup$ Nicely answered! It is exactly the responses of the machine which can bug up other software, see e.g. this answer. $\endgroup$ – 0scar Jan 11 at 10:47

3D printer firmware use gcode that is derived from CNC and no acknowledgment. They send movement commands to the stepper motors like G1 X10 Y10 to move the printhead 10 mm along the X and Y.

You could use a ready 3D printer firmware like Marlin on a 3d printer board and use the X-axis or extruder output to couple to your solenoid, sending a G1 Z0.1 or G1 E0.1, which will actuate it for a short time. You might even use E and Z on different solenoids.


Are you interested in receiving the instructions correctly, or interested in how the instructions are executed by the hardware? This answer doesn't go into the software communication between controller board and software that sends the instruction from another software/hardware platform (see this answer), this answer addresses the positioning/movement.

Most of current 3D printers do not track the position of the print head. The software instructs the head to go somewhere, but it never checks if it actually arrives at that exact position. Problems like missing steps of the stepper or skipping notches on the belt are not detected and the printer will continue thinking it has reached the position.

Skipping of belts is a mechanical issue and should not occur (nor can be detected unless there are stepper steps missed), but skipping of steps is something that can be detected by certain type of stepper drivers (trinamic). Steppers do not use a feedback loop to check the final position. Servos, opposed to steppers, use a feedback loop, and as such are able to reach the position as instructed, but this comes a an increased cost, servo's are more expensive and hence not found in most of the "cheaper" 3D printing machines.

It is up to the designer of a 3D machine to choose the motors for the positioning system, if it is not highly loaded, you go for steppers without a feedback loop, or in higher loaded machines for servo's (basically steppers with some positioning electronics for the feedback). In case of a stepper you hope that it reaches the destination you tell it to go to, for a servo, you known that it reaches that exact position.

To get back on topic of your question, there is no feedback on reaching the position (you call this acknowledgement), you just send the G-codes sequentially or in a buffer to the printer electronics which executes the statements one at the time (this is done by the firmware, this this answer for replies of the machine on the code it receives). It is your choice of the hardware that actually determines whether this is executed like instructed. Do note that most machines are not highly loaded (the 3D printhead is not very heavy and normally does not hit any obstruction in its path as Z advances) justifying the use of steppers without the need for feedback. CNC machines, certainly the larger ones, that position a highly loaded cutting tool need such a feedback loop as the positioning needs to be very exact. You need to consider the forces at play in your paper punch machine, but from my point of view, your machine does not seem to be highly loaded. In such a case you are not in need for a more expensive positioning system, nor the need for the processing of a return/feedback signal in your custom software.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.