x Raspberry Kiosk

Raspberry Kiosk


A web-kiosk based on the Raspberry pi. Journey of a software engineer into a DIY project

Want more raspberry juice?
Ask me!

Support this blog!

0 notes
Raspberry Kiosk turned 1 today!

Raspberry Kiosk turned 1 today!

Want more raspberry juice?
Ask me!

Support this blog!

1 note

3D-printed support for the monitor

Date: June 14, 2013 at 3:58pm
Tags: #3d #3d printing #raspberry #touchscreen #support

Some time ago we saw how to install the chalk-electric capacitive touchscreen . Now you might want to build a suport for it. Sneak pic:


At Made we printed a support for the monitor, useful to hold it in position while experimenting.

A friend of mine prototyped the model with sketchup in less than 20 minutes


The whole thing is downloadable here . I strongly believe there is room for improvement, but I don’t need anything fancy at the moment, and this, well, works! 



Want more raspberry juice?
Ask me!

Support this blog!

7 notes

07 - Reading RFID tags with the raspberry pi

Date: May 31, 2013 at 6:53pm
Tags: #raspberry #raspberry pi #rfid #kiosk

This is the first guide (to date) that can be used by kids how to connect and use a RFID with the raspberry pi. 

It has been a long time. I’ve been three months without writing here (afk for a while). Now I’m back and I joined a new makerspace (Made at Mob) that just opened here in Barcelona and I’m now committed to finish what I started: building an open source kiosk with the raspi. And now I’m done working at home, I can finally play with stuff while surrounded by amazing people and things. 


Btw, If you landed on this page by accident or you don’t remember what  this blog is about, here is a list of past tutorials (tumblr archive sucks) :

I’m back with an exciting tutorial that will teach you how to read RFID tags with the raspberry pi. This opens new horizons to what we can do with our tiny little cheap friend. 

This is guide is divided in 2 parts :

  • Part 1: Wiring things up
  • Part 2: Configuring the raspi

You need some ingredients to complete this hacking receipt :

  • a) raspberry pi
  • b) RFID reader . I use the PN532 NFC/RFID controller breakout board - v1.3 (this one). The packages comes with a tuned 13.56MHz stripline antenna, 2 jumpers/shunts and a 4050 level shifter.
  • c) an RFID tag (or just you arm, in case you implanted one under your skin)  
  • d) some wire, welder, tin. (be ready to solder, finally)

Part 1: Wiring things up

To complete this part you need to be able to solder. If you don’t anything about it, read up, get a friend to help or watch this video.

Before you start, keep in mind that I’ve never done it and you should *never* do what I do. I’m software :) 

1.1 Solder the header pins to the breakout board

Take the header pins and divide them in two groups of 3.


Prepare your PN532 NFC/RFID controller and your soldering equipment


Now solder the pins to the board as shown in the picture below. Please do it better than I did.image

Now take the two jumpers and use them to set the SEL0 and SEL1 to off.


Setting those selectors to off will “cause the PN532 to boot into UART mode rather than SPI and I2C” (the software we are going to use in the next part of the tutorial only support UART).

Done? Now take off a group of 5 header pins, solder them to the PN532 (FTDICABLE) board, and connect four wires to the pins (GND,5.0V,TXD,RXD) shown in the picture below


So we have this color mapping between pins and wires (you can do it differently) : 

  • GND: Black
  • 5.0 V white
  • TXD, grey
  • RXD purple

Now we can connect the NFC board to the GPIO port of the raspberry.  It’s very simple, don’t panic. The GPIO port is located on the board, and it comes with 16 pins, mapped below. 


The white wire goes to the pin #2 (5V), the black wire goes to pin #6 (ground), grey goes to pin#8 (GPIO14) and purple to pin#10 (GPIO15). If you are wondering how this figure can be rotated to match with the raspi, note that the pin #2 is the one located in the corner of the board. 

In this phase using a breadboard and a breakout kit for raspberry is suggest but not mandatory. You can do the connection however you want. Once everything is wired up, turn on your raspberry and make sure it is connected to the internet. If you need help with first setup please refer to this tutorial : you will learn to configure static ip, ssh, connect to internet, upgrade software, etc.

Part 2: Configuring the raspi

To read data from the NFC we will use libnfc, a library written in c for this purpose. Run the following instruction on your raspberry :

cd /home/pi
mkdir libnfc
cd libnfc
wget http://libnfc.googlecode.com/files/libnfc-1.7.0-rc7.tar.gz
tar -xvzf libnfc-1.7.0-rc7.tar.gz
cd libnfc-1.7.0-rc7
Then you need to edit a configuration file, adding an additional bus (ttyAMA) to default ones. 

