Accelerometer and external storage example?


Hey guys, I am thinking about buying BigClown for one of my IoT projects and it grabbed my attention because Core Module has accelerometer already built inside and I really need that one :slight_smile: But I was wondering, are there any examples of how to use it? Only thing I found is SDK docs here but … I am not such a big expert so any learning material would be cool.

Any suggestions or projects you have done with it?

Also can I use some kind of external storage with BigClown for data storage when its not connected to my Raspberry? For my project there will be time periods (from minutes to days) when I will need BigClown to run as standalone unit with no communication with outside world, so I need to store my data somewhere. Maybe SD card via SPI? Is it possible?

Sorry for not-so-specific question, but I am trying to determine if BigClown is THE solution for me and where better to ask :slight_smile:


Hi Pirozek,
thank you for considering BigClown in your next IoT project.

With our event-driven programming approach and high-level APIs, the accelerometer implementation is really easy.

In short you just put this in your application.c file:

#include <application.h>

bc_lis2dh12_t accelerometer;

void accelerometr_event_handler(bc_lis2dh12_t *self, bc_lis2dh12_event_t event, void *event_param)
    if (event == BC_LIS2DH12_EVENT_UPDATE)
        bc_lis2dh12_result_g_t result;

        if (bc_lis2dh12_get_result_g(self, &result)
            // TODO Process your result.x_axis + result.y_axis + result.z_axis HERE !

void application_init(void)
    bc_lis2dh12_set_event_handler(&accelerometer, accelerometr_event_handler, NULL);
    bc_lis2dh12_set_update_interval(&accelerometer, 100); // 100 ms update rate

I did not test it but I believe it will work and if not, we are always here for you to help!

In terms of SD card logging, we have SPI port on Core Module, so you can hook up an SD card and use for example SPIFFS to do some logging in a reliable manner. Unfortunately, we do not have it implemented yet - would you be interested to try it? Again, we will be happy to assist you…

Cheers! P.