Choose the right microcontroller
I first bought BLEPad board which offers BLE module on the Lilypad style board with ATMega32u4. The BLE module was connected to the MCU via Serial1. It was easy to
make MCU sleeping and waking it up with external interrupt attached to the RX pin of the MCU. So I had to:
- Send 1 byte to the BLE, the BLE sends it via Serial1 to the MCU
- Detach interrupt and wake up the MCU
- Wait 100 ms for clear next communication
- Send my final message to the BLE which sends it to the MCU as well.
Why? Because interrupt attached to the RX pin of the MCU corrupts the Serial1 communication and I was unable to read the first byte correctly. I achieved 3 days of sleep time with this board.
I ordered successor of ESP8266 the ESP32. It features faster processor, more ram, more flash memory, WiFi. So I tried to do the same as with BLEPad and I wasn’t successful. The BLE support for Arduino ID
E was longer unavailable. I couldn’t make it sleeping and waking it up as the BLEPad could. I was surprised that using WiFi libs and BLE libs took over 113% of the flash. I was unable to turn off WiFi and use just BLE with interruption. Maybe I was wrong and it’s possible to do. I am using Arduino IDE because of simplicity and everyone can understand the code etc. The ESP32 with BLE used took more than 80mA of current. LOL.
The third board I’ve ordered was NRF52832.
It declares ultra low power consumption with BLE turned on. I got small chip for $2 from AliExpress. I didn’t know how to programm it and what software I have to use. I was new to the Nordic Semiconductors. I have worked only with Atmel of Espressif before. I needed a tutorial and got into it. However the RedBear Lab Nano V2 is here. The pricey board with exactly this chip. I will see what can $30 wrapped NRF52832 do.
I will compare specs of these board and explain why I choosed the last one.