EDIT: with the last update of libnfc (1.7.0) our raspberry pi will work without editing the configuration file but simply using the sample config provided. Thanks gilles for poiting it out in the comments. Untested.

sudo cp contrib/libnfc/pn532_uart_on_rpi.conf.sample /usr/local/etc/nfc/devices.d/pn532_uart_on_rpi.conf

And finally configure and build the whole thing
./configure --with-drivers=pn532_uart 
sudo make clean
sudo make install all

We can finally test it out by running one example provided with the libnfc library (see documentation for more stuff).

cd examples
sudo ./nfc-poll

If you followed this guide and you are lucky enough, putting an rfid tag (or your bionical arm) on the reader you will be able to read the ID.

/home/pi/libnfc/libnfc-1.6.0-rc1/examples/.libs/lt-nfc-poll uses libnfc 1.6.0-rc1 (r1326)
NFC reader: pn532_uart:/dev/ttyAMA0 - PN532 v1.6 (0x07) opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
ISO/IEC 14443A (106 kbps) target:
ATQA (SENS_RES): 00  04  
UID (NFCID1): aa  9b  c7  dc 
SAK (SEL_RES): 08 

Done! ;)

If you read so far you could leave a comment below and tell me if it was useful and worked for you ;)

Stay hungry, stay tuned.

Want more raspberry juice?
Ask me!

Support this blog!

0 notes

Prototyping the kiosk

Date: February 12, 2013 at 9:27pm
Tags: #kiosk #model #3d #prototype

Let’s step back from the software and electronics for a minute. 
To try out the kiosk we need to design a proper physical support.

We start with something simple, essential and general purpose. Easy to build and replicate with cheap materials. We stole some cardboards and after some trials we came up with something like this (blondie included).

Tearing apart each side the project should look like this :

Putting it together using SketchUp should look like this.

More detail on materials, electronics and internal structure will be available soon.

Want more raspberry juice?
Ask me!

Support this blog!

0 notes
RFID kit from adafruit, here in one day!

RFID kit from adafruit, here in one day!

Want more raspberry juice?
Ask me!

Support this blog!

0 notes

RFID kit on the way!

Date: January 23, 2013 at 10:53am
Tags: #RFID #raspberry

I just ordered all the component necessary to make RFID reading/writing possible with the raspi. I found out about an italian online store which sells many great producs that are out of stock on Adafruit, located in Rome a.k.a. no waiting time!  
This means that one of these nights Dan and I will try to make it work and write a tutorial about it. 

adafruit rfid kit

Stay Hungry, Stay Tuned.

Want more raspberry juice?
Ask me!

Support this blog!

6 notes

06 - Installing a 10” Touch Screen on the Raspberry

Date: January 20, 2013 at 10:35pm
Tags: #raspberry #touchscreen #tutorial #chalkelectronics

In this post we will connect and setup a capacitive touchscreen to work on the Raspberry Pi. But first let me say thank you to the first user who used flattr to donate a small amount to support  the content of this blog. If you want to try flattr (co-founded by one dude of piratebay), just use the button on the left, its great. Anyway - back to us - check this out!

Fancy jazz music, that’s what we need!. I was in a hurry and didn’t had the time to do a demo with more functional touch application. If you have some suggestion i will be happy to try them out. I’m currently trying to create a simple app using javaFX and test the performances.

I ordered the 10” LCD monitor (with LVDS connector) with a capacitive touchscreen (USB) from Chalkboard Electronics for 134.99$. Apparently this assembled kit is one of the best solutions available for our loved raspi to date (see the official section of the raspberrypi.org’s forum dedicated to screens - in particular these two threads). They ship from Malaysia with decent fees and an excellent customer service (thank you Andrew). I only had a small problem with the Italian custom making me pay a fee for importing an electronic product from Asia. Sh*** happens, randomly. Peace. 

The package comes with :

  • 10” glossy screen LCD
  • HDMI-LVDS converter board
  • LVDS cable
  • Ambient light sensor (I have no idea how to use this. If someone did it, please drop me a line)
Other than that you will need a miniUSB cable and obviously a Raspberry Pi connected to the internet (read this post for the initial setup, and this one here if you are fancy configuring a 3G connection). That’s it. As always, a powered USB hub is highly recommended since the USB ports of the raspi have limited capabilities.

