Arduino Low power (with deep sleep) sample code for Notecard

Hi,

Does anyone managed a low power (with deep sleep) arduino code sample that reads some sensor data and sends data over Notecard?

Regards,

1 Like

I am looking for a sample code for long term battery operated sensor reading communications.

1 Like

Yes, I think that code will be very useful for all of us that want to use a Notecard in remote places and solar-powered. Especially for an ESP32.

Regards,
rob

Hello @iarakis,

Unfortunately, we do not have a low-power example ready to go, but we should. I’m will put together a very simple, low-power example to help people get started, and I will report back to this thread with a link.

You can provide feedback about the example here as well, and together we can make a simple but robust example for others to follow.

I’ll be speaking with you soon!
Zak

2 Likes

That would be great. Looking forward to it. In my case also would like the Arduino low power sample for solar powered ESP32. Regards

1 Like

Me too, looking forward for some examples with ESP32. BTW found a very easy flasher for ESP32 at Releases · esphome/esphome-flasher · GitHub

I’ve hated to leave you guys waiting. I have the sample written, and now I’m currently having it peer-reviewed to ensure it is worth copying. :smiley:

I expect to have a pointer for you guys by the end of the day. :+1:

~Zak

Almost there guys. We hit a point of inflection during peer review, and we are having an internal discussion.

While this conversation is taking place, I’m running the sample I’ve created to better understand the power consumption characteristics.

We should have something for you soon.

~Zak

Sorry for the delayed response, but I have worked through several iterations to be sure to provide the best possible advice.

If you’re looking to build a low-power solution, I would suggest using the Notecarrier-AL, which we’ve purpose-built for this use case, and which runs in our Airnote.

Using the Notecarrier-AL gives you FULL CONTROL of the circuitry running between the Notecard and the host MCU, which allows you to tailor the power solution to your project. Then from your sketch, you will request the Notecard to completely disable the host MCU, thus maximizing the potential of your battery.

In the example linked below, the host firmware requests for the Notecard to disable the host MCU for a specific period of time using the ATTN pin, wakeup and report sensor data, then request to be put back to sleep. In order to simulate being routed to the EN pin on a regulator, this example uses the EN pin on the Feather’s MCU.

Several options exist which allow the Notecard to wake up the host MCU when certain events occur (such as incoming messages from the Notehub). There is a nice guide on the developer site that explores these options.
https://dev.blues.io/reference/notecard-walkthrough/low-power-design/


To answer your question exactly as asked:

Each MCU manufacturer publishes its own way of putting its MCU into “deep sleep” mode, such as this for the ESP32. We recommend that you look to your host MCU’s manufacturer for guidance and examples.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/sleep_modes.html

Here is a great article written on the topic:

1 Like

Hi, could you provide a Arduino sample implementing wake on motion with ATTN pin from notecard?

Hello @iarakis,

The example shown and linked above can be installed using the Library Manager in the Arduino IDE.

Search for “Blues Wireless Notecard Pseudo Sensor”, then open the SleepySensor example included with the library. It should work for almost any device that can be programmed using the Arduino IDE.

Let us know if you run into trouble,
Zak

But, does it wake the microcontroller in case Notecards accelerometer detects movement?

Regards,

No. In the loop() function, the device requests to sleep for a predetermined amount of time.

    J * req = NoteNewCommand("card.attn");
    JAddStringToObject(req, "mode", "sleep");
    JAddNumberToObject(req, "seconds", PERIOD_S);
    notecard.sendRequest(req);

To modify the behavior, you would change the mode parameter from:

    JAddStringToObject(req, "mode", "sleep");
    JAddNumberToObject(req, "seconds", PERIOD_S);

to the following:

JAddStringToObject(req, "mode", "arm,motion");

To see the complete list of parameters and options, please review the card.attn API.

You may also be interested in our Remote Alerting Mailbox project, which behaves similar to the SleepySensor example, but is configured to use motion (as opposed to time) to trigger the ATTN pin.

1 Like