Projects / Café digital menu board

Café digital menu board

Beginner2 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. Pi 4

    Install Flask

    Run the app and open it on the Pi.

  2. Pi 4

    Design the page

    Large type, high contrast.

  3. Pi 4

    Add the editor

    Add the protected edit page.

  4. Pi 4

    Change the password

    Replace the placeholder.

  5. Pi 4

    Test from a phone

    Edit prices and watch the TV update.

  6. Pi 4

    Set kiosk mode

    Start at boot.

  7. Pi 4RASPBERR

    Check a power cut

    Menu returns by itself.

In short

How do you build a café digital menu board?

A TV and a Pi show the café menu with prices that staff change from a phone. You need Raspberry Pi 4 Model B (4 GB), SanDisk microSD card 32 GB (A1, Class 10), Raspberry Pi 27 W USB-C power supply and Raspberry Pi micro-HDMI to HDMI cable. It takes 7 steps and about 120 minutes.

Level
Beginner
Time
About 120 min
Parts
4

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Pi micro-HDMITV HDMI (through the cable)Picture
Pi USB-CRaspberry Pi power supplyPower
Pi Wi-FiThe café's networkStaff edit from their phones

Code

The TV shows a web page that refreshes itself every minute, and staff edit the menu on their phones from the page at /edit, which is protected by a username and password. Change the placeholder password before use and keep it private. This is HTTP Basic authentication over plain HTTP, so the password can be read by someone on the same Wi-Fi: keep the Pi on the café's staff network and not the guest Wi-Fi, and do not open the page to the internet. Prices are saved in a small file, so a power cut loses nothing. Set the Pi to start the kiosk at boot, and test that the page reappears after a power cut. For a layout that changes between breakfast and lunch, the page can switch menus by the time of day as a next step. Keep the Pi and its supply away from the counter's wet area and the kitchen's heat.

# Café menu board. Run on the Pi. Install first: sudo apt install -y python3-flask
# Save as ~/menu/app.py and run: python3 app.py
# The TV shows http://localhost:5000/ and staff open http://<pi-address>:5000/edit on their phones.
import json, os
from flask import Flask, request, redirect, render_template_string, Response

app = Flask(__name__)
FILE = "menu.json"
EDIT_USER, EDIT_PASS = "staff", "CHANGE-THIS-PASSWORD"          # placeholders: set your own and keep them private

def load():
    if os.path.exists(FILE):
        with open(FILE) as f: return json.load(f)
    return {"special": "Masala chai combo", "items": [["Filter coffee", 30], ["Masala chai", 25], ["Veg sandwich", 80]]}

def save(m):
    with open(FILE, "w") as f: json.dump(m, f)

def need_auth():
    a = request.authorization
    return not (a and a.username == EDIT_USER and a.password == EDIT_PASS)

SHOW = """<!doctype html><html><head><meta http-equiv="refresh" content="60">
<style>body{background:#1b1b1b;color:#f4e9d8;font-family:Georgia,serif;margin:30px}
h1{font-size:64px}.row{display:flex;justify-content:space-between;font-size:44px;border-bottom:1px solid #555;padding:10px 0}
.special{background:#7a3b10;padding:16px;font-size:40px;margin:20px 0}</style></head><body>
<h1>Menu</h1><div class="special">Today's special: {{ m.special }}</div>
{% for name, price in m['items'] %}<div class="row"><span>{{ name }}</span><span>Rs {{ price }}</span></div>{% endfor %}
</body></html>"""

EDIT = """<!doctype html><html><head><meta name="viewport" content="width=device-width"></head><body style="font-family:sans-serif">
<h2>Edit menu</h2><form method="post">
Special: <input name="special" value="{{ m.special }}" style="width:100%"><br><br>
Items, one per line as: name, price<br>
<textarea name="items" rows="12" style="width:100%">{% for name, price in m['items'] %}{{ name }}, {{ price }}
{% endfor %}</textarea><br><button>Save</button></form></body></html>"""

@app.route("/")
def show(): return render_template_string(SHOW, m=load())

@app.route("/edit", methods=["GET", "POST"])
def edit():
    if need_auth(): return Response("Login needed", 401, {"WWW-Authenticate": 'Basic realm="Menu"'})
    if request.method == "POST":
        items = []
        for line in request.form["items"].splitlines():
            if "," in line:
                n, p = line.rsplit(",", 1)
                try: items.append([n.strip(), int(p.strip())])
                except ValueError: pass
        save({"special": request.form["special"], "items": items})
        return redirect("/edit")
    return render_template_string(EDIT, m=load())

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000)

# Open the board in full screen at boot (labwc desktop): add to ~/.config/labwc/autostart
#   python3 /home/pi/menu/app.py &
#   chromium-browser --kiosk --noerrdialogs --disable-infobars http://localhost:5000 &

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
TVShows the menu in large type
Edit on a phoneAsks for the password, saves
TV refreshNew prices within a minute
Power cutBoard returns with the last menu

If it does not work

Cannot open /edit from the phone

Check the Pi's address and that both are on the same network.

Password rejected

Check the user and password constants.

TV shows the desktop

Check the kiosk autostart line for your desktop.

Prices do not save

Use whole numbers on each line after a comma.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the café digital menu board?

Raspberry Pi 4 Model B (4 GB), SanDisk microSD card 32 GB (A1, Class 10), Raspberry Pi 27 W USB-C power supply and Raspberry Pi micro-HDMI to HDMI cable.

How long does the café digital menu board take to build?

About 120 minutes for a beginner maker, in 7 steps.

How do I know the café digital menu board works?

TV: Shows the menu in large type. Edit on a phone: Asks for the password, saves. TV refresh: New prices within a minute.

Cannot open /edit from the phone: what should I check?

Check the Pi's address and that both are on the same network.

Password rejected: what should I check?

Check the user and password constants.

TV shows the desktop: what should I check?

Check the kiosk autostart line for your desktop.

Prices do not save: what should I check?

Use whole numbers on each line after a comma.