Now, lets get started with the howto. First, turn off the raspi and unplug the power. Chalk-tech.com provides a good-enough tutorial on how to get started plugging in all the cables. Its pretty straightforward and the result should look like the image below, where the microUSB cable brings electric power from the HDMI board to the raspi.


Then connect the LVDS cable to the LCD as following 


Now, cross your finger and turn on the raspi by plugging it to the power. Startx and try to touch the monitor. If the touch doesn’t work right away (like in my case), then you probably do not have the last U4 chip on the LCD controller. Don’t panic, we need to modify a couple of files. First we need to open the terminal and use pico for editing the boot configuration file:

sudo pico /boot/config.txt 

and insert the following line at the top of the file :


Then download the binary EDID file (edid.dat) with wget and place it in the /boot/ directory.

cd /boot/ 
wget http://goo.gl/XBgsw

Genau? Now reboot the system (sudo reboot) and cross your fingers. The touchscreen should work now! I have to say that I’m very satisfied with the quality of the LCD (try to play a 720 clip on it) and the precision of the touchscreen itself. Ok, many issues are yet to be solved with the official ntrig driver (connecting usb mouse and keyboard will create conflicts), but now lets see what happens!

The last step is to calibrate the touch panel using xinput_calibrator. Even if the touch seems to work fine now, its highly suggested you learn how to calibrate it: you’ll need it.  First we need to download and install the some libraries needed by xinput: 

sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev 

Then we need to download the sources and unpack them:

wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz  
tar xvzf xinput_calibrator-0.7.5.tar.gz 

And finally compile it 

cd xinput_calibrator-0.7.5/
sudo make install

Finally, run the calibration by typing :


I told you this one would be easy! Let me know your experiences with any kind of raspberry and touchscreen by leaving a comment below ;). Now the kiosk is getting ready! We have connectivity, a working printer, now a touchscreen, and soon we will have a cardboard and wooden support for the kiosk itself.

In the meantime you might me interested in 3D printing a temporary support.

Stay tuned, donate, smile, and DIY. Thanks to SimoneIsacco, Ermanno and Kappa for the ongoing product-design process. Spoiler: 


PS: 5000+ 50000 (may13 edit) blog visitors, and counting  ;) .

Want more raspberry juice?
Ask me!

Support this blog!

1 note
Prototyping the kiosk/totem with designers using cardboard @ Free University of Bolzano… Stay tuned!

Prototyping the kiosk/totem with designers using cardboard @ Free University of Bolzano… Stay tuned!

Want more raspberry juice?
Ask me!

Support this blog!

0 notes
Raspis porn :) 

Raspis porn :) 

Want more raspberry juice?
Ask me!

Support this blog!

5 notes

05 - Sharing a folder between Raspberry and Mac

Date: January 6, 2013 at 7:47pm
Tags: #dropbox #raspberry #sftp #ssh #folder mirroring

Dropbox does not work on a Raspberry Pi because the ARM platform is not supported (Vote up to shake their asses). Other solutions - like Dropdav or OwnCloud - will cost you some money. On the other hand, you can take advantage of ssh and sftp to achieve similar results with only a few passages and no need of installing extra software on your Raspi.  Ladies and gentleman, I would like to introduce you, Dropbox for Raspberry Pi (sort of :)), aka RaspiBox.


I realized that for the Pi kiosk I needed a lot of files to move around from my mac and the Raspi. Many solutions are available: ftp is the easiest one, samba is another one that require some setup. Or you might use advanced functionality of Transmit as a sftp client. I tried all of the aforementioned solutions, however I was aiming for the simplicity of a dropbox-like approach.

In this tutorial we will see how to mount a remote folder locally on your mac using sftp (basically an ftp over SSH) and automate the process. 

I made a small video to demonstrate its capability.

Fancy eh? To make it work you need :
  1. A Raspberry Pi.
  2. A Mac. I personally used a mbp with MacOsX 10.8. If you write script for windows or linux - please - write me and I will add instructions here.
  3. A connection between the Raspi and the Mac (LAN or Internet).
  4. You need to know the ip address of the Raspi (type ifconfig).  I will assume for this tutorial that your IP is 192.168.xx.yy. Want a static ip address? read this.
  5. Enable SSH on your Raspi (sudo raspi-config). See setup tutorial if needed.

As usual for tackling the problem, let’s divide…
  • Part 1: Set up ssh keys.
  • Part 2: Mount a remote folder using sftp.
  • Part 3: Automate the process and pimp it up.
… and conquer.

Part 1: Set up ssh keys

