Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Added the example integration documentation> #8

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion docs/openpaygo-token/setting_up_openpaygo.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
7. Press `*` to start entering the token and enter the code `650975787`, this should disable PAYG on the device (it should now be active forever) and the Green LED 🟢 should blink 5 times to show it is valid.
8. Press `*` to start entering the token and enter the code `592185789`, this should enable PAYG again on the device and set it to 0 days (not active). and the Green LED 🟢 should blink 2 times to show it is valid.

## Example implementation provided
## Example implementation provided 1

An example implementation both on the server side and on the device side is provided with this documentation. It should allow you to just copy and paste most of the code into the firmware of your device and only adapt parts of the codes (which are purposely placeholders using Unix libraries to allow simulation on a computer) to match the actual hardware of your device (mainly the code to read the keypad presses, blink the LEDs and to access the RTCand memory). For more details, see below after the description of the solution.

Expand Down Expand Up @@ -103,3 +103,45 @@
1. XOR the two parts together
1. Remove the top 2 Most Significant Bits from the result of the XORing above (leaving the 30 LSBits)
1. If the resulting value is over 999999999, subtract 73741825 to the value, this leaves 29.5 effective bits of entropy

## Example implementation provided 2

### General steps to make any appliance PAYG

- Open the device to access the PCB (circuit board)
- Find a place where you can plug the relay, it must fill the following characteristics:
- If the line is cut, the device shouldn’t be usable. A good choice is often an internal wire going from the power connector to the PCB or going from the main PCB to some key element (e.g. motor for a pump, LCD for a TV, speaker for a speaker, etc.)

Check failure on line 113 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Unordered list indentation

docs/openpaygo-token/setting_up_openpaygo.md:113:1 MD007/ul-indent Unordered list indentation [Expected: 2; Actual: 4] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md007.md
- It should be able to power the Arduino (5V – 12V for Arduino pro mini), if necessary, a power converter can be added to convert to the arduino voltage.

Check failure on line 114 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Unordered list indentation

docs/openpaygo-token/setting_up_openpaygo.md:114:1 MD007/ul-indent Unordered list indentation [Expected: 2; Actual: 4] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md007.md

- Use the positive line to:
- Open or close the device with the relay

Check failure on line 117 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Unordered list indentation

docs/openpaygo-token/setting_up_openpaygo.md:117:1 MD007/ul-indent Unordered list indentation [Expected: 2; Actual: 3] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md007.md
- Power the Arduino device (with the GND line as well)

Check failure on line 118 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Unordered list indentation

docs/openpaygo-token/setting_up_openpaygo.md:118:1 MD007/ul-indent Unordered list indentation [Expected: 2; Actual: 3] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md007.md

- Use the negative line to:
- Power the Arduino device (with the positive line as well)

Check failure on line 121 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Unordered list indentation

docs/openpaygo-token/setting_up_openpaygo.md:121:1 MD007/ul-indent Unordered list indentation [Expected: 2; Actual: 3] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md007.md

### Connections

- ### Interface connection:

Check failure on line 125 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Headings should be surrounded by blank lines

docs/openpaygo-token/setting_up_openpaygo.md:125 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "- ### Interface connection:"] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md022.md

Check failure on line 125 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Trailing punctuation in heading

docs/openpaygo-token/setting_up_openpaygo.md:125:27 MD026/no-trailing-punctuation Trailing punctuation in heading [Punctuation: ':'] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md026.md
- Depends on the interface you choose, see the “Documentation of the Arduino Hardware Configurations” for more details about the different options (IR Remote, USB Keypad, etc.).

Check failure on line 126 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Unordered list indentation

docs/openpaygo-token/setting_up_openpaygo.md:126:1 MD007/ul-indent Unordered list indentation [Expected: 2; Actual: 3] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md007.md

- ### Relay connection:

Check failure on line 128 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Headings should be surrounded by blank lines

docs/openpaygo-token/setting_up_openpaygo.md:128 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "- ### Relay connection:"] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md022.md

Check failure on line 128 in docs/openpaygo-token/setting_up_openpaygo.md

View workflow job for this annotation

GitHub Actions / Run markdownlint

Trailing punctuation in heading

docs/openpaygo-token/setting_up_openpaygo.md:128:23 MD026/no-trailing-punctuation Trailing punctuation in heading [Punctuation: ':'] https://github.com/DavidAnson/markdownlint/blob/v0.31.1/doc/md026.md
- IN RELAY -> D10 ARDUINO (ACTIVATION_PIN)
- GND RELAY -> GND ARDUINO
- VCC RELAY -> 5V ARDUINO

- ### PAYG device connection (to power the Arduino):
- VIN DEVICE -> VIN ARDUINO
- GND DEVICE -> GND ARDUINO

### Few tips

- When you choose the relay, make sure:
- It has a 5V nominal voltage so that it fits the Arduino 5V output
- The current it can provide is enough for the appliance you want to make
PAYG

- Most of the time, you have to choose between Normally closed and Normally Opened output for the relay, I recommend to use the Normally Opened output so that if there is an issue with the Arduino management, the user can use the device (otherwise, the user might have paid but still be unable to use the device)

## Concrete Example: TV

Loading