Code Monkey home page Code Monkey logo

1.21's Introduction

1.21 - Bitcoin Sweet Machine!

A cheap to run/make lightning-network slave module.

Rationale

The bitcoin lightning-network makes possible very small and fast bitcoin transactions. When making real-world small transactions, usability and low power consumption is important. Previous IoT implementations, such as candy machines, rely on the device running a lightning node and usually an energy consuming output like a tablet. The approach of 1.21 is to have a single well balanced lightning node in a secure location (MASTER), communicating with low-powered (SLAVE) public IoT devices.

With usability in mind 1.21 initially utilises OpenNode, a quick to setup LN custodial service.

Sign up here! https://opennode.co/join/f774f2a0-1377-45e2-b719-6b821f24900d

Watch the tutorial below for instructions on how to wire up the sweet machine.

LN Slave Mod

Hardware needed

  • ESP32 (without built in OLED!)
  • MH-ET-LIVE epaper module
  • NPN Transistor
  • Electronic Sweet Machine (Global Gizmos Candy Dispenser)
  • Wires and stuff

Notes

The project is written for the Arduino IDE, appropriate libraries in the includes will have to be downloaded separately.

I used a standard ESP32 board, recognised in the Arduino IDE as a "LOLIN D32", although the code could be fiddled to support most ESP32s (as long as they don't have an OLED screen!).

The trickiest part of the project was getting the ESP32 to build an appropriate byte-array image for the epaper from the QR code data - a more regular byte-array format, such as XBM, would not render correctly. https://javl.github.io/image2cpp/ was extremely helpful.

Epaper to ESP32 SPI connection example: SPI PINS image

1.21 sends an ON to GPIO PIN 17 for 2 secs, which can be adjusted in the code:

  • GPIO PIN 17 is connected to the BASE of an NPN transistor
  • The COLLECTOR of the NPN is connected to the same 3v PIN as the epaper
  • The EMITTER of the NPN is connected to the live wire of the candy machine motor
  • The ground of the motor is connected the GND PIN

Limitations

I'm an imbecile. This project would not have been possible without the kind help from folks at Fulmo's lightning-network hackdays http://fulmo.org/. The project has been developed for demonstration purposes only, although it is surprisingly stable, and with a little work the project could be secure and production ready.

Possible future improvements

  • Optional access point broadcast from ESP32 for changing the wifi, description and sats amount (probably triggered by a physical switch).
  • Deep sleep power-saving mode when the device has been idle for a while.

flowchart image

Tip me

If you like this project and might even use or extend it, why not send some tip love! https://paywall.link/to/f4e4e

1.21's People

Contributors

arcbtc avatar vnnkl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.