By know you need to be able to connect to your Raspi via ssh ( ssh pi@192.168.xx.yy ). To login you will be asked to enter a password each time. However you can avoid passwords and login by setting up a pair of SSH keys. We need this step since we don’t want to write our secret password in plain inside the scripts we will use. 

Thousands of guides will teach you how to do the setup. I will be super brief (two steps) so please use Google and help yourself if you miss some passage.
Step1 is to generate SSH a pair of keys: the private and public key (If you already have ssh keys, jump to step 2). On your mac open your terminal and type
ssh-keygen -t rsa -C "your_email@youremail.com"

This will generate two files, by default located under your ~/.ssh/ directory. 

  • ~/.ssh/id_rsa.pub (the public key)
  • ~/.ssh/id_rsa (the private key)

Troubles in doing this? read Github’s guides for setting up git here and an issues helper here.

Step 2:  copy the generated public key to your Raspi’s .ssh/authorized_keys folder. By doing this you are telling him that you are one of the good guys. Open terminal on your mac and type:
cat ~/.ssh/id_rsa.pub | ssh pi@192.168.xx.yy "mkdir .ssh;cat >> /home/pi/.ssh/authorized_keys"

This will work under default assumptions that : a)your public key is stored in your Mac under ~/.ssh/id_rsa.pub , b) your Raspi’s IP address is 192.168.xx.yy, c) the home directory of your Raspi is /home/pi/ .  

Done? Test if it works by connecting to your Raspi via ssh and check if it asks for a password. It shouldn’t. Type exit to close the ssh session. Reward yourself by walking into the kitchen and opening the fridge’s door staring at its content. Done? Back on the tutorial.

Part 2: Mount a remote folder using sftp

Adapting another helpful tutorial we will now mount a folder located in the Raspi using sftp as a remote drive.

First, lets create a folder locally on your mac that you want to use for mirroring the remote folder. To create a folder named RaspiBox under your user’s directory type

mkdir ~/RaspiBox

Then on the Raspi, create a folder for the same purpose

mkdir /home/pi/RaspiBox

Now we will mount locally on the mac the remote folder. In order to do this you need to download and install on your mac the last version OSxFuse from the official page. Is a packager installer, so just double click it.

Note: during the installation process, unless you are using Mountain Lion, make sure to include the compatibility layer in the components to be installed.

Then we need to download and install the last version of sshfs, a file system based on the ssh protocol. You can find the project on github, or click this direct link to download the installer. Install it : double-click, next, next, I agree, next, ok, et al.

Now is simple: to mount the remote folder, open the terminal of your mac and type 

sshfs pi@192.168.xx.yy:/home/pi/RaspiBox ~/RaspiBox

where the first argument is the complete address of the Raspberry folder you want to share, and the second argument is the local path of the folder. There are a bunch of extra useful parameter that we will use later. 

This is enough to play around and see how the two folders are now mirrored.  That was easy right? Now lets make it look good.

Part3 : Automate the process and pimp it up

Now we want our shared folder to look and work similarly to Dropbox.

First un-mount the remote folder on your mac. You can either eject it like a normal drive or type in the terminal

umount ~/RaspiBox

Create an alias of the “RaspiBox” folder and put it on the desktop both on your mac

ln -s ~/RaspiBox ~/Desktop/RaspiBox

and on your Raspi

ln -s /home/pi/RaspiBox /home/pi/RaspiBox

Then you could replace the ugly default icon with a better one.I apologize with designers for my engineer-like photoshop skills. See here how to change icons on MacOs X and here for LXDE (the graphical environment of Raspian). 

Finally this guy created an executable script (using AppleScript) to mount the remote folder every with a simple double click. We can now take advantage of some extra options of sshfs to avoid moving around the .DS_Store files, and mount the RaspiBox folder automatically on startup.
I edited the script a little bit but you need to make some modification yourself to make it work. 
First, download the script on your mac from this direct link. Open it with Apple Script Editor, and edit the ip address (make it static first), the local path and the remote path of the RaspiBox folder.
Finally create an application out of the script by selecting the menu item
and choose “application" in the File format dropdown. Save it wherever you like.

Done. Now try it by double clickling it -et voilà - files are mirrored. Still is not as powerful as dropbox (not even close to it): for instance if you change files in the Raspi, the changes are not immediately shown in your mac folder. In fact sshfs will refresh only after you modify some file on your mac. I think this issue is solvable but I don’t really need it now. Another big difference with dropbox is that your files are not in the cloud. To build such a feature you’d need to hook up events and use the Dropbox API. It shouldn’t be hard, but I don’t really have the time for it now. Yet, I’d appreciate if some of you will try to make it work and share it with the readers of this blog;).  

