Skip to content

Offline, esp32 based Bitcoin ATM (coins only) with lightning network support

License

Notifications You must be signed in to change notification settings

f321x/offline-LightningATM-esp32

Repository files navigation

offline-LightningATM-esp32

Bitcoin ATM (coins only) with lightning network support, running offline on an esp32. The lightning network is a 2nd layer protocol on top of the bitcoin protocol enabling trustless transactions with instant settlement and cheap fees.

Special thanks to

@21isenough and contributors for the 3d models and inspiration
RPi based Lightning ATM repo

LNBits, Ben Arc and Stepan Snigirev for the cryptograpy used to make this ATM working without internet connection
Fossa ATM repository | LNBits Homepage | uBitcoin library

Axel Hamburch for the very detailed guide in german language on assembly of the electronics
Ereignishorizont Blog

Used parts

All the parts are available on eBay and Aliexpress

  • ESP32 NodeMCU Dev Board | Any "normal" esp32 dev board should do the job here | Example
  • DC-DC Adjustable Step-up Boost Power Supply LM2587S 5V -> 12V | for the coin acceptor, runs on 12V Example
  • Waveshare 1.54 inch e-Paper Display Modul with SPI Interface | Example
  • Programmable Coin Acceptor (HX-616) - 6 Coin | Example
  • 10mm Metal Push Button Switch 3-6V with Yellow LED, Self-reset Momentary | Example
  • USB Type C socket | to plug in the power supply (i used a Raspberry Pi type C power supply) Example
  • Little Mosfet modules ("15A 400W MOS FET Trigger") | To block the coin acceptor at certain points Example
  • Orange PLA Filament for the 3D Printer | Example
  • Jumper Wires | Example
  • Heat-Set Threaded Inserts M3 | Example

All in all would calculate around $100 for the neccessary parts

Assembly Instructions for Lightning ATM

1. Connecting the Waveshare 1.54 inch Display to the ESP32

Begin by connecting the Waveshare display to the ESP32 using the following pin assignments:

Display Pins ESP32 GPIO
Busy 27
RST 33
DC 25
CS 26
CLK SCK = 18
DIN MOSI = 23
GND GND
3.3V 3.3V

2. Programming the Coin Acceptor

Ensure to adjust the voltage of the step-up converter before connecting the coin acceptor. Detailed programming instructions are available in the following guides:

3. Connecting the Coin Acceptor to the ESP32

  • For the Coin <-> Pin 17 connection, use a cable as short as possible.
  • Short circuit the two pins below the switch on the coin acceptor with the MOSFET on GND IN and GND OUT.
  • Connect the MOSFET GND pin to the ESP32 GND and the PWM pin to the pin specified in include/lightning_atm.h.
Periphery Pin ESP32 GPIO
Coin Acceptor 'Coin Pin' 17
Mosfet PWM Pin 16
Mosfet GND Pin GND

4. Connecting the LED Button

Connect the LED Button to the ESP32 according to the pin assignments specified in include/lightning_atm.h:

Periphery Pin ESP32 GPIO
Button LED Pin (+) 21
Button LED Pin (-) GND
Button PIN 1 32
Button PIN 2 GND

For wiring inspiration and guidance, refer to Lightning ATM Documentation.

5. Circuit Diagram

Below are two possible wiring options. Depending on which ESP32 type and display / driver board you are using.

  1. Standard ESP32 with separate display / driver board

Wiring - Circuit Diagram Normal ESP32

  1. Waveshare ESP32 with integrated driver board and separate display

Wiring - Circuit Diagram Waveshare ESP32

Setup software

  1. Install VSCode and the PlattformIO IDE Extension.

  2. Clone this repository and open it as PlattformIO Project.

  3. Create an LNbits wallet. Add the LNURLDevice extension and create a new LNURLDevice instance with ATM.

    wallet_settings_02_thumb

  4. Copy the LNURLDevice Settings String and paste it into the code under “include/lighting_atm.h” under “USER ACTION”.

    wallet_settings_02_thumb

  5. Flash the software on the esp32. You may have to disconnect the ESP32 from the step up converter before connecting it to the computer to prevent faults, or power it up with the power supply and use an usb isolator.

If you need help ask me on Nostr @npub1z9n5ktfjrlpyywds9t7ljekr9cm9jjnzs27h702te5fy8p2c4dgs5zvycf

If this software and guide provided value to you feel free to send some sats to [email protected]

Images

Standard ESP32 PXL_20231126_144603980 PXL_20231126_162906807 MP_1

Waveshare ESP32 Construction - Waveshare ESP32 Construction - Waveshare ESP32 Construction - Waveshare ESP32 Construction - Waveshare ESP32 Construction - Waveshare ESP32