In this blog we will see how to connect accelerometer to edison and send the accelerometer readings to AWS IoT through MQTT.
First connect the grove accelerometer to I2C bus as shown below
You need to AWS certificates in order to send data to AWS IoT cloud, if you haven’t generated them, check out this procedure.
you need to install the aws device sdk as well
npm install -g aws-iot-device-sdk
Instead of sending every sample we make, we will send data to cloud only if the data is substantially different from the data we sent previously (you can change the value of DELTA , small DELTA means minor changes in data also sent to cloud).
SAMPLING_RATE defines number of samples per second, if your application involves fast changes in orientation you should consider increasing it.
You can see the data posted by the edison on AWS IoT Console (MQTT Client tab). Edison will post data to /iot/edison/acc topic.
You can download the project from GitHub.