EDIT: Someone tried something similar here.

EDIT2: Phlaphead actually realized a node.js app that sync two folder with dropbox using the APIs … Clone it and try it https://github.com/Phlaphead/dropbox-sync-js

TIP for developers: try the sftp plug-in for Sublime Text editor, you’ll love it. You can enable folder mirroring inside the project and code from your machine on files that are on your Raspi. 

It was fun to play around with this but now I need to get back and focus on the kiosk.  Next week I will prototype the physical stand using cardboard and try to take some pictures ad write about it. Stay tuned!

Remember: Likes, sharing, comments, flattrs and bitcoins are appreciated and keep me writing. PS: thanks to the 1000th visitor of this blog ;)

Want more raspberry juice?
Ask me!

Support this blog!

0 notes
beer and wood… (coming soon)

beer and wood… (coming soon)

Want more raspberry juice?
Ask me!

Support this blog!

9 notes

04 - Connecting the Raspberry with 3G

Date: January 3, 2013 at 3:11am
Tags: #3g #dongle #huawei #modem usb #raspberry pi #sakis #tutorial #kiosk

Hello reader, happy 2013! ;)  

In this tutorial we will learn how to connect the raspberry to the internet using an USB 3G modem.

Little by little our open kiosk project is progressing : last week we moved our first steps configuring the Raspberry Pi and we learned how to print a receipt. Now we want to be able to place the kiosk everywhere we want, regardless of the availability of a Wi-Fi connection.

To complete this tutorial you will need :

  1. A Raspberry Pi (rpi) with Raspbian (the default distribution) connected to the internet via ethernet (learn to make the first setup here).
  2. An USB 3G modem. I used a common dongle, the Huawei E220: it costs 35$ from amazon. Other USB modems compliant with the raspberry are listed and updated on the official page. If this tutorial worked for you too with a different modem, please drop me a line in the comments.
  3. A SIM card enabled for 3G surfing.
  4. An external powered USB hub to connect the dongle (2) to the rpi (1). You need some extra power since the 3G modem requires more energy than the rpi can provide via the USB slot.
The image below show how the (2) Huawei E220 looks like :
Switch off the raspberry pi, and insert the SIM card (3) into the 3G modem slot :

Now plug the usb modem, the keyboard and the mouse to the powered USB hub (4) and connect it to the rpi (1).


At this point the modem’s LED should start blinking. Depending on the availability of the network, you can refer to the following table to understand the LED :
Blinking (blue) = The WCDMA network is normal. 
Blinking twice every 2.7 seconds (green) = E220 is searching for a network or no network is available.
Blinking once every 2.9 seconds (green) = The GSM network is normal.
On (green) = The GPRS data service is established.
On (cyan) = The HSDPA data service is established.
On (blue) = The WCDMA data service is established. 
Off = Someone misses you.

In my case the LED is blinking blue, indicating that "the WCDMA network is normal”

Now turn on the Raspberry, make sure you are connected to the internet (ethernet or WiFi) and open the terminal. First of all we need to download and install the point-to-point protocol (ppp) on your machine by typing :

sudo apt-get install ppp

Now, following the example of another tutorial, we will use the sakis3g script to connect the rpi to the internet using the USB modem.

Lets start by creating a directory located under your home dir 
mkdir ~/3g && cd ~/3g 

Now download, decompress and make executable, the last version of sakis3g for arm platform:

wget "http://www.sakis3g.org/versions/latest/armv4t/sakis3g.gz"
gunzip sakis3g.gz
chmod +x sakis3g

then simply run the script by typing 

sudo ./sakis3g --interactive

TIP: at this point the ethernet cable is redundant: you can un-plug it!

Finally select the option "Connect with 3g" and press the OK button as shown in the screenshot below:


The script will try to identify your 3G APN automagically (it worked fine with my gateway - H3G Italia), otherwise you can input your own custom settings.

At this point you should receive a confirmation dialog that you are online, and you can verify it with a ping or simply browsing the internet.


To see more detail about your connection you can type 

sudo ./sakis3g connect info

which will output something like this:


Now that you are online you can do whatever you want, e.g. you can be the first to flattr this blog, take lessons of leadership, learn how to code or think about where to go with your portable 35$ computer now online.

To conclude I want to thank the firsts 500 (and counting) visitors of this blog during its first week. This was completely unexpected and made me want to keep writing these small tutorials while reporting the progress of my project. Thank you for feedbacks, comments and donations (yes, someone actually gifted 0.1 bitcoins to keep this blog going!!!).


