Editor’s Note: This content is contributed by Toheed Ashraf, Senior Systems Design Manager in Systems Software Integration and Validation team



The Coffee Conundrum

I am a coffee connoisseur and visit the coffee kiosk twice a day, so naturally, I really appreciate the reward system that the cafeteria offers. The only problem was that I kept losing my reward cards (ugh!). I asked around and learned that others shared a similar experience. At the same time, our company launched an internal competition to showcase the power of Zynq UltraScale+ MPSoC — so I used this opportunity to utilize the Xilinx ecosystem to come up with a solution.


The Solution

The Ultra96 board came with a pre-built PetaLinux image, so adding plug-n-play USB devices was fairly straight-forward. I thought of using a USB badge scanner to keep track of the coffee purchases and found a $100 badge scanner that worked with our company badges. The badge scanner acts as an HID (Human Interface Device), and the scanned value can be read as keystrokes. Since the cafeteria offers a reward for both coffee and smoothie purchases, I configured two card readers – this was mainly done to make it user-friendly for the Café staff.

The entire project was done with 250 lines of Python code that executed on the pre-built PetaLinux image. The code maintains a SQlite database. It reads the scanner input and then queries the database. If the badge value doesn’t exist, then it creates an entry and sets the count to 1. If the entry already exists, it updates the count. The count value is displayed on the attached LCD. It alerts the users if they have reached the magic number for a free drink.

Reading and storing badge IDs is a major concern for the global security team. This was addressed by salting and then hashing the values. Another concern was hardware failure; in case of such failure, the database could be lost and we could have many unhappy users. I added daily, weekly, and monthly cron jobs to back up the database onto the Ultra96 server. This way, we can recover from a catastrophic failure. The following flow diagram shows the various blocks within the main Python function and the cron jobs that back up the database.




<Figure 1. Flow Diagram>


Physical Design

I was also mindful of the rough usage of this board once it was deployed, I wanted to ensure that the final product was:

  • Aesthetically pleasing
  • Rugged
    • Can withstand heavy use
    • Water/dust proof (to some degree)
  • Thermally proficient
    • The design should allow for sufficient airflow to allow cooling of the board & LCD for long-term system stability
  • Accessible
    • Unobstructed view of LCD
    • Allow easy access to USB & power connectors. In case of any issues, they can be disconnected/connected
    • Add external power ON / OFF button. Eliminates the need to physically touch the board or mezzanine
  • Showcased the Ultra96 board & kit

Based on the above I worked with a machine shop to come up with a design that met the above criteria. See the figure below.


<Figure 2. Cafe Reward Program Application>

I am happy to say that as of today -- we have 250 unique coffee users and 50 unique smoothie users of this application. The ease of design is a testament to the power of PetaLinux and its prebuilt functions and libraries.


Ultra96 Board & Kit

Xilinx’s Systems Software Integration and Validation (SIV) team developed a community board. Internally developed board idea and many other projects including this application were well-received and became publicly available due to high popularity. That’s how Ultra96 board was born! This was one of the first credit-card-sized boards to be supported by PetaLinux (also developed by Xilinx SIV). Here’s a high-level block diagram of the Ultra96 board:


<Figure 3. Ultra96 Zynq UltraScale+ Development Board Based on Zynq UltraScale+ XCZU3 MPSoC>


Want to learn more? Want to create your own projects? Here are a few links to help you to jumpstart your own projects:


Original Date: ‎09-18-2018