Smart Room Control

Introduction: Smart Room Control

In this project, we aim to learn how to use AWS and MQTT in our setup. Being in the world of technology, how great will it be being able to control your room with just your laptop! Imagine yourself rushing for time to complete your projects, walking over to turn on the switch for your light is just too time consuming!

This portal will:

  • Allow you to upload/retrieve images (S3 Bucket)
  • Check light values (DynamoDB)
  • Turn on/off led
  • Check temperature and humidity (phpmyadmin)

From students to elderly, it’s a simple interface that is easy to use and understand!

Step 1: Hardware Checklist

Let’s review the hardware components needed for this tutorial.

  1. Assorted Jumper Cables
  2. DHT11 Temperature and Humidity Sensor x1
  3. 10k ohms resistor x2
  4. MCP3008 x1
  5. Light-Dependant Resistor (LDR) x1
  6. LED Light x1
  7. 330 ohms resistor x1
  8. Picamera x1

Step 2: Accessing AWS

  1. Login to
  2. Copy the Access Key ID and Secret Access Key for configure purposes later.
  3. Click "Open Console"

Register your Raspberry Pi as a "Thing"

  1. Search for AWS IoT
  2. Under the left navigation bar, click "Manage" and select "Things"
  3. Write a name for your Thing and create a certificate.
  4. Save the 4 files generated upon certification creation.
  5. Create a policy and attach the policy to your Thing.


  1. Search for DynamoDB
  2. Create a table for Light

S3 Bucket

  1. Search for S3
  2. Create a bucket for uploading of images

Step 3: Installation for Raspberry Pi

Before you begin running the codes, install these in your Raspberry Pi.

  1. Open terminal window
  • AWSIoTPythonSDK: sudo pip install AWSIoTPythonSDK
  • awscli: sudo pip install awscli
  • Boto: sudo pip install boto
  • Boto3: sudo pip install boto3
  • Flask: sudo pip install flask
  • mqtt: sudo pip install mqtt
  • paho: sudo pip install paho

Run in your terminal window:

aws configure

and key in the access key and secret access key of your console.

Step 4: Smart Room Control Codes

  • This will insert temperature and humidity into database
  • This will subscribe to topics such as sensors/light and camera to get the light value and images.
  • This will allow LED to be turned on and off. Temperature and humidity will also be retrieve and displayed on the html page. Light value stored in the dynamoDB will be retrieved.

Step 5: Learning Experiences

Being totally new to Python, we faced a lot of difficulties and troubles during the process of learning this IoT module. However, with the guidance of our teachers and friends, we managed to cope and learn. Through this project, we learnt the importance of IoT devices in the current world, and we also got to have a better knowledge on using AWS.

Be the First to Share


    • Block Code Contest

      Block Code Contest
    • Cold Challenge

      Cold Challenge
    • Make it Glow Contest

      Make it Glow Contest


    DIY Hacks and How Tos

    Cool design. Could you share more about how this is connected to various appliances.