Trained as an interior designer and architect, I wanted to link my space projects to my passion for technology and Bitcoin. By hacking objects and connecting them to second layer solutions, I discovered a simple and fun way to popularize Bitcoin through interactive experiences. Today, I'm sharing this approach to help everyone understand, experiment and build their own interactive projects.
Introduction
- Level: Intermediate
- Estimated time: 2-3 hours
- Use cases: Bitcoin events, artistic performances, Lightning demos, automated stage effects
Prerequisites
Knowledge
- Basic electronics (wiring, relays)
- Welding (or use of Dupont connectors)
- Network configuration (WiFi, WebSocket)
Accounts required
- BTCPay Server: Functional instance (self-hosted or hosted)
- Blink Wallet : Account + access API
Access
- Admin access to BTCPay Server
- WiFi connection for ESP32
Materials required
Hardware - Electronic components
- 1 Microcontroller - ESP32-WROOM-32
- 1 Relay module - 5V with optocoupler
- ~10 Dupont cables - Male/Male and Male/Female
- 1 Power supply for ESP32 - 5V USB or Li-Po battery
- 1 micro-USB cable - connection between ESP32 and power supply
- 1 220V fog machine with 12V battery remote control
- 1 bottle of liquid compatible with your smoke machine
Hardware - Tools
- Soldering iron + tin (if soldering)
- Screwdriver
- Multimeter (recommended)
Software
- Firmware BitcoinSwitch : https://bitcoinswitch.lnbits.com/
- WebSerial-compatible web browser (Chrome/Edge/Brave)
- BTCPay Server configured. For more information on creating a BTCPay Server instance, visit this tutorial: https://planb.academy/fr/tutorials/business/point-of-sale/btcpay-server-928eb01e-824b-4b57-a3e8-8727633beddc
System architecture
-
ALWAYS disconnect the smoke machine from the mains before opening the remote control or tampering with the wiring
-
Remove the battery from the remote control before handling (risk of short-circuit and damage to components)
-
Check that all your connections are isolated before reconnecting anything
-
Never reconnect the 220V until the remote control box has been closed and secured
PART 1: Hardware assembly
Step 1: Preparing the remote control
-
Open remote control
- Identify ON/OFF button
- Unscrew the case to open the remote control
-
Locate connections
- Locate the + and - terminals of the
- Test continuity with a multimeter (optional)
-
Button wiring (solder or connectors)
- Solder a black cable to the - terminal of the button
- Solder a red cable to the common + terminal
Step 2: Connecting to the relay module
| Terminal | Description | Function |
| NO (Normally Open) | Circuit open by default | Closes when the relay is activated |
| NC (Normally Closed) | Circuit closed by default | Opens when the relay is activated |
| COM (Common) | Central terminal | Switches between NO and NC |
- Black wire from ON/OFF button → NO (Normally Open)
- Red wire (common) → COM (Common)
Step 3: Connecting the ESP32 to the relay module
| ESP32 | → | Relay Module |
| V5 (5V) | → | VCC |
| GND | → | GND |
| GPIO 21 | → | IN (Input) |
- VCC and GND well connected (polarity)
- GPIO 21 used for control signal
- No visible short circuit
- Correctly wired remote control
- Relay module connected to ESP32
- No bare wires touching other components
- 220V always disconnected
PART 2: Software configuration
Step 1: Plugins, Installation BitcoinSwitch + *Blink
Step 2: Backend : BTCPay Server + Blink configuration
- Visit https://www.blink.sv
- Create your account. Please refer to the tutorial :
- Access the API interface: https://www.blink.sv/en/api and log in with the same account you used to create your wallet Blink
- Once connected, go to the API Keys tab
- Click on " + " in the top right-hand corner to access your API Key configuration
- Give your API Key a name and leave the default settings. Then, in the third step, make a note of your API Key - you'll only see it once:
blink_mZ5KxxxxxxxxxxxxxNbmX
- Once created, it should appear in your active API Key list.
- Open your BTCPay Server
- Navigate to : Wallet → Lightning
- Click on Use a custom node
- Paste the following connection string:
type=blink;server=https://api.blink.sv/graphql;api-key=blink_mZ5KxxxxxxxxNbmX;wallet-id=0a3fc465-082xxxxxxxxxx-2545595d856f
- Do not modify the first part:
type=blink;server=https://api.blink.sv/graphql; - Replace only :
- api-key= by your API Blink key
- wallet-id= by your wallet Blink ID
- Then click on Test connection, then Save
- Check that the connection is established (green status)
- In BTCPay Server, go to the Plugins tab and click on Point of sale
- Give your PoS a name and click on Create
- PoS configuration :
- Choose a point of sale style = Print display
- Currency = SATS
- Click on SAVE
- Product configuration :
- Delete all default products
- Then click on add item
- Configure the product:
- Title : smoke-machine
- Price : 10 sats
- Bitcoin GPIO switch : 21
- Bitcoin switch duration (in milliseconds) : 5000
- Click on Close and then Save to save the new product
Step 3: Firmware: Flashing the ESP32
- Connect the ESP32 to your computer with your USB/Micro-USB cable
- Then click on Connect to Device
- A window opens, select the USB port on your ESP32, then click on Connect
- Once your ESP32 is connected, we'll flash the BitcoinSwitch firmware. In the T-Display section, click on Upload Firmware for the latest version available (currently: bitcoinSwitch T-Display v1.0.1)
- Wait for the upload, the process is complete when the logs show "Leaving... "
- Unplug the ESP32
- Reload page: https://bitcoinswitch.lnbits.com/
- Reconnect the ESP32 to your computer with your USB/Micro-USB cable
- Then click on *Connect to device
- Select the USB port on your ESP32, then click on Connect as described above
- Once connected, press the RESET button on the ESP32
- Check in the logs that the last lines show :
Welcome to BitcoinSwitch! (v1.0.1) Config file does not exist. Entering config mode. until we receive /config-done.
https://XXXXv/apps/46XXXXXXXXXXXXXXXXXXXXwFB/pos
- Open yourBTCPay Server instance, then go to the PoS we created later.
- Then click on "View" to open your PoS in the browser
- Copy the URL of the page, for example :
https://XXXXv/apps/46XXXXXXXXXXXXXXXXXXXXwFB/pos
XXXXv→ the domain of your BTCPay Server instance46XXXXXXXXXXXXXXXXXXXXwFB→ your PoS unique identifier/pos→ indicates a Point of Sale
- Replace
https://withwss:// - Add
/bitcoinswitchat the end
wss://XXXXv/apps/46XXXXXXXXXXXXXXXXXXXXwFB/pos/bitcoinswitch
wss://) establishes a permanent connection between the two: as soon as a Lightning payment is confirmed on your PoS, BTCPay instantly sends the information to the ESP32, which can then trigger your smoke machine.- Return to the page: https://bitcoinswitch.lnbits.com/ with your ESP32 connected
- Go to Configure Device → Wifi Settings
- WiFi SSID: the name of your WiFi network
- WiFi Password: your WiFi password
- In the LNbits Device URL section, paste the WebSocket URL created in the previous step
- Click on Upload config
- Wait for the upload to complete; the logs should display the parameters you've just entered (SSID, password and WebSocket URL)
- Wait while ESP32 establishes the WebSocket connection. You should see :
WiFi connection established! [WebSocket] Connected to url: ...
- You can now disconnect the ESP32
Checkpoint Software
- Blink connected to BTCPay
- PoS created with at least 1 item
- ESP32 flashed with BitcoinSwitch
- WiFi configured on ESP32
- WebSocket URL correct
- Error-free ESP32 logs
Testing and debugging
Complete final test
-
Plug in the smoke machine (220V) and switch it on
-
Power the ESP32 (battery or USB)
-
Open your BTCPay PoS in your browser
-
Scan "smoke-machine" item
-
Pay with a wallet Lightning (Blink or other wallet)
-
Observe:
- Relay clicks (audible sound and relay LED lights up)
- The smoke machine is activated
- Smoke generated!
Fairness problems and solutions
| Problem | Probable Cause | Solution |
| ESP32 does not connect | Missing USB driver | Install CH340 drivers |
| Relay does not click | Wrong GPIO wiring | Check GPIO 21 → IN |
| Smoke machine does not respond | Remote control improperly wired | Check NO/NC/COM |
| WebSocket timeout | Incorrect URL | Check wss:// and /bitcoinswitch |
| WiFi does not connect | SSID/Password incorrect | Re-flash WiFi config |
| Payment received but nothing happens | ESP32 not connected to WebSocket | Check RESET logs |
Resources
Useful links
- BitcoinSwitch Firmware: https://bitcoinswitch.lnbits.com/
- BTCPay Server Docs : https://docs.btcpayserver.org/
- Blink API : https://dev.blink.sv/
- ESP32 Pinout : https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
Community & Support
- BTCPay Server** : chat.btcpayserver.org - Official Mattermost
- BTCPay Server Telegram** : t.me/btcpayserver
- LNbits** : t.me/lnbits - Official Telegram, active community
- BitcoinSwitch (firmware bugs)**: github.com/lnbits/bitcoinswitch/issues
Source code
- BitcoinSwitch firmware source code: https://github.com/lnbits/bitcoinswitch
Author
This tutorial has been written by Ezmo
You can say thanks by tipping the professor.
Credits
This tutorial has not been proofread yet
The original content has been translated by AI, but human review is necessary to ensure its accuracy.
2 830 sats1 415 sats708 satsEvery content on the platform is the result of a collaborative effort: each lesson, translation, and revision is made possible by the work of contributors. For this reason, we are always looking for proofreaders who can review our content in many languages. If you want to participate in the proofreading process, please reach out in our Telegram group and read our tutorial. We remind you that this content is open-source - licensed under CC BY-SA - so it can be freely shared and used, as long as the original source is credited.

