Skip to content

Marvell's AWS IoT Starter Kit to Interface Grove Sensors

Prafulla Wadaskar edited this page Apr 5, 2016 · 16 revisions

Introduction and Overview

Welcome to Marvell's AWS IoT Starter Kit to Interface Grove Sensors This documents is a quick start guide that helps to setup Grove sensors to work with Marvell's AWS IoT Starter Kit to report the sensor data to AWS cloud

H/W Overview

###Marvell MW302 IoT Starter Kit Powered by AWS This is the main board Powered by AWS IoT is available for sale globally on All the sensors need to be interfaced to this board.

BASE-SHILD: Base Shield V2

Since the connector used on the Marvell's IoT Starter Kit Board is different than that of the interface provided on Grove Sensors, this board is used, it offers easy connections to the multiple sensors

Jumper Wires M/F

You will need these jumper wires to connect signals from MW300 board to the BASE Shield

Grove Environmental Sensors

S.N. Grove Sensor Image Datasheet Wiki
1. Grove - Barometer Sensor (BMP180) Datasheet WiKi
2. Grove - Temp&Humi Sensor Datasheet WiKi
3. Grove - CO2 Sensor Datasheet WiKi
4. Grove - Gas Sensor(MQ9) Datasheet WiKi
5. Grove - Light Sensor Datasheet WiKi
6. Grove - Temperature Sensor V1.2 Datasheet WiKi
7. Grove_-_3-Axis_Digital_Accelerometer(±1.5g) Datasheet WiKi

Assembling the Hardware

Connecting Sensors to the Base Shield

S.N. Grove Sensor Socket on the Base Shield
1. Grove - Barometer Sensor (BMP180) Connect on any of I2C socket
2. Grove - Temp&Humi Sensor Connect on D4 socket
3. Grove - CO2 Sensor Connect on UART socket
4. Grove - Gas Sensor(MQ9) Connect on A3 socket
5. Grove - Light Sensor Connect on A2 socket
6. Grove - Temperature Sensor Connect on A0 socket
7. Grove - 3-Axis_Digital_Accelerometer(±1.5g) Connect on any of I2C socket

Below picture show all the sensors connected to the Base Shield

Connecting Base Shield to the MW300_RD board

S.N. Signal HD2 Pin on MW300_RD HD4 Pin on MW300_RD Connection on the BASE-SHIELD
1. 3.3V 2 BASE-SHIELD:J17:Pin5(3.3V)
2. 1WIRE (IO-00) 5 BASE-SHIELD:J20:Pin5(D4)
4. UART2_RXD (IO-48) 21 BASE-SHIELD:J20:Pin2(TX)
5. UART2_TXD (IO-49) 23 BASE-SHIELD:J20:Pin1(RX)
6. GPIO47 (IO-47) 25 BASE-SHIELD:J18:Pin4(Analog-3)
7. GPIO42 (IO-42) 27 BASE-SHIELD:J18:Pin2(Analog-1)
8. GPIO43 (IO-43) 29 BASE-SHIELD:J18:Pin3(Analog-2)
9. SDA (IO-04) 3 BASE-SHIELD:J19:Pin9(SDA)
10. SCL (IO-05) 5 BASE-SHIELD:J19:Pin19(SCL)

Please make sure connections are firm and there are no loose contacts

Below picture gives brief idea about how to do connections

With this your hardware is ready to use, the next step is to prepare a development setup and flash the relevant software on the board.

Software Build and Run

Development Setup with the host

  1. Connect MW300_RD board to the Linux host using USB-Mini cable to the JTAG-UART USB interface on the MW300_RD board
  2. This will power up the board, Please validate LED on BASE Shield (green) glows, if it doesn’t then check the power switch on the Base Shield board is toward 3.3V

Preparing the Marvell AWS-IoT-Kit Source code with sensor support

git pull it directly from github using below command:

             git clone

Building Firmware binaries with Grove sensor support

  1. Once you git gull the source, switch to the folder

              cd aws_starter_sdk
  2. Clean the project

              make clean
  3. Build the firmware for all sensor support


you can customize your build for selecting few of them, for ex: CO2 and Gas Sensors are 5V operated, so let's say if you with to build the firmware only for them then you should use-

             make SEN_CO2=y SEN_GAS=y
  1. As a result of successful build, you will get binaries to flash on the board.

Flashing firmware binaries on Marvell MW302 IoT Starter Kit

  1. download the flash image aws_starter_sdk-2015_11_04.blob

  2. Flash it on the board using below process

             ./wmsdk/tools/OpenOCD/ -f aws_starter_sdk-2015_12_08.blob
  3. Then flash newly build firmware on the top of it

             ./wmsdk/tools/OpenOCD/ --mcufw ./bin/mw302_rd/aws_starter_demo.bin
  4. Reboot or Re-power the board, you will find Orange LED flashing on the board slowly, this indicates board is now ready to use

Configuring the board for AWS IoT Connectivity

Follow the documentation here to setup your AWS account, IOT things and setup the kit to establish connection.

Once the successful connection is established with the AWS IoT Infrastructure, the sensors will start pushing the information to the cloud.

Now you can disconnect your board from the development setup and do the standalone testing.

Executing and testing the results

Powering up the board

Power up the MW300_RD board using any of the power supply option provided on the board. The board can be powered using standard USB-Mini connector or 5VC through RCA Jack.

Seeing the results on debug console

  1. Hook up any serial console (like minicom, or hyperterminal ) to see the debug logs from the board (Serial Port Configuration:115200/8N1).
  2. Re-Power up or Reset the board, this will reboot the system and you will see the sensors events being generated and posted to the AWS cloud on your debug console.
  3. Please note that scanning a sensor and sending a relevant data to the AWS cloud will be only done if your board is successfully connected to the AWS cloud
  4. Using debug console you can see what data is being generated and posted to the AWS cloud
  5. Below are sample test results those are captured from the debug console for your reference

