The MCU is the microcontroller in your IoT device. The MCU sends attribute states to the ASR module and receives state updates from the Afero Cloud via ASR; that is, this communication is bi-directional. The MCU to ASR communication protocol is implemented on one side by ASR firmware and on the other side by the afLib library. afLib wraps the communication protocol in a simple API for use in your application.
afLib is provided in a form ready to be used with the Arduino development environment. We’ve designed it so you can port it to any hardware and OS platform easily. It’s provided as C++ source code that you integrate into your development workflow. You will just need to write the low-level SPI or UART functions for your hardware and software environment.
In the two sections below, we’ve provided timing diagrams to help you understand the communication protocol using real examples. The state machine in afLib implements this protocol and should also be used as a model when porting the code. Note that the diagrams in the two sections below were captured realtime during ASR operation: