Skip to content
Emulate the AWS IoT Button on a Raspberry Pi with a simple push button using this C++ sample
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A simple emulator for the AWS IoT Button implemeted in C++ for compilation on the Raspberry Pi.

Quick getting started guide (needs more work) - assumes you have Raspbian Jessie Minimal installed

Downloading and Building WiringPi

  • Install git on your Pi with sudo apt-get install git
  • Clone the wiringPi source repo with git clone git://
  • cd wiringPi && ./build

Downloading and Building the AWS IoT SDK for Embedded C

  • Install cmake on your Pi with sudo apt-get install cmake
  • Clone the AWS IoT SDK with git clone
  • git clone
  • mv cpputest/* aws-iot-device-sdk-embedded-C/external_libs/CppUTest/ && rm -rf cpputest
  • wget
  • unzip mbedtls-mbedtls-2.1.1
  • mv mbedtls-mbedtls-2.1.1/* aws-iot-device-sdk-embedded-C/external_libs/mbedTLS/ && rm -rf mbedtls-mbedtls-2.1.1
  • cd aws-iot-device-sdk-embedded-C
  • make

This will kick off the build the AWS IoT C SDK on your Raspberry Pi. This takes a while. As the Pi is a British invention, go and make a cup of tea at this point

Setting up the IoT Button Emulator

  • Clone this repo in samples/linux/ with the other client samples with cd samples/linux ; git clone

  • Set up your thing on the AWS IoT console or use the command line and download your device certificates & public/private keys

  • Create a directory called samples/linux/certs

  • Put your downloaded device specific certificate, the CA root certificate and public/private keys in samples/linux/certs

  • Edit aws_iot_config.h with the correct filenames for your certificates and keys, your device serial number, and your account specific AWS IoT endpoint

  • Build with the make command. This build the mbedtls library on first build along with the button emulator

  • Replicate the wiring setup shown in iot-button-emulator-wiring.jpeg

  • run sudo ./iot-button-emulator (must be run as root for access to the GPIO)

  • subscribe to the iot-button-emulator/+ topic with the AWS IoT Console

Press the connected button and watch the JSON messages flow

You can’t perform that action at this time.