Free Beer Selfie

Take a chance to offer a free beer to a stranger !

Similar projects worth following
A machine standing on a bar, with a screen, a camera pointing at you and a thermal ticket printer. A big button letting you to play. A button on the back for the barman to launch the game.
Rules are:
- You can play each time you buy a beer.
- If you loose, you get a souvenir ticket with your face
- If you win, you get a ticket with a face of someone else. If you find this people, both get a free beer.
What you have to do :
- Buy a beer
- Press the big button
- Retry once you glass is empty


The hardware is not very complexe if you're familiar with Raspberry Pi. The screen is a recycled one from office, a standard 19" DVI. The resolution is 1280x1024. It's rotated in portrait mode.

The printer is an Epson TM-T20II, connected to the Rpi with USB.

The camera module is a clone of the official Raspberry pi, with a slightly more luminous lens. Connected directly to the Rpi with the CSI port.

The buttons are connected between Rpi GPIO and 0V. And their LED to a small driver board and Rpi GPIO.

All power supplies (screen, Rpi 5V, printer) are connected to the same plug and a general switch.


The raspberry pi is running under the official Raspbian image.

The software is written in Java and uses two external libraries. One for GPIO - Pi4J and an other one for USB - usb4Java . The code source is on github :

In addition, the native raspbian program raspividyuv is used to get the camera frames. The camera output is on top of everything and always visible.

Once the button is pressed, a frame is saved. The gray scale image is saved to a jpeg file, then data are dithered (Floyd–Steinberg) and sent to the printer.

Originally JavaFX was used to display a small interface. It was convenient as it worked without X. Now Oracle decided to not support anymore JavaFX on ARM. So It's back to Swing and LXDE should be started...

  • 1 × Raspberry Pi Rpi 2B
  • 1 × Raspberry Pi Camera module
  • 1 × LCD screen A recycled one
  • 1 × Thermal printer Epson TM-T20II
  • 1 × Buttons

View all 6 components

  • Sharing button and flexibility

    Muth04/22/2017 at 09:06 0 comments

    I've worked on the code for the Port Hackathon last year. I've put another button in the front panel if you'd like to share the picture taken and printed on a Facebook album. It was used for ThePort2016 and TEDxCERN. After the countdown, a screen appears for 10 sec asking you if you want to share the picture on the facebook album of re-print the picture. The album adress is printed on the tickets.

    I recently update the code to use different printer commands. I was contacted by someone with a different printer model. Still Epson, but the TM-T88IV. It seems working fine now, and it possible more printer model can now be compatible. There is more settings now in the config file, it takes image files for the ticket header, and you can choose two different dithering algorithm.

    Right is the classical Floyd-Steinberg, left is the Jarvis Judice Ninke dithering (Translated in Java the nice C code from )

  • Small mod

    Muth04/05/2016 at 13:03 0 comments

    After the quite successful entertainment brought by the Sefli machine on the Juggling Convention, I had to modify a bit the functionality for the Open Geneva Hackathon.

    There is a big countdown of 10 second once you press the button. You don't know when the picture is taken during this interval. It is like a lottery, sometime the printed ticket don't show your face but the one of someone else with the text "find who's on the picture !"

  • Case filling

    Muth03/29/2016 at 15:55 0 comments

    There is plenty space available in this box ! The raspberry-pi and camera module somehow looks funny.

    The back button and main power connection.

    The printer, and front button.

  • Raspberry-pi to LED

    Muth03/29/2016 at 15:46 0 comments

    The big buttons could be filled with a big bright led. That's quite nice, I have to find a way to drive it from the Raspberry pi GPIO.

    I have around Mosfet IRF530, but the need more than the Rpi 3.3v level to drive a reasonable current. I added quick and dirty transistor BC547.

    To connect the button to the raspberry pi, I configured the GPIO with a pull-up, and the button shorts to 0V.

  • Wood case

    Muth03/28/2016 at 10:34 0 comments

    It's been a long time I'd like to build an Arcade based on R-pi. If this project fail, I could always re-use the case if it's looks like an arcade yet.

    I don't have too much time, then I go for the most simple solution. Just wood plates, screwed by the inside. The main plates are the sides.

View all 5 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates