from: Little Router to: Little Printer (part 1)

While looking for a cheap and tidy way to deploy indoor, network connected temperature sensors, I came across TP-Link’s micro routers – TL-MR3020 and TL-WR703N. I think it was Sam Crawford’s excellent introductory write-up that got me enthused initially. Not only do these little routers have a USB port (intended for a 3G modem, but in our case think serial), they can also run OpenWrt (a very accessible Linux distribution for embedded devices). Sam’s post refers specifically to the TL-WR703N. The TL-MR3020 is a little more expensive and a little bigger but comes with a UK plug, though you’re denied the fun of starting from Chinese firmware.

Subsequently, when James Adam gave a great talk about their FreeRange Printer project, which uses an Arduino to talk to a thermal receipt printer and produce beautiful little notes via some rather nifty web services, I began to see more possibilities for ‘little router’….

And lo, without a lot of effort, early indications are good!

This took little more than the few linux commands:

# stty -F /dev/ttyUSB0 19200

# echo hello > /dev/ttyUSB0

# echo hello > /dev/ttyUSB0

# echo -e “\022T” > /dev/ttyUSB0

Indeed I didn’t really expect any outcome from ‘echo hello > /dev/ttyUSB0’ and was surprised and pleased when the printer gave a little cough (twice!) before successfully printing the test data. Ah, I thought, some sort of communications happening! Only later did I realise that the printer had very willingly printed hello.

Okay, a few more details. This is the setup:

That’s a USB BUB from Modern Device – a USB to TTL serial adapter.

 

From a fresh OpenWrt install, once you’ve got a ssh session open, these are the commands to install the necessary USB serial driver and utilities.

# opkg update

# opkg install kmod-usb-serial-ftdi

# opkg install usbutils

# opkg install coreutils-stty

Once the USB BUB is connected to the router, check that the hardware has been recognised:

That’s pretty much it. Now you can set the serial speed using the stty command above.

Next step: try to do proper FreeRange Printing

With thanks to James and the OpenWrt guys for making this possible.

 

 

One thought on “from: Little Router to: Little Printer (part 1)

  1. Pingback: Status-Q » Blog Archive » Small but powerful

Comments are closed.