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) :
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.
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) :
5.0 V white
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 :
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.
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!
RFID kit from adafruit, here in one day!
Want more raspberry juice? Ask me! Support this blog!
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.
Stay Hungry, Stay Tuned.
Want more raspberry juice? Ask me! Support this blog!
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 thesetwothreads). 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
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.
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:
cd xinput_calibrator-0.7.5/ ./configure make 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.
Dropboxdoes 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 :
A Raspberry Pi.
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.
A connection between the Raspi and the Mac (LAN or Internet).
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.
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 email@example.com ). 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 "firstname.lastname@example.org"
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:
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
Then on the Raspi, create a folder for the same purpose
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
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
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;).
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!
beer and wood… (coming soon)
Want more raspberry juice? Ask me! Support this blog!
A Raspberry Pi (rpi) with Raspbian (the default distribution) connected to the internet via ethernet (learn to make the first setup here).
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.
A SIM card enabled for 3G surfing.
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 sakis3gscript 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:
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!
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 :
A raspberry Pi (we discussed in another post how we initially configured it) connected to a monitor
Tape, red wine, a gospel playlist. (kidding, you don’t really need any tape now).
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 :
Connect the printer to the power supply
Connect the printer to the rpi
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):
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:
Now reboot raspberry to make the changes effective.
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 :
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 ;)
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
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
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
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.)
After you are done with that you can test it by logging in via ssh from another machine of your network:
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.
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:
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.
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:
Easy to build
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 :
A decent blog should start with a decent quotation.
"Hardware is the new software" - A. Einstein
Do you like buzzwords too? Of course you do, everybody does. The blog will include buzzwords like Startups; DIY; Node.js ; Internet of things; Arduino; Raspberry PI; Crowdsourcing; NoSQL; Thermal printing; Shared economy; Serendipity; Sustainability, et al.
I just finished a MSc in software engineering and I’m fed up with software. I need to turn my brain upside down for a while. I need to build something that I can touch and cuddle, something that when is ready I can take a picture of. Last time I actually built something like that I was 18: a sound system for my first car. Right after I finish building it, my car got stolen. Turned out that I posted the pictures of the car with the plain licence plate in a crowded newsgroup. What a brainer.
This time is different : now I’m 26 and this time I’m gonna build something safe (and I hope I’ll eventually get to use it). And I hope you’ll use it too.
I’m gonna get started very soon, since the Mayas are setting my ass on fire. Plus I’m unemployed atm, moving out of Sweden and I can’t really control my obsessions for long. Stay tuned, I’ll post more details asap.
If you liked this post and you want some more, you can subscribe or ...