Thursday, September 3, 2009

“Control, This is Max.”

All right, so I’ve got it to move in one direction while it prints. Now I need it to go back to where it started, while at the same time;
  • Taking control of the belt drive stepper (from now on the X axis)
  • Telling the computer (my laptop) that the printer is busy
  • Telling the printer a new piece of paper has been fed
  • Starting the powder roller motor
  • Raising the supply bin
  • Lowering the build bin
  • Moving the roller across the bins (to spread the powder)
  • Stopping the powder roller motor
  • Giving the printer back control of the X axis
  • Telling the computer (my laptop) that the printer is ready for the next page
  • Then it needs to wait while the printer does its thing and repeat at the appropriate time, as many times as necessary.

To that end I’m using a 3 axis CNC setup to run the show. Without going into a full explanation of CNC, I’ll just say that the software allows you to use the computers parallel port to send the step and direction signals to the stepper drivers. It also allows several configurable outputs and inputs that can be used to activate relays and transistors or to monitor switches and sensors. A relatively simple list of commands (g-code) tells the software what to do.

So basically this is what happens;

  1. I use one of the outputs to switch the step input to the X axis from the encoder to the computer. This puts the computer in control of the X axis. I used some switching transistors but probably could have used a simple SPDT relay.
  2. Another of the outputs is used to activate a relay that breaks the circuit on pin #11 of the parallel port of the inkjet printer. (I don’t know how this is done on a USB connection) This tells the printing computer (my laptop) that the printer is busy so it won’t try to print.
  3. I had used yet another output to supply power to an opto-interrupter that I placed over top of the paper sensor on the printer. The idea was that by turning the sensor on and off, I could simulate a paper present/not present state. It worked, for a while, but stopped when the sensor apparently burned out. Now I have a “flag” on a small rod that the printer literally backs into as it reaches the end of the page, telling it that the paper is out. As the axis moves forward again it pulls away from the flag and thinks the next page has been loaded.
  4. I use the “spindle on” output to trip a relay and power the powder roller.
  5. The bins are the Y and Z axis. I use incremental mode to move the floors of the bins by the thickness of the slices. The supply bin has to move twice the distance because it’s half the volume. I will install limit switches to stop the machine if one them goes to its limit.
  6. I use the command to “Home” the X axis. I have an optical sensor at the starting position. The home command moves the stepper in the direction and speed specified until the sensor is tripped then backs off until it is not. This gives very accurate placement of the axis. While it is moving, the roller is pushing a new layer of powder across the build chamber.
  7. Next the powder roller is stopped.
  8. The relay for the X axis step signal is switched back to the encoder (giving the printer control of the stepper).
  9. The relay breaking connection on pin#11 is switched off so the laptop thinks the printer is ready for the next page and starts printing again.
  10. Lastly, while the printer is printing, the software waits for a “handshake”. There is an input in TurboCNC that can be configured for a PLC handshake. One of the commands allows the software to pause and wait for the input to change state (high or low). I have a trip switch at the back of the X axis that the printer activates when it reaches the back of the supply bin. When this switch is tripped the software goes back to step 1

There are also subroutines to prep the printer/bins for the first page and to input the number and thickness of layers. I also have a countdown displayed so I know how many layers are left.

It’s probably not the most elegant solution (It certainly isn’t the most compact), as it requires at least 2 computers and monitors. But as I said earlier, I was already familiar with CNC and didn’t want to learn how to build and program a PIC. Also, I already had the old computer and monitor (are you sensing a theme?).

At this point I had not yet installed the bins. I placed a stack of paper under the printer and tested the repeat registration by printing multiple copies of the windows teat page. The printer returned reliably to the same starting position and the multiple prints all lined up perfectly.

Next up, the powder bins.


  1. Hi John,

    Nice work you have been done. I don´t have the skills to figure it out right now but this will be a nice project in a near future for me.
    I´m working in something similar, for printing on flat surfaces (flatbed) and have almost everything done. I only need to figure it out how to add a new single stepper motor to move the gantry. Is possible to sync the feed motor(with encoder) to the stepper motor without adding a new circuit? I don´t know if I need a CNC setup for this or not...
    I know is a simple question, but I´m on a very beginning in electronics.
    Best Regards,

  2. Thanks, at a minimum you will need a driver and power suppy for the stepper. Single axis drivers are available for about $35 on ebay. The driver needs a -5v pulse to advance the stepper one step. If your encoder outputs a -5v pulse it can be used to provide the steps. The direction input on the driver is a 5v logic high/low. A high (+5v) will set the direction one way, a low (-5v) will set it the other. The trick is to synch the printer drive motor to the stepper. You will have to account for diferences in the steps/rev of the two motors as well as the gear train and the diameter of the paper feed rollers and the timing belt puleys. Once you determine the exact distance the paper would be moved for each pulse from your encoder you know how far the gantry must move with each step of the stepper. In my case (due to the reduction gearing) there were 816 pulses for each revolution of the paper feed wheels. The stepper I used to drive the gantry has 200 steps per rev. My driver has micro stepping so I used the 1/4 step mode which gives me 800 steps per rev. I had to adjust for the difference in the number of steps and the difference between the circumference of the paper feed roller and the timing belt pulley. I was lucky to find some gears that gave me the correct ratio. You will also need some switches to interrupt the pulses from the encoder so the gantry doesn't move too far or durring the pre-print "dance". Lastly, you will need a way to return the gantry to the starting position. If your driver has a remote enable input then the easiest way would be to disable the driver and reset the gantry by hand. That's ok if you are only printing one "page" at a time. Or you can build a circuit that reverses the direction signal and produces pulses (a 555 timer perhaps) until the gantry returns to start.

    I hope this helped.


  3. Thanks for the response, it helps a lot. I´m very fascinate with the possibilities and happy that I have a lot to learn! =)
    The configuration of the stepper motor I guess will be done by the software, and I will try to figure it out soon and a way to move the gantry back for a new page as well. But how the stepper motor/driver board will be connect(communicate) to the printer? Is just by software or they need to get together somewhere physically?

  4. Alexandresz, they say a picture is worth a thousand words so I'll try and sketch out a diagram of the components. Give me a few days and I'll post it in the blog.

  5. Sure, that will be great from you. Thanks a lot!