~dbalan/blogng unlisted

3e814e99dab6bc5d8ba4f5ed00f401e5590491ec — Dhananjay Balan 1 year, 10 months ago eed134d
Fix whitespace errors
1 files changed, 17 insertions(+), 17 deletions(-)

M blog/2019-02-23-resurracting-an-hp-7440a-plotter.markdown
M blog/2019-02-23-resurracting-an-hp-7440a-plotter.markdown => blog/2019-02-23-resurracting-an-hp-7440a-plotter.markdown +17 -17
@@ 26,7 26,8 @@ cores](https://en.wikipedia.org/wiki/Magnetic-core_memory)) in earlier computers
made working with raster images hard, and plotters didn't need much operating
memory.

## HP7440A 
## HP7440A

HP7440A _"ColorPro"_ was an affordable plotter manufactured by HP, it can hold
and switch between 8 pens simultaneously and draw on surfaces as large as A4.
[HP Museum has a longer post about this


@@ 39,16 40,16 @@ easy it is to open, take that 2018 tech!

![7440A Top cover open](/images/7440a_open.jpg){ width=600px }

The internal mechanism is pretty simple, There are two servos. One for 
moving the paper back and forward, and the other for moving the pen left and 
right. There is also a solenoid based lever to switch pen down and up. 
The internal mechanism is pretty simple, There are two servos. One for moving
the paper back and forward, and the other for moving the pen left and right.
There is also a solenoid based lever to switch pen down and up.

## Talk To Me

![7440A Interfaces](/images/7440a_interface.jpg){ width=600px }

However, our plotter didn't come with any cables to either power it or to send
commands. 
commands.

Power supply was the biggest mystery. After digging through the manuals, and the
[hand drawn schematics from HP


@@ 60,17 61,16 @@ Communication turned out be just standard serial, however our plotter has a
`DB-22` adaptor, so we had to use a `DB-22` to `DB-9` adpator and then `DB-9` to
`usb` adaptor.

The final step was writing in the only language the plotter can
understand, [`HP-GL`](https://en.wikipedia.org/wiki/HP-GL) or 
`HP Graphics Langauge`. Lucky for us, HP was on top of the plotter game when 
plotters were popular, so `HP-GL` has become a de facto standard 
for talking to plotters.
The final step was writing in the only language the plotter can understand,
[`HP-GL`](https://en.wikipedia.org/wiki/HP-GL) or `HP Graphics Langauge`. Lucky
for us, HP was on top of the plotter game when plotters were popular, so `HP-GL`
has become a de facto standard for talking to plotters.

.. and finally our plotter moves!

<video width="600" height="450" controls>
  <source src="/images/7440a_printing.mp4" type="video/mp4">
</video> 
</video>

## Goooooooo faster.



@@ 82,11 82,11 @@ commands, however this made drawings really slow and added artifacts from
ink bleeding while the plotter is waiting for the next command.

Another recurser Francis pointed us to a clever hack in the [wait function]
in [hpgl.js]. This function uses the HPGL command `OA;` to block execution 
until the plotter is finished with the current instruction. When the plotter 
executes `OA;` it sends the current pen position, but it first needs to 
wait until the pen has stopped moving. Thus we can batch a bunch of commands 
and append it with `OA;`. As soon as we see the position over the serial, 
in [hpgl.js]. This function uses the HPGL command `OA;` to block execution
until the plotter is finished with the current instruction. When the plotter
executes `OA;` it sends the current pen position, but it first needs to
wait until the pen has stopped moving. Thus we can batch a bunch of commands
and append it with `OA;`. As soon as we see the position over the serial,
we know that the previous batch is consumed and we can send the next batch of commands.

[wait function]: https://djipco.github.io/hpgl/hpgl.js.html#line1535


@@ 159,7 159,7 @@ drawing routine.

<video width="600" height="450" controls>
  <source src="/images/7440a_circle.mp4" type="video/mp4">
</video> 
</video>

## This is only the beginning