QR codes have a theoretical limit to how much data they can store (listed below) and in reality, its mostly reported as 300 characters.
|Numeric only Max. (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)||7,089 characters|
|Alphanumeric Max. (0–9, A–Z [upper-case only], space, $, %, *, +, -, ., /, 🙂||4,296 characters|
|Binary/byte Max.||2,953 characters (8-bit bytes) (23624 bits)|
|Kanji/Kana Max.||1,817 characters|
So what happens if we need to send more than 300 characters?
This project provides a concept to break a large message up into multiple payloads, encode each payload into individual QR codes and show then QR codes sequentially for the client to receive and reconstruct the message.
We can specify a maximum payload size, break each message up into payloads and encode them into individual QR codes and show them sequentially in a loop to the receiving device. Maximum payload size and interval time
Each payload has a defined format. I’ve developed a JSON format for each of use and reduced each key to one character for optimisation.
“p”: “payload contents”,
m is the index of the message (starting from 0), knowing this means the client will know the position of this payload for reconstruction.
p is the actual payload contents, note that we are not defining the length of the payload or any checksum as QR codes have their own error correction in them.
c is the total number of payloads to expect. With this, the client will know when how many payloads to expect and it doesn’t need to start scanning from the first payload assuming the sequence is played in a loop.
I’ve found a good size for the payload length is 220 characters and 500 ms interval between each QR code gives the best results.
Processing time is of encoding and decoding the QR codes is hardware specific, the faster the hardware the faster you can show each payload leading to faster transmission times.
The camera will also have a part to play and that holding the camera further away will help as the camera doesn’t need to continuously focus and having a bright screen will also help.
The source code can be found for this app