fredhatfield
Posts: 22
Joined: Fri Jan 11, 2013 12:28 pm

Interface a Pi to a plotter

Thu Jan 30, 2014 9:58 pm

I have a Comrex 1810 plotter that I would like to control with a Raspberry Pi.

It is 1985 vintage but looks to be in good shape. Originally I could connect it to the printer output of a PC and it worked great that way.

Now I would like to use it again, only connect it to a RPI. I assume I would have to use something between the Pi and the plotter to convert the output signal to a higher level that would drive the plotter internal mechanisms. Can anyone give me a clue as to how to get started on such a project?

Fred K8VDU

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Interface a Pi to a plotter

Thu Jan 30, 2014 10:26 pm

Hi,
fredhatfield wrote:I have a Comrex 1810 plotter that I would like to control with a Raspberry Pi.
Originally I could connect it to the printer output of a PC and it worked great that way.
I'm thinking about two options. The first would be to obtain USB to parallel port dongle, the other to add level converter (PC printer ports have 5V signals) and bit-bang GPIO pins.

Parallel port is simple bus, so the second option above is viable... but if you get mentioned USB dongle with Linux support, I'd consider it instead.

Then you need to find information about data protocol itself. There are several plotters supporting HPGL syntax. Hopefully, your plotter supports it... this information is crucial.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
Raspruss
Posts: 93
Joined: Thu Jan 23, 2014 3:50 pm
Location: Virginia, USA

Re: Interface a Pi to a plotter

Fri Jan 31, 2014 1:10 am

fredhatfield wrote: Can anyone give me a clue as to how to get started on such a project?
Your post actually reads like you have a good handle on this.

In the deep distant past I bought an HP pen plotter for a buck at a community college "warehouse sale" (a dollar was the minimum bid on items - a friend and I were the only ones there!). I interfaced that to an S-100 computer via a specially-designed/built card and a parallel port or two. The actual interfacing circuitry was fairly trivial if I remember correctly - maybe a buffer and some sort of latch. Anyway the key was the parallel port to get the appropriate data to the plotter in the correct order. Since you apparently have already gotten the plotter to do its thing with a printer port, simpy emulating that port with the Pi's GPIO set certainly looks like the way to go.

Personally, I'd buffer the outputs (and inputs?) with something cheap and, of course, use a separate power supply, but it doesn't loook like THAT big a deal to get the hardware side working just fine.

My first post here was asking about a standard for parallel bits of data applied to GPIO pins and was essentially shot down by about everyone who replied saying I was a Nazi for suggesting such a radical thing, so you are literally on your own in deciding which GPIO pins to assign to which bits. Once you've decided that, however, you really shouldn't have too much trouble emulating a printer port in hardware.

Just be sure to get the software side right, too.

[my implementation on that S-100 computer went, strangely, flawlessly and was TOTALLY scary when I first powered up everything and tested some software - CLACKETY, CLACK, CLACK, ZIIIIIIIP, CLACKETY, CLACK, CLACK as the pen hit the paper, drew something (probably an 'A'), then raised back up - a real thrill]

fredhatfield
Posts: 22
Joined: Fri Jan 11, 2013 12:28 pm

Re: Interface a Pi to a plotter

Sat Feb 01, 2014 4:29 pm

I see some cables on Amazon that connect a printer connector to a USB input. There are no further details about this cable other than specifying that it could be used on a laptop or similar computer that does not have an LPT port.

It appears that software would be needed to create the signals required by the printer if this option were adopted. Could this be used with the RPI if compatible software was created?

Fred K8VDU

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Interface a Pi to a plotter

Sat Feb 01, 2014 4:58 pm

Hi,
fredhatfield wrote:I see some cables on Amazon that connect a printer connector to a USB input. There are no further details about this cable
It always brings a smile on my face when for a circuit/add-on board/etc. the only item listed in specification section is "color: green". :lol:
fredhatfield wrote:It appears that software would be needed to create the signals required by the printer if this option were adopted. Could this be used with the RPI if compatible software was created?
I'd expect that most effort will be needed for the software part. The selection of the RasPi with some additional chips (or an existing I/O board) won't be the showstopper.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
scruss
Posts: 1800
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Interface a Pi to a plotter

Mon Mar 03, 2014 12:39 pm

I think your main problem will be working out the control language. You don't have a manual for it, do you?

