A Coca-Cola machine accepting Bitcoin via the Lightning Network.
Story
The project is for study purposes. The objective is to demonstrate the sales automation process using Bitcoin and the Lightning Network.
Hardware:
- Raspberry Pi 3 Model B;
- Display 7″ Official Touch Screen Para Raspberry Pi;
- Water pump RS 385;
- Bridge H L298N;
Software and Web Solutions:
- Linux Raspbian in Raspberry Pi;
- Apache Server + PHP in Raspberry Pi;
- Wiring Pi (interface GPIO);
- BTCPAY (checkout solution);
- PUSHER (websocket solution);
- Html, Php, Javascript e jQuery.
In Raspberry Pi, I created a local web server (localhost) and in the root I put the files:
- index.html
- qr.png
- payment_received.html
- start_pump.php
- stop_pump.php
- coke.mp4
In BTCPAY I create the invoice (payment button), so it generates a Lightning Network qr code for payment. I also set up a return url (notification.php), which is the destination BTCPAY will inform when a purchase order has any changes, such as payment receipt.
In the notification.php file is just the PUSHER code. It is the PUSHER that warns Raspberry that BTCPAY has received a payment.
Source:Coke Vending Machine with Bitcoin and Lightning Network