Kategori Extern

17 jun


Roomba 500-series Easy Scheduling using an Arduino


I have a iRobot Roomba 500-series vacuum cleaner robot, but without any remote, or command center or anything; alas, I have to push a button everytime I want the cleaning revolution to start :-(

But no more! It turns out the Roomba can be programmed, quite easily, to schedule automatically, and all you need is:

  • 1 Arduino
  • 2 wires

The Roomba actually supports a serial protocol, the iRobot Roomba 500 Open Interface Specification, that allows remote control, driving, sensoring, and scheduling.

Finding the serial port

Remove the plastic cover. It is easiest to remove the vacuum bin, and carefully pry it off with a screwdriver.

There should be a 7-pin plug, on the right side. It has the following pinout:

Roomba serial pinout

Roomba serial pinout

Program the Arduino

Use this sketch (download: roombaschedule.ino):

Set a schedule on an iRobot Roomba 500 series, using just an Arduino.
Mads Chr. Olesen, 2015.

const byte currentDay = 3;
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
const byte currentHour = 2;
const byte currentMinute = 58;

// Schedule
const byte SUNDAY = 0x01, MONDAY = 0x02, TUESDAY = 0x04, WEDNESDAY = 0x08, THURSDAY = 0x10, FRIDAY = 0x20, SATURDAY = 0x40;

const byte daystorun = SUNDAY | MONDAY | WEDNESDAY | FRIDAY;
const byte times[14] = {
3, 0, // Sunday time
3, 0, // Monday time
3, 0, // Tuesday time
3, 0, // Wednesday time
3, 0, // Thursday time
3, 0, // Friday time
3, 0, // Saturday time

const int ledPin = 13;

void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, 0);

Serial.write(128); //Start
Serial.write(131); //Safe mode, turns off Roomba light
Serial.write(128); //Start, back to passive mode

//Set day time

//Set schedule
for (int i = 0; i < 14; i++) {

void loop() {
digitalWrite(ledPin, 1);
digitalWrite(ledPin, 0);

You need to modify the variables at the top: set currentDay, currentHour, currentMinute according to the present time.
The pre-programmed schedule is to clean at 03:00 on Sunday, Monday, Wednesday and Friday. You can change this if you wish, by altering the daystorun and times variables.

If you don't modify the schedule, the Roomba should start automatically after 2 minutes.

Put it all together

You should now have a partially undressed Roomba, and a programmed Arduino. Now it is time to connect them. With both unpowered, connect the following:

  • Arduino GND to Roomba ground (pin 6)
  • Arduino TX (pin 1 on e.g. Uno) to Roomba RX (pin 3)

It should look like this:


Now, the moment of truth. Press the "CLEAN" button on the Roomba, the light should go on. Plug in the USB for the Arduino. The Roomba light should turn off briefly, and after a few seconds the Arduino should blink it's LED. The schedule is now programmed, all done!

Gemt under: Extern, HAL9k

Tags: ,

24 mar


HAL9k; now with awesome electrical and network installation


The local hacker space here in Aalborg (HAL9k) has moved from Rapsgade 1 to a permanent location at Sofiendalsvej 80. For a number of weeks we he been moving boxes of all our stuff, painting walls and other tasks related to the move. One of the things that I was involved in was the electricity installation and the computer network.

We have been so lucky to inherit a large number of metal and plastic cable trays including a number of Ethernet jacks and power outlets reducing the budget for establishing a new infrastructure at the new place.

After a lot of work, 50 m metal, 20 m plastic cable tray and 1,2 km Ethernet cable later we now have 74 ethernet jacks connected to our distribution frame with our two 48 port gigabit Dell switches connected to an OpenBSD firewall in VMware on our Dell R710 server, routing IPv4 and IPv6 (through a SIXXS tunnel). Thank you to Xena for the switches and the server.

The wireless network is handled by a 802.11a/b/g access point. The access point and the directional antennas are actually meant for outdoor usage, so we mounted it on an IKEA table leg to give it a touch of the rustic outdoor life on a large pole…
If you are curious about the details of the network setup check out the hal9k wiki here.

Besides the network installation we have also installed a new distribution board and a lot of power outlets. We have a dedicated power meter for the server room besides the three other power meters (which according to our plan will be monitored by our LIAB) and relays for the groups used in the workshops making integration with the physical access control system and emergency buttons easily done.


IMG_3762 IMG_4140 IMG_4145 IMG_4155 IMG_4156 IMG_4159 IMG_4171 IMG_4174 IMG_4180







Gemt under: Extern, HAL9k


30 okt


POS printers and Python


I had this old POS (Point Of Sale) receipt printer laying around for some time and thought it could be fun to play a bit with it. Printing plain text is simply done by sending it as characters via a serial connection. Cutting the paper is some ESC code which i found in a manual online. Printing images was a bit more tricky, since it is requires some specific codes, depending on how the dots in a vertical bar, equal to the height of a character, must be composed. I wrote a small Python module integrating the ability to print images, text etc.  since I could not find anything online simliar to what i wanted.

At the local hacker space (HAL9k) we have now received a large box full of used receipt printers, VFDs etc. and some of the members have asked for the module for printing images so I have uploaded pyPOSprinter to GitHub. It makes use of pySerial for communicating with the printer and Python Image Library for reading image files. The included example also shows how to use pyQRNative to print QR-codes (bar codes are soo last centory :-)  ).

from pyqrnative import PyQRNative
qr = PyQRNative.QRCode(5, PyQRNative.QRErrorCorrectLevel.Q)
im = qr.makeImage()
ims = im.resize((525,525))
from POSprinter import POSprinter
printer = POSprinter.POSprinter()
printer.write(“Hello Puffy\n”, align=”center”)
printer.printImgFromFile(“puffy.gif”, resolution=”low”, scale=1.0)
printer.write(“Friske agurker paa glas”, rcolStr=”200 DKK”)
printer.printImgFromPILObject(ims, scale=0.5)

03 mar

Kommentarer lukket til Using QR codes at HAL9k

Using QR codes at HAL9k


At the hackerspace in Aalborg (HAL9k) we wanted to mark equipment etc. with various information such as the owner of the equipment, possible instructions on how to use it and other relevant information.

We decided to make something based on stickers with QR codes where the user is redirected to the relevant subpage on HAL9k’s website. One requirement was furthermore that it should be possible to change the name of a wiki page or possibly change to a new wiki/CMS system without putting on a bunch of new stickers, i.e. something more dynamic than a direct link.

With regards to the stickers we ended up with a label printer attached to an Ubuntu Linux PC. We got 1300 stickers (resulting in 2600 QR codes) on Ebay for 350 DKK – enough stickers for the next foreseeable time..

Mikael from the hackerspace wrote some PHP code that we run locally on an Apache webserver on the PC, which basically generates a QR code (well actually two since we have two individual QR codes per sticker in order to end up with the right size), adds some (optional) text, saves the resulting image to a file and then calls the lp printing command.

The label printer was made to work with CUPS by using the instructions on this site.

Now back to the requirement about the desire not having to put new stickers on all the equipment when we change wiki/CMS, rename pages etc. We solved this by letting the QR codes point to http://qr.hal9k.dk/HQRxxx where ‘xxx’ is some number. The webserver at qr.hal9k.dk automatically redirects (307 Temporary Redirect) to the relevant page. In order not to have a manually maintained list that nobody would update anyway i wrote a Python script that every 5 minutes goes through all the pages on the HAL9k wiki using the page hal9k.dk/qr as an index. Every time it sees the string ‘HQR’ followed by a number on a given page, a reference is made and a .htaccess file is then updated so that the user is redirected to the correct page. The mappings between the keys and the wiki pages, logs etc. generated by the script is available at qr.hal9k.dk.

So the end result, besides having fun making it all, is that now users can easily print labels and put them on equipment at the hackerspace. If they forget to create the wiki page the user is automatically redirected to this page for a reminder about just that :-)