The open source community is amazing and you guys keep me motivated. Thank you! Next week I will play around with JavaFX to see if I can make something efficient out of it for the kiosk.

Want more raspberry juice?
Ask me!

Support this blog!

7 notes

03 - Printing a receipt with the Raspberry Pi

Date: December 26, 2012 at 3:10pm
Tags: #thermal printer #raspberry #printer #receipt #tutorial

By reading this tutorial you will learn to use your cute raspberry pi to do this :

We will learn how to print a simple “Hello World” using the Adafruit Mini Thermal Receipt Printer.

This is the result of a sunday night of hacking together with a friend. It represent another step forward in the realisation of the christmas project of this blog, an open source web kiosk. I want the kiosk to be able to print, don’t ask me why. Now the printer works.


The ingredients you need to complete this tutorial are : 

I suggest you to buy the starter kit that contains everything you need (but the rpi).

This tutorial is inspired to two articles written by Tobias Floery (1, 2), who we should all thank for his contribution. However his tutorials are not really “noob-proof”, so that’s why I’m writing this down.  Lets divide and conquer the tutorial in three parts :

  1. Connect the printer to the power supply
  2. Connect the printer to the rpi
  3. Print Hello World

Before you start, make sure you have the two cables that comes with the printer.


Part 1: Connect the printer to the power supply

First of all don’t forget to turn off the raspberry pi, please: if you are connected to it via ssh you can type 

sudo shutdown -h now

and unplug the power source. Then connect the cables to the back of the printer as shown in the picture below. 


In this first phase we can ignore the green/yellow/red and focus on connecting the DC IN (black/red cable) to the power. For this purpose you need to plug the 5V 2A power supply to the 2.1 mm DC jack adapter, both provided with the kit. Afterwards you can connect the jack adapter to the red/black cable as shown in figure below:


Now you can plug it to the power adapter, and if everything went fine you can see how the green led on the printer starts to blink. Now open the printer, insert the roll of paper inside the printer (image below) and close it.


Press the only button on the printer and see if the paper is rolled out. Does it work? Do it again, and again, just for the thrill of it.

Part 2: Connect the printer to Raspi

The second step is connecting the printer to the rpi through the GPIO pins (read : General Purpose Input/Output). It’s very simple, don’t panic. The GPIO port is located on the board, and it comes with 16 pins, mapped below.


To connect the printer we make use of the pin #6 (Ground) and the pin #8 (GPIO14). If you are wondering how this figure can be rotated to match with the rpi, note that the pin #2 is the one located in the corner of the board. 
Now, take the green/yellow/black cable. Since we wanted to be able to use the wires that come with the starter kit without any further soldiering, and it was 3AM at this point, we did something simple and radical: we got rid of the green cable. Cut it out, you don’t need it since the printer is not transmitting any data to the rpi through the TX port ;) .
Now plug the cables to the pin #3 and number #8 of the GPIO, as shown in the detail below.

If you didn’t do it before, now simply connect it to the TTL socket in the back of the printer : the black cables goes into GND, and the yellow into the RX. Green dude, rest in peace.


Done, we are now ready for the software part of this tutorial. I told you that it wasn’t that hard. Now lets try to make it work.

Part 3: Print Hello World

To interface the rpi with the printer we will use the driver class adapted from arduino and available on github. Its a c++ application based on the Qt framework, hence we need to install some dependencies to make it work. Let’s start installing Qt4 on the rpi by getting some prerequisites (you might already installed some of them): 

sudo apt-get install gcc

And finally the application framework :

sudo apt-get install qt4-dev-tools qtcreator

Now we need a component written for Qt that lets the framework communicate with the serial port:  qextserialport. To install it statically in the system clone it and compile as following :

git clone https://code.google.com/p/qextserialport/ 

cd quextserialport


sudo make install

cd ../
rm -r quextserialport 

 then download and compile the Qt project for the printer from github . (This will be your working directory from now on).

git clone https://github.com/thefloe1/Raspi-Thermal-Printer.git
cd Raspi-Thermal-Printer 



Sweet! Now we have everything we need to make it work. For the next part, we need to open the Qt framework application user interface, therefore launch X (if you dint’ do it before) :


Now open the File Manager (under the menu Accessories) and navigate to the Raspi-Thermal-Printerfolder downloaded previously, and then to the examples/printertest/ subfolder, which contains the working example. Right click the printest.proTools  and select QRcreator to open the project file with the Qt environment.

