π¦ Bill of Materials & Shopee Verified Parts
All components are verified standard off-the-shelf electronics. No proprietary boards required.
OpenWrt Gigabit Router
Tested and verified on Ruijie Reyee EW1200G Pro (compatible with any OpenWrt gigabit router). Full Gigabit WAN + 3 Gigabit LAN ports, Dual-Band AC1200 Wi-Fi with high-power PA/LNA amplifiers.
ESP32 DevKit Board
Dual-core 240MHz SoC with hardware interrupt timers for microsecond coin pulse debouncing. Any 30 or 38-pin version (Type-C or Micro-USB) works.
Universal Multi-Coinslot
Recognizes β±1, β±5, β±10, and β±20 coins (old & new BSP series). Includes optical anti-stringing sensors and hardware drop inhibit lock line.
12V Centralized Power Supply
12V 5A or 10A CCTV metal switching PSU. Powers router, coin acceptor, and Raspberry Pi from a single 220V plug with no voltage sags.
Quick Lever Terminal Blocks
Reusable spring-lever wire clamps. Eliminate electrical tape and soldering. Makes maintenance, parts replacement, and voltage testing effortless.
LM2596 Buck & 10kΞ© Resistors
LM2596/XL4015 steps down 12V DC to 5.1V 3A for SBC/ESP32. A 10kΞ© resistor connects in series between the coinslot white pulse wire and the GPIO pin for current limiting and gate protection.
π Complete Wiring Blueprint & Pinout Reference
Follow this exact circuit schematic to wire the power supply, coinslot, 10kΞ© resistor, and controller.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β‘ CENTRALIZED 12V 5A/10A POWER SUPPLY β
β [ L ] [ N ] [ EARTH ] β [ +V (+12V DC) ] [ COM (Ground / GND) ] β
βββββββ¬ββββ¬βββββββ¬βββββββββββ΄βββββββββββ¬ββββββββββββββββββββββββββββββ¬ββββββββββββββββββββ
β β β β β
220V AC MAINS βΌ βΌ
βββββββββββββββββββββββ βββββββββββββββββββββββ
β QUICK TERMINAL +12V β β QUICK TERMINAL GND β
β (Lever Block 1) β β (Lever Block 2) β
ββββ¬βββββββββ¬ββββββββ¬ββ ββββ¬βββββββββ¬ββββββββ¬ββ
β β β β β β
ββββββββββββββββββββββββ β ββββββββββββββΌβββββββββΌββββββββΌβββββββββ
β β β β β β
βΌ (+12V) βΌ (+12V) βΌ (GND) β βΌ (GND) β
βββββββββββββββββ βββββββββββββββββββ βββββββββββββββββ β ββββββββββββ β
β RUIJIE ROUTER β β ALLAN / WEIYU β β BUCK 12V->5V β β β COMMON β β
β 12V DC JACK β β COINSLOT β β DC CONVERTER β β β GROUND β β
β (+) Center Pinβ β Red Wire (+12V) β β IN+ / IN- ββββ β BUS β β
β (-) Outer Ringββββββββββββββββ€ Black Wire (GND)β βββββββββ¬ββββββββ ββββββ¬ββββββ β
βββββββββββββββββ β β β (5V Power) β β
β White (COIN)βββ β β Direct β β
β Gray (INHIBIT)βΌββ βΌ β β
βββββββββββββββββββ βββββββββββββ β β
ββ β 5V DC OUT β β β
ββ β USB-C/PIN2β β β
ββββββββββββββββββΌβ βββββββ¬ββββββ β β
β β β β β
β ββββββββββββββββΌββββ β β β
β β 10kΞ© RESISTOR β β β β
β β [== 10k OHM ==] β β β β
β ββββββββββββββββ¬ββββ β β β
β β β β β
βΌ (Direct) βΌ (Pulse) βΌ (5V Power) βΌ (GND) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββ
β π RASPBERRY PI 3B+/4B/5 OR ποΈ ESP32 DEVKIT CONTROLLER β
β β
β β’ Power IN: 5V (Direct from Buck Converter OUT+) + GND (Pin 6 Common Ground) β
β β’ GPIO 2 (Physical Pin 3) OR ESP32 GPIO 4 βββ VIA 10kΞ© RESISTOR (Coin Pulse) β
β β’ GPIO 3 (Physical Pin 5) OR ESP32 GPIO 5 βββ DIRECT WIRE (Inhibit / Coin Lock) β
β β’ Gigabit eth0 (Static 192.168.1.240) ββββββββββββΊ Ruijie Router LAN 1 Port β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββAll negative (COM/GND) wires from the 12V PSU, buck converter output, and coin acceptor MUST connect to the same common Ground bus block.
Always place a 10kΞ© resistor inline between the coinslot White pulse wire and the Pi (Pin 3 / GPIO 2) or ESP32 (GPIO 4). It limits current to <0.3mA and prevents damage to 3.3V logic gates without needing a bulky optocoupler module.
π¨ Allan & Weiyu 4-Wire Pinout
Coinslot Harness| WIRE | SIGNAL | DESTINATION |
|---|---|---|
| π΄ Red | +12V Power | +12V Quick Terminal Block |
| β« Black | Ground (GND) | COM / GND Quick Terminal Block |
| βͺ White | Coin Pulse Signal | 10kΞ© Resistor inline β GPIO 2 (Pin 3) / ESP32 GPIO 4 |
| π Gray | Drop Inhibit Gate | Relay NC / Inhibit Lock Output |
- Speed Switch: Set to MED (40ms) for reliable pulse counting.
- Mode Switch: Set to NO (Normally Open).
- Inhibit Line: Active LOW permits insertion; HIGH rejects coin.
π Pinout Mapping Table
Pi & ESP32| FUNCTION | RASPBERRY PI PIN | ESP32 PIN | SIGNAL NOTES |
|---|---|---|---|
| 5V Power IN | Physical Pin 2 (5V) | VIN Pin (5V) | Fed from Buck Converter (5.1V tuned) |
| Ground (GND) | Physical Pin 6 (GND) | GND Pin | Common return to PSU Ground bus |
| COIN PULSE (ISR) | Physical Pin 3 (GPIO 2) | GPIO 4 (D4) | Microsecond pulse detection interrupt |
| INHIBIT GATE | Physical Pin 5 (GPIO 3) | GPIO 5 (D5) | Software lock prevents coin drops when idle |
| Ethernet WAN/LAN | eth0 (192.168.1.240) | Wi-Fi (Staff AP) | Direct link to OpenWrt router LAN port |
You can change the assigned pins at any time without recompiling by setting COIN_GPIO_PIN=2 and INHIBIT_GPIO_PIN=3 inside /opt/open-piso-wifi/daemon/.env or directly inside the Admin portal at :3000/admin.
π» Step-by-Step Software Installation
Step-by-step terminal instructions tailored for Build 1.
Step-by-Step Guide for Build 1 (Pi + OpenWrt Router)
Commercial deployment: OpenWrt handles high concurrency, Pi serves Next.js portal.
Prepare Raspberry Pi OS & Install OpenPisoWiFi
Flash Raspberry Pi OS Lite (64-bit) or Ubuntu Server onto your micro-SD card or NVMe SSD. Boot the Pi, connect via SSH, and run the automated setup installer:
curl -fsSL https://raw.githubusercontent.com/haliknihudas666/open-piso-wifi/main/scripts/install.sh | sudo bashFlash & Provision OpenWrt Router (Tested on Ruijie EW1200G Pro)
Connect an Ethernet cable from Raspberry Pi eth0 to LAN 1 port on your OpenWrt router (e.g. Ruijie EW1200G Pro). Then execute our automated router deployer:
bash scripts/deploy-router.sh --router-ip 192.168.1.1 --portal-ip 192.168.1.240/etc/nftables.d/piso_portal.nft10.0.0.1 & dnsmasq domain wifi.localWire 12V Coinslot to Pi GPIO
Wire 12V and GND from your centralized power supply into the Allan or Weiyu coinslot. Connect the white pulse line through a 10kΞ© resistor into Pi Physical Pin 3 (GPIO 2), and inhibit to Physical Pin 5 (GPIO 3).
Verify Live Pulses & Access Admin Console
Open your web browser and navigate to http://192.168.1.240:3000/admin. Default PIN is 1234. Drop a β±1 or β±5 coin into the slot and observe the real-time pulse monitor increment. Connect your phone to the router Wi-Fi and verify the captive portal displays instantly.
βοΈ Telegram, Supabase, Vercel & Cloudflare Setup
100% free remote monitoring stack. Configure Telegram bot alerts directly in the Admin GUI by simply pasting your key β zero terminal commands or .env file edits required.
Telegram Bot Remote Push Alerts
Instant Phone Push β’ Zero .env EditingReceive an instant push notification on your phone the millisecond a coin is dropped or the cash box is emptied. Operates via outbound HTTPS long-polling, meaning it works 100% seamlessly behind CGNAT, mobile hotspots, and double-NAT without opening firewall ports.
- Open Telegram and message @BotFather.
- Send
/newbot, name your bot, and copy the HTTP API Token. - Message @userinfobot and send
/startto copy your numeric Chat ID. - Open
http://10.0.0.1:3000/adminβ Cloud & Satellites. - Paste the Bot Token and Admin Chat ID into the fields, click Save & Connect, then click Send Test Alert!
/sales - Live revenue today/slots - Hardware health/emptybox - Reset audit counter/wan - Router latency & pingSupabase PostgreSQL Fleet Sync
Cloud Database β’ Multi-Branch TelemetryCentralize coin revenue, transaction records, voucher logs, and kiosk heartbeats from all your machines across multiple barangays into a single high-performance PostgreSQL cloud database.
- Create a free account at supabase.com.
- Create a new project (e.g.
openpiso-fleet, Region: Singapore). - In SQL Editor, paste and run the contents of
supabase/schema.sql. - Copy your Project URL and API Key from Settings β API.
- Paste them into your kiosk
/admin/cloudconsole. Telemetry queues in memory and flushes every 60s!
If the kiosk ISP drops offline, transactions queue in memory safely. The moment connection restores, all buffered coin records automatically flush to Supabase with zero data loss.
piso_machines, piso_transactionsRow Level SecurityVercel Cloud Fleet Dashboard
24/7 Web App β’ Global AccessDeploy the OpenPisoWiFi admin portal to Vercel for a public cloud dashboard (https://your-piso.vercel.app) to check daily earnings, transaction logs, and kiosk uptime from any smartphone or laptop worldwide.
- Push your repository fork to GitHub.
- In vercel.com, click Add New Project and import your repo.
- Set Root Directory to
portal. Vercel automatically detects Next.js. - Add environment variables:
NEXT_PUBLIC_SUPABASE_URLandNEXT_PUBLIC_SUPABASE_ANON_KEY. - Click Deploy. Open
/admin/cloudon your live Vercel URL to monitor all machines!
portal/vercel.jsonZero Config Next.jsCloudflare Zero-Trust Tunnel
CGNAT Bypass β’ Zero Port ForwardingWant direct remote web access to your physical Raspberry Pi's local admin dashboard (http://10.0.0.1:3000/admin) from anywhere on earth without opening ports or risking hacker scans? Use a free Cloudflare Tunnel.
- In dash.cloudflare.com, open Zero Trust β Networks β Tunnels.
- Click Add a Tunnel (select
cloudflared) and name itpisowifi-gateway. - Run the single provided curl command on your Raspberry Pi terminal to install the lightweight daemon.
- Route public hostname (e.g.
kiosk1.yourdomain.com) tohttp://localhost:3000. That's it!
docs/CLOUD_AND_INTEGRATIONS_GUIDE.mdDDoS ProtectedβοΈ Calibration, Testing & Common Troubleshooting
Solutions to common hardware gotchas encountered by DIY operators.
1. Coin Falls Through or Gets Rejected
- Inhibit Gate Locked: Ensure the gray inhibit line is not held HIGH. If disconnected on some models, it defaults to locked. In the admin console, verify the inhibit line is UNLOCKED during coin drop windows.
- Voltage Drop: Measure 12V PSU output with a multimeter under load. If it sags below 11.2V, the optical coin sensors cannot calibrate.
- Dirty Sensor: Blow compressed air through the coin chute to clear dust.
2. Phantom Pulses or Double Counting
- Pulse Speed Too Fast: Switch the coinslot DIP toggle from FAST (20ms) to MEDIUM (40ms). 20ms pulses often produce switch-bounce jitter.
- Missing 10kΞ© Resistor: Direct unbuffered wiring picks up inductive RF noise and overcurrent. Always install a 10kΞ© resistor inline on the white signal line.
- Floating Ground: Ensure 12V COM and 5V GND are tied together at the common bus block.
3. Captive Portal Doesn't Pop Up Automatically
- DNS Masquerade: Verify
wifi.localresolves to10.0.0.1on the client phone. - Firewall Table: SSH into OpenWrt or Pi and run
sudo nft list table inet piso_portalto confirm port 80 redirect rules are loaded. - Manual Access: Open browser and navigate directly to
http://10.0.0.1:3000orhttp://wifi.local.
4. Router Reboots When Coins Are Inserted
- Power Supply Under-capacity: When the coin solenoid fires, it draws a 350mA spike. A weak 12V 1A adapter will brown out and reset the router.
- Solution: Always use the recommended 12V 5A or 10A Centralized Metal PSU.