2
$\begingroup$

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?
$\endgroup$
1

4 Answers 4

3
$\begingroup$

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.

$\endgroup$
1
  • 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, 2019 at 10:47
2
$\begingroup$

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.

$\endgroup$
0
1
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Note: detecting belt skipping can be detected equally: you just need a feedback sensor which include the belt in the loop. However I agree that poor quality 3D printer who usually use belts will not have this feedback. Considering ball-screw mechanisms, they just cannot skip, and also provide more rigidity. $\endgroup$ Apr 29, 2020 at 7:28
0
$\begingroup$

The CNC system, and simplifying intentionally, is divided into several steps:

  1. Acquisition of the g-code: This depends on the platform, whether is a file from an USB flash-memory, network or direct input from the operator. G-code operations needs to be buffered in a quantity enough to allow some "look-ahead" in the program.
  2. Parsing of the g-code: Parsing of any formal language is based on "formal grammars" theory https://en.wikipedia.org/wiki/Formal_grammar. Fortunately, g-code is one of the simplest grammar of the Chomsky hierarchy. Language parsing is a full topic in itself, and it follows lexical, syntactical and semantical analysis.
  3. Driving: It exists several different strategies:

    • Open-loop vs closed loop: In closed-loop CNC, sensors provide a feedback from the movement, allowing the driver to fix deviations (e.g. no step lots). Those systems are more expensive and usually not available in cheap 3D printers. In open-loop CNC, the driver send signals and "hope" the machine will follow, this is the case of most cheap 3D-printers, where if you block the head, it will lose steps.
    • Synchronous vs asynchronous (not sure about this naming): In synchronous systems, the driver send a single step for each axis each loop (one step forward, no step, or one step backward for each of the x, y, z, a... axis). In each iteration, the driver establish which steps need to be activated and send it; the speed of the movement depends on how fast this loop is performed. In Asynchronous driving, the loop run at a specific speed and apply steps as needed to correct the distance between the previous/detected position and the expected position.

Acquisition and parsing of g-code can be performed in soft real-time, however the driving needs hard real-time, which precision determine the maximum speed that your CNC can manage.

The servos/steppers usually cannot manage infinite acceleration, this is why the system needs to read g-code instructions ahead to anticipate closed angles or changes in direction. It should then reduce the indicated speed down to something which allows the next instruction.

I hope this give a quick introduction to the topic, obviously, each aspect needs further reading.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .