Skip to content

Commit

Permalink
Revision of the documentation (#56)
Browse files Browse the repository at this point in the history
Detailed instructions how to assemble the atm and bring it into operation.
  • Loading branch information
AxelHamburch authored Feb 17, 2022
1 parent 161e248 commit 09d64f2
Show file tree
Hide file tree
Showing 38 changed files with 626 additions and 18 deletions.
60 changes: 42 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,56 @@ A physical coin exchanged into bitcoin and send to your lightning wallet in seco

**Please be aware that this is a hobbyist project and it is not secure and reliable enough to withstand attacks. I discourage the use of this setup in a professional environment - but it's rather a good educational tool**

A comprehensive guide on how to setup the LightningATM can be found here https://docs.lightningatm.me. Also join the Telegram group of LightningATM builders here https://t.me/lightningatm_building or contact me on Twitter (https://twitter.com/21isenough).
There are currently two versions of the Lightning ATM. The large full version with a camera for scanning invoices and a button for acknowledgment and other functions. And there is the somewhat slimmed-down version for mobile use, the pocket version.

Please check out this video, to see the [LightningATM in action:](https://twitter.com/21isenough/status/1170808396955738114?s=20)

![alt text](https://github.com/21isenough/LightningATM/blob/master/resources/images/LightningATM_rev3.jpg)
Full Version | Pocket Version
:-------------------------:|:-------------------------:
![](https://github.com/21isenough/LightningATM/blob/master/resources/images/LightningATM_rev3.jpg) | ![](docs/pictures/readme_atm_pv.png)

### Parts list (price estimate: 50-70 USD)

Please find the detailed parts list on the LightningATM documentation website:
### Required components

https://docs.lightningatm.me/requirements/hardware-requirements
- [parts list](/docs/guide/parts_list.md)


### Todo
### Installation guideline

- [voltage converter](/docs/guide/voltage_converter.md)
- [coin validator](/docs/guide/coin_validator.md)
- [wiring](/docs/guide/wiring.md)
- [sd card and wifi](/docs/guide/sdcard_and_wifi.md)
- [display](/docs/guide/display.md)
- [edit config.ini](/docs/guide/edit_config.md)
- [edit app.py](/docs/guide/edit_app.md)
- [tmux monitoring](/docs/guide/tmux_monitoring.md)
- [autostart](/docs/guide/autostart.md)
- [camera](/docs/guide/camera.md)
- [aditional information and tips](/docs/guide/information_and_tips.md)

A comprehensive guide on how to setup the LightningATM can be found here https://docs.lightningatm.me. Also join the Telegram group of LightningATM builders here https://t.me/lightningatm_building or contact 21isenough on Twitter (https://twitter.com/21isenough).

To see the Lightning ATM in action, check out this video [LightningATM in action](https://twitter.com/21isenough/status/1170808396955738114?s=20)

### Mentioned
- https://podcasts.apple.com/us/podcast/interview-with-21isenough/id1481514734?i=1000458712983
- https://blog.sicksubroutine.com/lightning-junkies-episode-021/
- http://bitcoin-turm.de/bturm29/
- https://www.atmmarketplace.com/articles/lightning-atm-lets-you-buy-itty-bitty-amounts-of-bitcoin/
- https://www.bitcoinmedia.id/atm-bitcoin-lightning-ini-adalah-prototype-pertama/
- https://twitter.com/CoinATMRadar/status/1202657309765357568?s=20
- https://www.hackster.io/news/lightningatm-distributes-small-amounts-of-btc-over-the-lightning-network-5e03347acd88
- https://criptonizando.com/2019/10/08/desenvolvedor-cria-caixa-eletronico-de-bitcoin-que-ate-amadores-podem-construir-usando-a-lightning-network/
- https://decrypt.co/10046/ightningatm-how-to-make-your-own-bitcoin-atm?utm_content=buffer7dcee&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer

### Documentations in other languages

- German Video: [Tutorial - Bitcoin Lightning ATM - montieren und konfigurieren](https://www.youtube.com/watch?v=pTyTc2qPQj0)
- German tutorial for the pocket edition: [Tutorial LightningATM - ereignishorizont.xyz](https://ereignishorizont.xyz/lightning-atm/)

### Todo list

#### Prio 1
- [ ] Update doc with new features, screens
- [ ] Implement lndconnect
- [ ] Add "no wallet setup" warning at boot
- [ ] Implement LNURLProxyAPI
Expand All @@ -45,6 +78,7 @@ https://docs.lightningatm.me/requirements/hardware-requirements
- [ ] Add AP option for users to login into their wifis (https://github.com/21isenough/RaspiWiFi)
- [ ] 2 layer for coins to reject before accepted
#### Done
- [X] Update doc with new features, screens
- [X] Check out BTCPay API to integrate backend
- [X] Add coin return stopper to 3d design
- [X] Try different e-ink screen
Expand Down Expand Up @@ -76,14 +110,4 @@ https://docs.lightningatm.me/requirements/hardware-requirements
- [x] Find a faster solution for QR scans (zbarcam)
- [x] Organize todos better

### Mentioned
- https://podcasts.apple.com/us/podcast/interview-with-21isenough/id1481514734?i=1000458712983
- https://blog.sicksubroutine.com/lightning-junkies-episode-021/
- http://bitcoin-turm.de/bturm29/

- https://www.atmmarketplace.com/articles/lightning-atm-lets-you-buy-itty-bitty-amounts-of-bitcoin/
- https://www.bitcoinmedia.id/atm-bitcoin-lightning-ini-adalah-prototype-pertama/
- https://twitter.com/CoinATMRadar/status/1202657309765357568?s=20
- https://www.hackster.io/news/lightningatm-distributes-small-amounts-of-btc-over-the-lightning-network-5e03347acd88
- https://criptonizando.com/2019/10/08/desenvolvedor-cria-caixa-eletronico-de-bitcoin-que-ate-amadores-podem-construir-usando-a-lightning-network/
- https://decrypt.co/10046/ightningatm-how-to-make-your-own-bitcoin-atm?utm_content=buffer7dcee&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
20 changes: 20 additions & 0 deletions docs/guide/autostart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Autostart

###### Activate the Service:

```
$ cd ~/LightningATM
$ sudo cp LightningATM.service /etc/systemd/system/LightningATM.service
$ sudo systemctl enable LightningATM.service
$ sudo reboot
```

###### Other commands to control the service:

```
$ sudo systemctl status LightningATM.service
$ sudo systemctl stop LightningATM.service
$ sudo systemctl start LightningATM.service
```

- Note: From now on the ATM will start automatically. If you want to observe the app.py in tmux, you should stop the "LightningATM.service" manually, bevor you start the app.py in the tmux.
117 changes: 117 additions & 0 deletions docs/guide/camera.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
## Installation and testing the camera

The 5MP Camera OV5647 for the Raspberry Pi is available from different manufacturers and with slightly different designs.
To test the function of the camera you can take a picture and download it to you computer.

### Installation

The ribbon cable is a bit special as the connectors on the camera and the Raspberry Pi are slightly different sizes. So the cable tapers.
Before sliding the cable into the slot, the black latch must be released by gently pulling upwards.
The cable can then simply be pushed in. The silver contacts must point away from the detent. See image!
When the cable is centered, you can lock the latches in place by sliding them back slightly.

connection

<img src="../pictures/camera_installation.jpg" width="300">

### Activate camera

- Login to the Raspberry Pi

$ ssh [email protected]
- Directory displayed: `pi@raspberrypi:~ $`

- Call up the Raspi-Config and activate the camera

$ sudo raspi-config

- Choose: `Interfacing Options Configure connections to peripherals`
- Choose: `Camera Enable/Disable connection to the Raspberry Pi Camera`
- Confirm: `Would you like the camera interface to be enabled?` -> `\<YES>`
- Confirm: `The camera interface is enabled` -> `\<OK>`
- Go To: `\<Finish>`
- When ask for: `Would you like to reboot now?` -> `\<YES>`
- If you have not already restarted from the menu, then restart manually to activate the changes

$ sudo reboot
raspi-config

![](../pictures/camera_raspi-config_1.png)
![](../pictures/camera_raspi-config_2.png)

Your config menu can look slightly different, depends of you hard- and software

### Take a picture

- Take a picture after logging in to the Raspberry Pi

$ raspistill -v -o test.jpg

Note: The -v is only optional and will show more display data. The -o is necessary to write the file.

The recording lasts 5 seconds (time delay 5000 (ms)). You can shorten the recording time, but you should not make the time too short, otherwise the picture quality will suffer. One second (= 1000 ms) is definitely possible. The command then looks like:

$ raspistill -v -o test.jpg -t 1000

Further functions for a recording can be found in the help `$ raspistill --help`

- Check if the image has been saved

$ ls -l
The file `test.jpg` should now appear in the list.

- Check the directory structure

$ pwd

The directory should read: `/home/pi/`

raspistill command

<img src="../pictures/camera_terminal_raspistill.png" width="500">

### Transfer the image to the computer

- Open a *second terminal window* on the computer
- Switch to a folder of your choice (example `C:\temp`)
- The command to copy for a Windows system is

$ scp [email protected]:/home/pi/test.jpg .
-> The password from the Raspberry Pi must be entered for comfirmation

- If everything went well, the image was transferred to the computer and can now be vieweden

- Note: The command is slightly different on a Mac or Linux system

$ scp '[email protected]:/home/pi/test.jpg' ./
scp command

<img src="../pictures/camera_terminal_scp.png" width="700">

Example of a recording

The structure | The picture
:-------------------------:|:-------------------------:
![](../pictures/camera_example_structure.jpg) | ![](../pictures/camera_example_image.jpg)

Note: This camera was pretty cheap and has a variable lens that was pretty loose and difficult to adjust. You might want to use a better one for your project.

### Aditional hints

- If you want to take several pictures, the pictures must be numbered consecutively. E.g. test1.jpg, test2.jpg etc.
- Then you can transfer all images at once

$ scp [email protected]:/home/pi/*.jpg . or scp '[email protected]:/home/pi/*.jpg' ./
- You can do also videos. The command is `raspivid`






41 changes: 41 additions & 0 deletions docs/guide/coin_validator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
### Configure the coin validator (set 6 coins / e.g. 5 cents to 2 euros)

- Set the switches on the coin validator to "NO" (contact normal open) and "Medium" (medium pulse speed).
- Apply the 12V to the coin validator (without Raspberry Pi) => The coin validator will flash and show 0 (zero)
- Press and hold simultaneously the ADD and MINUS buttons until A appears in the display
- When B appears, switch back to A by ADD or MINUS
- Press SET (slowly), then E will appear on the display
- This indicates: You are in them menu to set the amount of differnet coin types
- Set it to 6 (6 coins = 5 cents to 2 euros) with ADD (or MINUS) and press SET
- Now the display shows H1 (for the first coin). The first of 6 LEDs has come on
- Now specify how often the coin should be inserted for calibration
- Set to 20 with ADD (or MINUS) and then press SET
- The display now shows P1 for further settings of coin 1 and you can define the output signal
- 5 cents = 2 pulses / 10 cents = 3 / 20 cents = 4 / 50 cents = 5 / 10 euros = 6 / 2 euros = 7
- Set to 2 pulses (for 5 cents) with ADD (or MINUS) and then press SET
- The last thing on the display is F1, which represents the accuracy of the coin recognition. The value 8 worked well
- Set to 8 with ADD (or MINUS) and then press SET
- The parameters for the first coin have now been set
- Now the second LED is on and the display shows H2
- Now repeat the same steps again for the second coin (e.g. 10 Cent) up to coin 6 vor (e.g. 2 Euro)
- When all coins are set, all LEDs flash briefly to confirm and the display shows A again
- After a short time, 0 (zero) appears again in the display

### Calibrating the coin validator

- Press the SET button (slowly) twice
- The first LED light and A1 will show in the display
- Now insert the first coin (5 cents) 20 times
- Use as many different coins as posible
- Finally all LEDs flash to confirm and the display shows A2
- Repeat for the remaining coin types
- All LEDs flash briefly again to confirm and the display shows 0 (zero) again
- The coin validator is now ready

coin validator

<img src="../pictures/coin_validator_closeup.jpg" width="600">

coin calibration
![coin calibration](../pictures/coin_validator_calibration.jpg)

26 changes: 26 additions & 0 deletions docs/guide/display.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Set up and test the display

### Update display software

```
$ cd ~
$ git clone https://github.com/waveshare/e-Paper
$ cd ~/e-Paper/RaspberryPi*/python
$ sudo python3 setup.py install
```

### Testing the display

'Note:' This is special for the "Waveshare 2in13 V2". Yours may be different.

```
$ cd ~
$ cd e-Paper/RaspberryPi_JetsonNano/python/examples
$ sudo python3 ./epd_2in13_V2_test.py
```

If everything has been correctly connected and installed, the display will now show a demonstration and finally the screen will cleare.

display
![display](../pictures/display_2.13inch.jpg)

63 changes: 63 additions & 0 deletions docs/guide/edit_app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
### Special settings in the app.py file

The `app.py` file is the main program of the ATM. Here you can easily customize the code. But be careful when making changes here.

##### Open the app.py

```
$ cd ~/LightningATM/
$ nano app.py
```

##### Optional setting *only for the pocket version:* Skip the "Prepare for LNURL" page:

- Search for `display.update_lnurl_cancel_notice()` with `CTRL+W`. (It exists twice)
- There is a place where it says `if activewallet == "lntxbot"`, please edit the two lines (see picture)

###### Comment out the following two lines with `#`

```
# display.update_lnurl_cancel_notice()
# time.sleep(5)
```

-> This will skip the LNURL "query page" as it is not relevant for the pocket version (without push button).

##### Alternative setting: coin preselection if the setting in config.ini does not work:

###### Adjustment of the pulses for the respective coins

- Search for `if config.PULSES == 2` in app.py with `CTRL+W`
- There you will find the setting options for the coins.
- Note: If you can't find `if config.PULSES == 2` in the app.py file, then you might have a higher version then V0.3.0 and the coin settings are in the config.ini. You can skip this point.

###### For example:

```
if config.PULSES == 2:
config.FIAT += 0.02
..
logger.info("2 cents added")
..
```

The settings are now set in the same way as the coin validator is parameterized:

###### For the example, two pulses = 5 cents

```
if config.PULSES == 2:
config.FIAT += 0.05
..
logger.info("5 cents added")
..
```

- Repead the change up to 2 euros = 2.00 (200 cents)
- Note: As I said, you only have to do this if the setting in config.ini doesn't work

app.py - Skip the "Prepare for LNURL" (just an example)
![edit app](../pictures/edit_app_terminal_1.png)



Loading

0 comments on commit 09d64f2

Please sign in to comment.