YOUR FIRST LIGHTNING-POWERED DEVICE STARTS HERE!

Choose your language

*Use the same browser to keep your progress

Welcome back !

Step 0 of 16 completed

Tutorial map

Step 1 of 16
Step 04 of 16

⚠️ SAFETY WARNING ⚠️

READ BEFORE CONTINUING

Improper operation can result in fatal electrocution or fire.

This project involves a fog machine connected to a 220V mains supply.

Non-negotiable rules:

LEVEL 01

Help center

Need help?

Want to ask a question or give feedback?

FAQ

How much does it cost to build?
Around 80 to 90 euros for all components, depending on where you buy them and whether you already own some parts. The smoke machine itself is the most expensive item. Check the shopping list in Step 3 for exact prices and links.
Do I need any coding experience?
No. You will not write any code. The firmware is already built (BitcoinSwitch). You just need to flash it onto the ESP32 and configure a few settings through a web interface. Everything is explained step by step.
Where can I buy the components?
We provide Amazon FR links in the shopping list (Step 3). If you are outside France, search the component name on your local Amazon or any electronics store such as AliExpress, Banggood, or Mouser Electronics. All components are common and easy to find worldwide.
Can I use a different ESP32 board?
Yes, any ESP32-WROOM-32 development board with a USB port will work. The pin layout may differ slightly. Make sure it has GPIO pins 21 and 22 available. Avoid ESP32-S2 or ESP32-C3 variants as they are not compatible with BitcoinSwitch. If you use one of these, you will need to write your own C++ code.
My power bank keeps turning off, what do I do?
Most power banks auto-shutoff when the connected device draws very low current. The ESP32 sometimes falls below that threshold. Try keeping a second device (like a phone) plugged into the power bank at the same time. Or use a different power bank. For short demos this is rarely a problem.
Can I use a 110V smoke machine instead of 220V?
Yes. The relay module works the same way regardless of voltage. The wiring is identical. Just make sure your smoke machine matches your country's outlet voltage. Never mix 110V and 220V.
Do I need my own BTCPay Server?
Yes. You need a working BTCPay Server instance, either self-hosted or hosted by a provider. If you don't have one yet, follow this tutorial to set one up: planb.academy/tutorials/business/point-of-sale/btcpay-server.
How is my progress saved?
Your progress is saved locally in your browser using localStorage. Nothing is sent to any server. This means your progress is tied to this specific browser on this specific device.
I lost my progress, can I recover it?
Unfortunately no. Since progress is stored only in your browser, clearing your browser data, switching browsers, or using a different device will reset your progress. This is why we recommend always using the same browser.
Will the tutorial be available in other languages?
Yes. French and English are planned. French will be added soon. If you want to help translate the tutorial into another language, contact us.
My ESP32 won't connect to WiFi
Make sure you are connecting to a 2.4 GHz network. The ESP32 does not support 5 GHz WiFi. Double check your WiFi password and SSID (no extra spaces). Try moving the ESP32 closer to your router. Restart the ESP32 by unplugging and replugging the USB cable.
The smoke machine doesn't trigger after payment
Check these in order: Is the relay wired correctly? Is the ESP32 connected to WiFi (check the serial monitor)? Is the WebSocket URL correct in the BitcoinSwitch config? Did the Lightning payment actually succeed (check your BTCPay dashboard)? Try pressing the relay manually to confirm it clicks.
The QR code doesn't appear on my Point of Sale
Make sure your Point of Sale is correctly configured in BTCPay Server. In your Point of Sale settings, check that "Choose Point of Sale Style" is set to "Print Display" and click Save. Verify that you selected the right wallet (Blink via Lightning). Try refreshing the page. If using a phone, make sure you are connected to the internet.
My relay clicks but the smoke machine doesn't start
The relay is working but the smoke machine is not receiving power. Check that the smoke machine is plugged into the mains. Check that the relay is wired to the correct terminals (COM and NO, not NC). Make sure the smoke machine is warmed up (most fog machines need 3 to 5 minutes to heat up before they can produce smoke).

Word dictionary

BTCPay Server
BTCPay Server is a free, open-source payment processor that lets merchants and users accept Bitcoin and Lightning payments without relying on any third party. It offers features like hardware wallet support, invoicing tools, and full Lightning Network compatibility.
Lightning Network
The Lightning Network is a protocol built on top of Bitcoin that enables fast, low-cost transactions. It works by creating payment channels between users, where transactions happen almost instantly with minimal fees, without recording each one on the blockchain. It improves Bitcoin's scalability and makes small everyday payments possible.
Lightning wallet
A wallet that can send and receive payments on the Lightning Network. Examples: Blink, Phoenix, Wallet of Satoshi.
Blink
Blink is a Lightning wallet with a simple and developer-friendly API. In this project, Blink connects to BTCPay Server to process Lightning payments. Its API makes it easy to integrate Lightning payments into any project with minimal setup. You can create a free account at blink.sv.
BitcoinSwitch
An open-source firmware for ESP32 that listens for Lightning payments and triggers a physical action (like turning on a relay). It connects to BTCPay Server via WebSocket.
ESP32
A low-cost microcontroller with built-in WiFi and Bluetooth. It is the brain of your smoke machine setup. You program it by flashing firmware via USB.
Relay module
An electronic switch controlled by the ESP32. When activated, it closes the circuit of the fog machine's 12V remote, just like pressing the button. When deactivated, it opens the circuit and the machine stops.
WebSocket
A communication protocol that keeps a live, two-way connection between two devices. In this project, the ESP32 uses a WebSocket to listen for payment notifications from BTCPay Server in real time.
Firmware
The software that runs directly on a microcontroller. For this project, you flash the BitcoinSwitch firmware onto the ESP32. No coding needed, just upload the pre-built file.
API key
A unique password that lets one service talk to another securely. You create a Blink API key so BTCPay Server can access your Blink wallet to check for payments.
Point of Sale (PoS)
A payment page generated by BTCPay Server where customers scan a QR code and pay with Lightning. You can display it on a phone or tablet, or print the QR code directly.
Satoshi (sat)
The smallest unit of Bitcoin. 1 Bitcoin = 100,000,000 satoshis. Lightning payments are usually counted in sats.

Links