I've had great success using a similar vintage HP 7470A plotter with a Linux machine, and there's no reason that it couldn't work with a Raspberry Pi. If the plotter uses a serial cable, you're in more luck, as a $10-$20 USB→Serial cable will be what you need. If it uses a more exotic interface like GPIB or HP-IL, that will be difficult.

There are some gotchas:
  • Even an RS-232C plotter will likely need a custom cable. I had to build one like this to pass through the right handshaking lines.
  • Plotters are slow, and usually have tiny input buffers. You will need to enable flow control: I've enabled XON/XOFF and RTS/CTS, and it seems to be happy.
  • Getting working pens is a trial. Trawl ebay, or kludge something together.
If your plotter talks HP-GL, you could be in luck. Once you get it hooked up, try this:

Code: Select all

stty -F /dev/ttyUSB0 ixon ixoff crtscts cs8 -parenb -parodd -cstopb 9600
echo "IN;SP1;PU400,400;PD400,1200;PD1200,1200;PD1200,400;PD400,400;PU;SP0;" > /dev/ttyUSB0
If everything is perfect, this will draw a small (20 mm × 20 mm) square. I've assumed a 9600 baud 8N1 connection (perhaps a stretch; 2400 was typical of the era) and that your serial connection is on /dev/ttyUSB0.

There is an active crowd of plotter nerds on the Chiplotle mailing list, should you need specific help.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

UltraSparky
Posts: 1
Joined: Thu Dec 04, 2014 11:19 pm

Re: Interface a Pi to a plotter

Fri Dec 05, 2014 12:41 am

scruss wrote:If your plotter talks HP-GL, you could be in luck. Once you get it hooked up, try this:

Code: Select all

stty -F /dev/ttyUSB0 ixon ixoff crtscts cs8 -parenb -parodd -cstopb 9600
echo "IN;SP1;PU400,400;PD400,1200;PD1200,1200;PD1200,400;PD400,400;PU;SP0;" > /dev/ttyUSB0
If everything is perfect, this will draw a small (20 mm × 20 mm) square. I've assumed a 9600 baud 8N1 connection (perhaps a stretch; 2400 was typical of the era) and that your serial connection is on /dev/ttyUSB0.

There is an active crowd of plotter nerds on the Chiplotle mailing list, should you need specific help.
I had a similar problem, hopefully this will help someone.

I have an old Roland Stika STX-7 vinyl cutter that required Win98 and a centronics parallel port encryption key dongle. Really kludgey. The PC is long gone and the vinyl cutter has been on a shelf for years. Before moving it to the recycle bin, I thought I'd try to make it work on Linux. A quick search indicated it talks HPGL, which is great news. Even though I don't know much about HPGL, there are several excellent resources out there.

I bought a Trendnet TU-P1284 IEEE-1284 (parallel) to USB converter online for about $10 U.S. OS X did not recognize it, but Ubuntu did as did Raspbian. When you turn the device on, it shows up as /dev/usb/lp0.

I can now create a PNG or EPS file in GIMP, import it into Inkscape (open source), select the image, trace a path from the bitmap and save it as HPGL. One caveat is that I need to flip the image horizontally and rotate it 90 degrees CCW to plot the way I expect.

GIMP and Inkscape are quite CPU intensive, so I find it more efficient to process an image on an Ubuntu box and scp the HPGL file to a Raspberry Pi B+ that runs headless connected to the vinyl cutter. Simply cat the HPGL file to the plotter as root (not sudo) and watch the decal appear.

# cat pi.hpgl > /dev/usb/lp0

Much cheaper than trying to upgrade or replace the cutter. And there are old cutters for sale online.
Attachments
VinylPi.png
Raspberry Pi B+ controlling Roland Stika STX-7 vinyl cutter
VinylPi.png (34.72 KiB) Viewed 2913 times

sesmd
Posts: 1
Joined: Tue Feb 16, 2016 2:38 am

Re: Interface a Pi to a plotter

Tue Feb 16, 2016 3:42 am

Hi !
I had a comrex 'sweet pea' plotter . I am going to assume yours is the same; otherwise
anything I say won't apply......

