This example is provided to help the development of projects wich require to send data encrypted through a RF module. This data is provided by writing it in the Serial Monitor, allowing implementation of automated scripts for computer consoles.
The libraries required are:
This example requires two Arduinos connected by RF modules or jumpers crossed in a D12<->D11 fashion. Also, it is recommended to join both Arduino's grounds to stabilize 0V levels.
The procedure is as follows:
- Master Arduino
-
- Wait for Serial Input and pluck the CR and LF from the incoming data.
-
- Check if data input size is sendable.
-
- Encrypt data and print decrypt for testing.
-
- Send data.
-
- Slave Arduino
-
- Wait for incoming stream.
-
- Decrypt incoming stream and print original stream for testing.
-
- Parse decrypted variable without using method provided in AES library.
-
- The maximum size of the data string that can be sended in one stream by the RadioHead library configuration is 60 chars, for the actual driver selected. It is said in documentation that it can be tuned for a bigger size, but it is not recommended.
- The AES library uses blocks of 4x4 to encrypt the data. This limits the size of the sending array in multiples of 16. Taking into consideration the information provided above, it is not possible to send more than 48 bytes in one stream with vanilla libraries. They could be tuned to expand this capacity.
- Both devices, master and slave, print debug in Serial Console to allow data check and comparison. Those prints should be deleted for production.