Seeing the results on AWS IoT

Please refer Working with Thing Shadows (Simulating an app) Section in the Getting Started Guide

Software Design and Architecture



Developers can get started with the Marvell AWS IoT Starter SDK available at github. The starter SDK will allow developers to quickly prototype their IoT device concept by using the IO interfaces available on the development kit. The SDK includes libraries to connect the kit to a Wi-Fi network and then establish a secure, bi-directional communication to the AWS cloud and interface to the various IoT related services offered by AWS

What is the sample app? What does the sample app do?

Sample app are simple applications provided in the Marvell AWS IoT STARTER SDK, that helps developers to understand how to use available H/W IPs on MW300 development platform. There are several apps bundled with the SDK including aws_starter_demo. Sample app explains/helps how to crate a custom applications for specific need using different software features provided in the SDK

How do you use it with AWS IoT Service?

aws_starter_demo is one of the app bundled in the SDK that can be used to connect a device "Thing" to the AWS-IoT Cloud infrastructure through WiFi communication channel through MW300. You can find more detailed documentation on this here

System Architecture for Sensor Interface

AWS-IoT provides a standard framework to exchange the event notification across the devices through cloud. you can find more information about AWS IoT System architecture here. Marvell AWS IoT STARTER SDK provides sample applications that may help you to understand how to handle H/W IPs of MW300 like UART, GPIOS, I2C, SPI to communicate with sensor hardware. It also contains sample application to post the push button sensory events to the AWS cloud. It contains all necessary software for MW300 to build, debug and flash your custom application on the target board. More details on this can be found here

Sensor Interface Layer.

Each sensor is different of its kind and is a transducer that converts sensory information into the electrical signal (digital or analog). These sensors are interfaced with the MW300 through any of available H/W IPs on the board (for ex: GPIO, ADC, IEC etc...). Whereas the code to grab the information from the sensor is hardware specific (we call it as a Sensor Low Level Driver) that interacts with the sensor h/w for initialization and configuration and then further to read sensor data periodically. Sensor Interface Layer is a middleware, a thin layer of interface between main application layer and the multiple sensors supported through sensor low level drivers.

Sensor Interface Layer provides an APIs to be used in the main application and the hooks to interface

Sensor Interface Layer APIs

| S.N. | API | Description | | ---- | --- | ---| --- | ---| | 1. | int sensor_drv_init(void) | This API need to called once during initialization by the application layer | | 2. | int sensor_event_register(struct sensor_info *sevnt) | This API is used to register Sensor Low Level Driver with the Sensor interface layer, for each sensor to be supported their must be one register call | | 3. | int sensor_msg_construct(char src, chardest, int len) | Generally this API is called from the Publish thing state to shadow context of AWS IoT application. If there is a diff observed between two successive sensor readings, a JSON object will be constructed to post over AWS-IoT Cloud | | 4. | void sensor_inputs_scan(void) | This API is used to perform Sensor Scan operation, all the registered sensors will be scanned in a sequence | | 5. | int sensor_event_unregister(struct sensor_info *sevnt) | Not implemented, reserved for future use cases |

Sensor Low level Driver

The interface is very flexible so that you can register multiple sensors seamlessly to initialize, scan and report multiple sensory events using JSON object. It also provides an abstraction layer for Sensor Low Level Driver and rest of the software for better code management.

In brief, a sensor developer should only worry and focus on the sensor development and achieving desired accuracy and he should just delegate all communication related dependencies and handling to the upper layers.

Sensor Low level Driver is nothing but a set of one c file and one header file that has mostly sensor h/w specific code. It has mainly register, init and scan APIs to interface with upper layer. Then it can have the code specific to the senor to capture the sensory information, that may vary case to case.

Sensor Low Level Driver Data structure

             `/* Struct to hold each sensor event data */`
             `struct sensor_info {`
             	`char event_curr_value[64];`
             	`char event_prev_value[64];`
             	`char *property; /*JSON Name of event */`
             	`/* Sensor Low Level Driver Interfacing APIs */ `
             	`int (*init)(struct sensor_info *sevent);`
             	`int (*read)(struct sensor_info *sevent);`
             	`int (*write)(struct sensor_info *sevent);`
             	`int (*exit)(struct sensor_info *sevent);`
             	`struct sensor_info *next;`

Sensor Low Level Driver APIs

Sensor Low Level Driver Data structure provides a call back mechanism through function points to be executed by Sensor Interface Layer whenever is needed

| S.N. | API | Description | | ---- | --- | ---| --- | ---| | 1. | int (*init)(struct sensor_info *sevent) | This is a callback function, will be executed by the Sensor Interface Layer in the context of sensor_event_register API, All H/W initialization to be performed in this callback | | 2. | int (*read)(struct sensor_info *sevent) | This is a callback function, will be executed by the Sensor Interface Layer in the context of sensor_inputs_scan operation, generally sensor is polled through this API to read it's value periodically | | 3. | int (*write)(struct sensor_info *sevent) | Reserved for future use cases | | 4. | int (*exit)(struct sensor_info *sevent) | Reserved for future use cases |

You can create such pair of file for each driver to be supported, the sample code templates are as below.



There are few Grove sensor already supported in the SDK, you can find them here.


The support is available on email or chat at github (


  1. Low Level Drivers for Light sensor, NTC based temperature sensors and Gas sensors are interfaced on ADC channels, and those needs calibration for desired level of accuracy for the readings which are not done in the current implementation. This need to be addressed with some reference source for cross verification.
You can’t perform that action at this time.