All posts by scruss

Notes on mini-printers and Linux

miniprinter galleryOver the last few weeks, I’ve been playing with a few small thermal printers. Meant as POS or information booth printers, they make a diverting project for the lo-fi printing enthusiast. While they all have common features — 58 mm/2¼” paper width, 8 pixel/mm resolution, 48 mm print width, serial connection — they all have their quirks. You may have seen these sold as the Adafruit Mini Thermal Receipt Printer or Sparkfun’s Thermal Printer, but there are many others. I’m going to write more on interfacing these directly to Raspberry Pi, Arduino, and (if I can navigate the documentation) a CUPs driver.

For now, I’m just leaving you a list of things I’ve found helpful for the DP-EH600 and 701 printers. Note that the similar-looking BTHT-v6 printer uses a completely different command set.

  • Replacement paper is sold as 2¼” × 30′. Staples have a box of 30 rolls for under $25 (item 279096, not on their website). Longer rolls don’t fit.
  • You’ll need a USB→TTL Serial adaptor, preferably one with DTR control. I use one from JY-MCU. In a pinch, you can use a simpler  Debug / Console Cable for Raspberry Pi, but you risk serial overruns and dodgy results. Remember that RX on the adaptor goes to TX on the printer, and vice versa.
  • A good solid power supply is needed; these printers draw ~8 W when printing. Some printers only support 5 V (for which a 3 amp adaptor would be ideal), others 5-9 V. The higher voltage makes text printing faster. You can’t drive these directly from your Raspberry Pi/Arduino power supply.
  • Linux serial ports are set to some defaults which may have been historically useful, but now corrupt 8-bit data. A trick I picked up here is to first issue the command
    stty -F /dev/ttyUSB1 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
    which clears all settings, then set the device up as you need it:
    stty -F /dev/ttyUSB1 speed 9600 raw cs8
    (Most of these printers default to 9600 baud. Your device may be called something different to ttyUSB1.)
  • I’ve written a couple of Python driver stubs which take an image and produce the relevant binary output:
    • scruss / esc-pos-image.py – prints an image as a single command. May not work on the SparkFun printer. Does not work on the BTHT-v6.
    • scruss / esc-pos-image-star.py – prints the image in 24 pixel deep bands. Can sometimes cause visible gaps in the printout, but will work on almost all printers, except the BTHT-v6.
  • These Python libraries also work, as long as you address the printer properly (right device, right speed):

Notes/Credits

  1. Reed Zhao (of Tangram Software) lent me a couple of different printers for testing after I bought a different one from him. He’s put a lot of work into sourcing these printers direct from the manufacturers. Thanks, Reed!
  2. Image credits for print samples:

Beater Bikes: review (and requiem?)

I’ve heard people complain (still) that “… a good bike shouldn’t cost more than $100”. When I heard the news that Dave Chant was closing up  Beater Bikes and liquidating his remaining stock of bikes for $100 each, I thought I’d give it a try.

Through no fault of Dave’s, Beater Bikes never quite got the traction in Canada they should have done. I blame the outdated tariff on imported cheap bikes; Canada no longer has a domestic industry to protect (someone, please prove me wrong). We still have the tariff to shore up those long-gone jobs at CCM/Supercycle, though, so importing bikes into Canada was too expensive a proposition.

The bike still cost me a bike more than $100, though: $100, plus $120 shipping, plus $58 UPS brokerage ‘tax’ (grar), so a total of $278. Still cheaper than almost anything you can get from Canadian Tire, and as the original retail was around $450, still decent.

beater bikes, beat-up boxSo here’s the box it came in; beaten up and retaped, sure, but with an appropriate logo. Inside, apart from a few loose parts, there was this:

how it's packedAlthough well wrapped, the bike had been dropped at one point, and there was a colossal ding on the back mudguard that stopped the wheel turning. I managed to flatten it out enough that the wheel ran free, but it’s still visible under the carrier.

After a couple of hours of fiddling and tightening, I ended up with this handsome steed:

assembled!The basket is an old Wald I had lying around, attached with enough Ty-Raps to add a significant cost to the bike. The only bits missing were most of the screws to mount the rear reflector. One screw plus duct tape did the job.

Ashtabula crank, nifty propstandThe bike has a particularly nice kickstand. Coupled with the steering stabilizer, it’s a bike that’ll lean against a wall without falling in a heap. It’s also my first bike with a one-piece/Ashtabula crank, which is more a matter of where I grew up — only BMXs had them in the UK.

It’s quite a handsome bike, despite the Beater concept of a bike that won’t get noticed or stolen. It’s very basic, but solid. I don’t know how long the chainstay-mounted Beater Bikes nameplate will last on mine (it came partially unglued on my first ride) so maybe the bike will be an anoymous beater sooner than expected.

beater at the moviesIt rides well, though I have to say that riding a bike with only a coaster brake is a little off-putting.  I haven’t mixed with real traffic on it, and our shed has developed a bruise from where I shot up the driveway, completely forgot how to stop, and collided with the shed. Only pride hurt.

Starting with a coaster brake is also weird, as you can’t haul the pedals back to a good starting place. I’m resolutely right-footed, and I’ve had several nopenopenope start offs from junctions. Until I heard about the rolling the bike backwards trick, I was pretty stuck.

bikeshadowCompared to my cushy and sprung Batavus, the Beater has a harsher ride. Its low gear is higher than I’m used to, so I start off slowly. I’d definitely agree with Velouria‘s assessment that it needs a front brake. I’m much slower without one.

It is, however, a very decent bike for the money I paid. I hope that Dave got something positive from his foray into bike sales, as it’s a fine concept, and better executed than flops like the Kronan. The one thing it does do far better than any of my other bikes? The Sturmey-Archer rear hub still makes that lazy tic tic tac tac noise in top gear, which can only be the sound of summer freedom on the open road.

Solar Marble Machine at 2× speed

Solar Marble Machine
Solar Marble Machine — click for video

For more details, please see The Solarbotics Solar Marble Machine.

Music: “A New Way of Seeing” (excerpt) – Richard Harvey; © 1979, ICL.