Then we need to configure the environment by selecting the menu Tools -> Options then selecting the Build & Run element on the left, and finally the Tools Chains tab. Press the Add button, and chose GCC from the dropdown menu.  Select it in the option window and make sure to insert the following parameters:

compiler path -> /usr/bin/arm-linux-gnueabihf-gcc-4.6 
Debugger : /usr/bin/gdb

mkspec : default


Now change tab and click the Qt versions tab, press add and select /usr/bin/qmake-qt4 . Apply changes by pressing the ok button.

Another configuration step is telling Qt to deploy locally and not to a remote linux machine. Select the menu item Help -> About plugins and uncheck Device support -> Remote linux.

Now we need to change some system settings:  close Qt Creator and open the terminal. We need to free the tty port of the GPIO (pin #8). Type 

sudo pico /boot/cmdline.txt 

and replace the content with

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Close the file and save ( Control + x then hit y). Last modification is to set the slot free on boot by editing inittab :

sudo pico /etc/inittab 

 and commenting (#) the line 

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Now reboot raspberry to make the changes effective.

sudo reboot

Ok, I know, it was a little bit boring so far, but now you are ready to print! Let’s try something out. 

Re-open the file Raspi-Thermal-Printer/examples/printertest/printetst.pro with Qt Creator (right click). Find the file printertest.cpp located under Sources in the left column and play with it. This is how you print using different styles. If you want you can edit the file by replacing the p->write part with a simple Hello World: 

p->write("\n Hello, (physical) world!\n");

Save the file. Now press build the project by pressing the big hammer icon located in the bottom left cornet of Qt Creator. 


This will create a new folder with the compiled application. Navigate to it (it depends on where the folder is located on your disk). In my case  :

cd ~/Raspi-Thermal-Printer/examples/printertest-build-desktop-Qt_4_8_2__System__Release

Now, call your mum and your best friends over skype, and prepare them to the big event. Open the terminal, and to finally print, type : 


Clap your hands, congratulate yourself, and have huge fun.  In the next posts we will learn how to make more complex stuff and we will write some more code to make printing a little more intuitive.

I hope I dind’t make too many mistakes. If you had any doubts or just a simple “thank you” feed back, please leave a comment full of love at the bottom of this page, so I know that someone actually is reading this stuff. It keeps me motivated to write ;)  


Subscribe to this blog via rss.

Want more raspberry juice?
Ask me!

Support this blog!

7 notes

02 - Initial setup of the Raspberry Pi

Date: December 24, 2012 at 5:39pm
Tags: #raspberry #setup #ssh #static ip #kiosk mode #browser #overclock #tutorial #chromium #screensaver


I’m gonna write down some thoughts on the simple steps I followed to have a Raspberry Pi (rpi from hereon) up and running. You can read thousands of posts that look exactly like this. Anyway, in this post we will connect the rpi for the first time, turn it on, update the software and run some simple customisation.

You will see how to:

  • buy a raspberry pi
  • connect it to a screen,mouse,keyboard and the internet
  • load the SD card with wheezy raspbian
  • boot the machine for the first time with an orgasm
  • install git and rpi-update for update the firmware
  • install chromium
  • enable ssh
  • configure a static ip address
  • overclock the rpi
  • prevent the screen from going black and disable the screensaver
  • load the browser in kiosk mode automatically at startup

Ingredients you will need for this receipt:

  • A Raspberry Pi ( you can buy one here, good luck with waiting time )
  • A tv monitor and an HD or composite cable. 
  • An SD card 
  • An USB mouse 
  • An USB keyboard
  • An ethernet cable 
  • Micro usb power supplier
  • An hour of your time
I personally bought everything from the RS website, and magically the “25$ linux board” became something like “the 70€ euro computer we will ship to you in one month, if you are lucky” .
Once I received everything, I downloaded the image of the operating system from the rpi official website. I downloaded wheezy raspbian, which is basically a rpi-ready linux distribution based on Debian.  
The next step is to load the software into the SD card. To do that I personally used a graphical utility tool for mac here, it takes 2 minutes. If you don’t have a mac read the official guide. Insert the SD card in the slot, plug the cable cables and finally connect the micro usb power and …
… at this point you should feel excited. After that you’ll realize that your 25$ (or 70€) computer is booting up, asking you to perform an initial configuration. When you are done with the configuration close the wizard and type in the terminal (I assume you guys know how to use the terminal).
At this point you should have an orgasm.  When you are done lets start updating the list of packages and install git (you will need it). Open a terminal and type 
sudo apt-get update && apt-get upgrade -y && apt-get install git-core 
It will take a while, get a shower in the meantime.  Next step is to install rpi-update, an utility tool to update the firmware (we will use it later on).
 sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update 

Now, remember we are building a kiosk that will run a browser in full screen, therefore we will need to install chromium, x11-server-utils and unclutter (to hide the cursor from x11). 

 sudo apt-get install chromium x11-xserver-utils unclutter 
Then, we want to be able to control the rpi by remote via ssh. To enable ssh access simply we can use the wizard configuration tool. (Don’t forget to change the default password.)
sudo raspi-config
After you are done with that you can test it by logging in via ssh from another machine of your network:
ssh pi@192.168.1.xx
Replace 192.168.1.xx with the eth0 local ip address of the rpi. In case you live under a rock, use ifconfig on the rpi to see the ip address of the ethernet interface
However, by default your  rpi will get a new ip address at each reboot. We don’t wont that: instead we want to set up a static ip address for our little cheap friend.
We should make some modification to the interfaces file, and for this purpose we can use pico to edit the file.
sudo pico /etc/network/interfaces

Find the line of the eth0 interface, and change it from dhcp to static. Right below that line, paste the following lines.

address 192.168.1.xx 
gateway 192.168.1.yy

Make sure to replace the values with your desired address and the ip of your gateway (use ifconfig again if you don’t know what your gateway address is).

When you are done your file /etc/network/interfaced should be something like this:


Save it (control+X , confirm with y).

To see the system affected with the changes you need to reboot the system (sudo reboot).
We are almost done for today.

Now lets make a little bit of optimisation  to let our rpi run a little bit faster. As suggested here we can over-clock the processor to 700 MHz using the wizard :

sudo raspi-config

Change mode to 224MB memory split using rpi-update (see instruction for installation above) :

sudo rpi-update 224

Sweet. Now, since we will use the rpi as a kiosk we want to prevent the screen from going black and disable the screensaver. Thanks to this guy I learned how to do that by editing the autostart file:

sudo pico /etc/xdg/lxsession/LXDE/autostart

find the following line and comment it using a # (it should be located at the bottom)

#@xscreensaver -no-splash

and append the following lines

@xset s off 
@xset -dpms
@xset s noblank

Save, reboot.

Extra hint: If you want to automatically load a browser full screen in kiosk mode every time you turn on the rpi you can add one of these two lines to the file /etc/xdg/lxsession/LXDE/autostart

@chromium --kiosk --incognito www.google.it
@midori -i 120 -e Fullscreen -a www.google.it -p

The first is for chromium and the latter is for midori, the rpi default lightweight browser. This step is not recommended now, we will do it later on in the next tutorials, now forget it and reboot the system:

sudo reboot

The first tutorial is done! Don’t hesitate do comment, share, and ask questions!  And stay tuned, in the next post we will learn how to use a receipt thermal printer for our cool kiosk ;)

