[Arduino] RFID payment terminal

Three years ago, we gathered a few euros to buy a fridge for our office. Since then, we’ve sold sodas with very little profit. One can after the other we had enough money to buy a freezer.

Our good old fridge

So as to simplify the accounting we sell sodas and ice creams in exchange for a token. Yes, we have custom engraved tokens :-)

The tokens

In a few days, we’ll make a big step forward: we’re going to replace the whole token money with virtual wallet associated with personal RFID tags.

I built a payment terminal that sits next to the fridge and Levi wrote a web application so that every “customer” can check his or her account.

Me, buying a soda with my RFID tag

On this project, I’ve been working on the RFID terminal only. Please check Levi’s blog for the server part (spoiler: it’s in ASP.NET MVC, and uses Bootstrap and Angular.js)

Hardware

Arduino Ethernet 50
125Khz RFID module 12 €
2x20 LCD Display 10 €
Piezzo buzzer 3 €
Push buttons x 2 2 €
Prototyping board 10 €
Enclosure 12 €
Total 99 €

Schematics

Here are the electronic schematics, made with Fritzing.

Part 1: MCU and Ethernet

Part 2: LCD Screen

Part 3: RFID Reader

Assembly

I created a board that plugs on top of the Arduino, just like a standard “shield”, so that the fixture and the maintenance is easy.

Board and Arduino in the enclosure

Software

The source code is available on GitHub: https://github.com/bblanchon/DrinksRfidTerminal

Here is a Class Diagram if you want to navigate through the source code:

Class diagram

Legend:

  • Green: the main program
  • Yellow: a class
  • White: a customizable .h file
  • Gray: a third party library

Comments

It took us about two months to complete that project, working only during the lunch break.

The main difficulty was to parse the JSON data from the server. As I stated in a previous article, I tried all existing JSON libraries for Arduino with no success. I finally wrote my own Arduino JSON Parser library.

Lastly, the Arduino Ethernet is a bit small for that kind of project. The binary size is 28634 bytes, it’s 89% of the available memory on the board. I had to remove a few features (such as a serial console) and I reduced log to the minimum, to keep the size below 30 KB.

Next time I need to work on a similar project, I think I’ll use a bigger board, like the new Arduino Yùn.