Anyway, the interface was a modified parallel interface - I do not know if serial interfaces
were offered, however this plotter was designed before the USB standard was implemented.
If your plotter is of more recent design, your interface may be different; my plotter was of 1980's
vintage (maybe very early 1990's ... but before USB protocols came into use).

In addition, the Sweet Pea' plotter did NOT use HPGL as the software interface.... their
interface 'language' was in a format somewhat like :
LINE( STARTX, STARTY, ENDX, ENDY)
CIRCLE(CPX, CPY, RADIUS)
or something similar to this (I apologize for being somewhat vague... it has been more than
30 years since I have looked at info related - my manual disappeared about that time, during a move).

If you have, or can obtain a manual, it contains all the info needed to interface the plotter to
a Rasp Pi. I would suggest the following hardware design to interface plotter to RPi...:
Use a 8 bit shift register with the capability of both serial-to-parallel, and parallel-to-serial
data handling - this will allow you to write bytes to, and read bytes from the plotter.
A reasonable type would be a 74HC595.. There are a number of control pins which must
addressed / set for proper function. The plotter interface, as I recall, also has at least one
control line to latch / signal incoming data (8 bits wide), and may have an outgoing control line
to signal the RPi that data is available to be read FROM the plotter - I don't remember details about
this. If you can obtain a manual, I will help you design the interface, if you would like.
I have had more than 30 years experience in digital / embedded controller design. If you wish to contact me,
I'm Stan... [email protected]. I may be moving
soon, so I'm using Starbucks as my 'personal internet access point'... point being that my response times are
a little slower than usual, but I'm not disappearing.

Anyway, drop me a note if you are interested.

mrcrowley1911
Posts: 2
Joined: Thu Apr 26, 2018 7:54 pm

Re: Interface a Pi to a plotter

Thu Apr 26, 2018 8:02 pm

I have a redsail 720c plotter it accepts HPGL but appears to need FTDI drivers. i can send .hpgl images to it via cat command but it seems to be speaking the wrong language as it is unpredictable. it does move my cutter but does not cut or move along the desired path, I have attempted to install chiplotle but got hung up on on numpy.py/ Im sure im doing something wrong but dont know what else to try any ideas ?

mrcrowley1911
Posts: 2
Joined: Thu Apr 26, 2018 7:54 pm

Re: Interface a Pi to a plotter

Thu Apr 26, 2018 8:08 pm

would love to use my plotter with open source software and a lightweight pc like the pi any input would be greatly greatly appreciated :D !

User avatar
scruss
Posts: 1800
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Interface a Pi to a plotter

Sun Apr 29, 2018 12:05 am

mrcrowley1911 wrote:
Thu Apr 26, 2018 8:02 pm
I have a redsail 720c plotter it accepts HPGL but appears to need FTDI drivers. i can send .hpgl images to it via cat command but it seems to be speaking the wrong language as it is unpredictable. it does move my cutter but does not cut or move along the desired path, I have attempted to install chiplotle but got hung up on on numpy.py/ Im sure im doing something wrong but dont know what else to try any ideas ?

would love to use my plotter with open source software and a lightweight pc like the pi any input would be greatly greatly appreciated :D !
Okay - let's do this.

You probably don't need an FTDI or CH340 driver for the plotter with a Raspberry Pi. With the plotter turned on, plug the USB cable into the Raspberry Pi, and in a terminal window type:

Code: Select all

ls /dev/ttyUSB*
If you've only got the plotter plugged in, there should be something like /dev/ttyUSB0. That's your plotter port, like COM1: on a PC.

Serial communications need a particular speed. If the only unencrypted version of a Redsail manual I could find online is to believed, they use the fairly standard 9600 baud, 8 bits per byte, no parity bit, 1 stop bit. That's 9600 8N1.

The Redsail seems to use both hardware (RTS/CTS) and software (/XON/XOFF) flow control. This is probably what was causing problems earlier. Linux's super-cryptic command to set all of these serial options on /dev/ttyUSB0 would be:

Code: Select all

stty -F /dev/ttyUSB0 9600 cs8 -cstopb -parenb crtscts ixon
As a test, you can send the following test code to the plotter. It won't plot or cut anything:

Code: Select all

echo 'IN;SP;PU0,0,0,2000,2000,2000,2000,0,0,0;' > /dev/ttyUSB0
It should move the pen to home, then move around a 5 cm square with the pen up.

Chiplotle may be a tough installation these days. It's been semi-maintained for the last few years. I'd maybe try installing the stock numpy packages to see if they help:

Code: Select all

sudo apt install python3-numpy python-numpy
You might also want to take a look at Inkscape. Though it runs kind of slow on a Raspberry Pi, it has nice plotting/cutting support under Extensions → Export → Plot … It even calculates the under-over cut required for using drag knives.

You can just send data to the serial port, or calculate in Python/whatever. I find the hp2xx previewer/converter useful for dealing with HPGL files too.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Beginners”

Who is online

Users browsing this forum: Bing [Bot], erik677 and 28 guests