Since today is Christmas, peace and feliz navidad to everybody. Enjoy this video of a rpi controlling xmas light and don’t forget to put a smile on your face.


Want more raspberry juice?
Ask me!

Support this blog!

3 notes

01 - Pi Kiosk: An open source web kiosk

Date: December 22, 2012 at 10:43pm

PiKiosk is the name I gave to this project that is meant to be a simple physical Kiosk running a web browser. That’s it.


Yes, a kiosk such as ATM machines or automatic ticket machines. It will be powered by the Raspberry Pi (the 25$ computer) and run as much open hardware/software as possible.

These are the characteristics that are in my mind at the moment:

  • 10” Touchscreen
  • Receipt printer
  • 3G antenna
  • RFID reader
  • Easy to build 
  • Fully documented
  • Handsome (yes, is dude-shaped)
  • Cheap, cheap, cheap

I’m just getting started with this project, and I started receiving the first components last week. This blog will keep trace of the progresses, challenges encountered, technical solutions and everything I’ll be able to share, from an hardware n00b point of view.

Why would I do that? Well, DIY is fun, and learning keeps me alive. Furthermore i’ve found that :

  • Kiosks can be expensive
  • I haven’t see open source hardware/software kiosks around 
  • I believe many small businesses could benefit from a cheap customisable ready-to-use web kiosk

I just started assembling the Raspberry Pi and I’ll start working on it later this week. Stay tuned, its gonna be fun and I’ll invite many guests to help me out ;).


If you liked this post and you want some more, you can subscribe or ...

Donate Bitcoins

or simply spread the word to makers and hackers like you

Vote on HN