AL DENTE
aka how to handle tasks like a chef with a Raspberry Pi
For the first edition of CC’s Hack Corner, Eunice Lee and I got together on a Sunday to build her brilliant idea: Al Dente, a Raspberry Pi application that prints tasks like orders in a chef’s kitchen. The best part? Once you’re done, you get to spike it just like in the kitchen. Trust me, it feels good.
What’s a Raspberry Pi? Put simply, it is a tiny computer. Not pie. A quick way to see it work is by connecting it to a monitor. It’ll act just like your laptop or desktop! Except probably a bit slower. It’s a great tool to expose yourself to hardware and learn about building gadgets.
Check out the code on GitHub, use it, improve it, test it, and if you’re curious and/or new to this, read how we did it below!
The Recipe
Ingredients:
- A Raspberry Pi
- A thermal printer
- A monitor + HDMI cable
- A mouse + keyboard
- A wifi adapter
The Steps
Connect everything
- Plug the Pi to the monitor, the thermal printer, the keyboard, the mouse, and the wifi adapter. Turn on the monitor and connect to the Internets via wifi.
- Open the terminal.
- Clone the repo:
git clone git@github.com:euniceylee/aldente.git
- Get into the app’s directory:
cd aldente
- The file with all of our app’s functionality is called
get.py
Open it with nano, the pi text editor:
nano get.py
This is what you should see.
Setting up the Trello API
- Get your Trello API key and add it in
get.py
:
trello = TrelloApi('API-KEY-HERE')
- Create a Trello board and a list
- Download the Trello python package and follow the instructions to install it on the Raspberry Pi
Getting the list ID
Let’s get our TO DO
list’s id and add it to get.py
:
cards = trello.lists.get_card('LIST-ID-HERE')
- Install Postman, an application that lets us simulate requests to APIs and get the data we need. In our case, the data is the list id.
- Grab the board’s id from the board’s url:
- Our url:https://trello.com/b/HFWfv1sO/aldente
- The board id:HFWfv1sO
- In the Postman’s
GET
field, enter the url below, gotten from the Trello docs:
https://api.trello.com/1/boards/YOUR-BOARD-ID/fields=id,name,?lists=open&key=YOUR-API-KEY
- After hitting
send
on Postman, this is what you should see:
- In the Postman response, find your list by its
name
and grab itsid
. - Add the list id to
get.py
:
cards = trello.lists.get_card('LIST-ID-HERE')
Install the scheduler:
In order to keep checking for new Trello cards and print them in real time, you need to periodically run our code. To do that, install this scheduler used like so:
# schedule job to run the code every 2 seconds
schedule.every(2).seconds.do(job)
Run the application!
- Make sure that you’re in the right folder with the
pwd
command. It should return a path ending withaldente
, similar to this:
/something/something_else/aldente
- Here are two ways to run the application:
1- Typepython get.py
in the terminal and hit enter
2- Get in the Python shell by enteringpython
thenexecfile('get.py')
- Add cards to your Trello board, watch it live print, and stab away!
Et voila!
Let us know how you did!
Join the Color Coded slack community by visiting our site and stay in the loop.
Want to write an article? Send us a note.