Skip to main content

Smart Cities (IoT) by MadHatter

Page 1

MadHatter

Smart Cities Internet of Things


MADHATTER

Table of Contents Introduction to IoT Smart Cities Features of Smart Cities Sensors Introduction Types of sensors Processors Introduction

01 02 03

Types of Microcontrollers Self Watering Plant Tutorial Introduction Roadmap Step by Step

09

Conclusion About The Author

15 16

05 06 08

10 11 12

The author Asad Ayub is a World Economic Forum Global Shaper. He believes in harnessing emerging technology for the greater good.


MADHATTER

Internet of Things

IoT stands for "Internet of Things." It's a fancy way of saying that everyday objects, like your fridge, car, or even a streetlight, are connected to the internet and can talk to each other. This helps them share information and do smart things on their own. So, IoT is all about making our lives easier and more efficient by connecting things to the internet. Making an IoT device is not very difficult and by the end of this book you will know how to make your own self watering plant using IoT. Another application we will explore is smart cities, where IoT enables better urban living through real-time data from sensors in areas like traffic management, waste control, energy efficiency, and healthcare, resulting in improved efficiency, cost reduction, and enhanced quality of life.

1


MADHATTER

Smart Cities 01 Smart Traffic Lights

02 Waste Sensors

10 Urban Planning

03

09

Smart Meters & Grids

Remote Patient Monitoring

04

08

Air Quality Sensors

Emergency Response

05 Smart Lighting

07 06 Smart Public Transportation

Water Sensors

2


MADHATTER

Smart Cities 01

Smart Traffic

Smart traffic lights and cameras with IoT sensors can monitor traffic flow in realtime. Reduces traffic congestion, minimises fuel consumption, and decreases air pollution.

02

Smart Bins

Smart waste bins equipped with sensors can alert authorities when they are full. Optimises garbage collection routes, reduces costs, and keeps the city cleaner.

03

Smart Grids

IoT sensors in power grids can balance energy supply and demand automatically. This lowers energy costs, reduces power outages, and decreases carbon footprint.

3


MADHATTER

Smart Cities 04 Air Sensors IoT devices can measure air quality and provide data to citizens and authorities. Promote healthier living conditions, enable faster response to pollution issues.

05

Smart Lighting

IoT-connected streetlights can adjust brightness based on traffic and weather conditions. Save energy, improve safety, and reduce light pollution.

06 Water Sensors IoT sensors can monitor water infrastructure for leaks and usage patterns. Leads to conservation of water resources, lower maintenance costs, and reduced water wastage.

4


MADHATTER

Sensors To understand IoT we must understand some common types of sensors and the processors. Sensors collect information from the physical realm and converts it into digital information.

5


MADHATTER

Types of Sensors 01 02

09

Temprature

Humidity

Infrared

03

08

Water

Sound

04

07

Pressure

Gas

05

06

Motion

Light

6


MADHATTER

Types of Sensors 10 11

Image

GPS

19 RFID

12

18

Biometric

Ultrasonic

13

17

Proximity

Chemical

16

14 Soil Moisture

15

Radiation

Weight

7


MADHATTER

Processors Now that we have collected information from the physical world, we must find a miniature computer to send this information to us over the internet. This is where several inexpensive microcontrollers come into the picture.

8


MADHATTER

Microcontrollers 01

Arduino

Arduino is one of the most widely used and affordable microcontroller platforms for IoT prototyping. Various Arduino boards are available, including the Arduino Uno, Arduino Nano, and Arduino ESP8266, which has built-in WiFi capabilities.

03 ESP32 ESP8266/ESP32 are popular low cost microcontrollers with built-in Wi-Fi and Bluetooth capabilities. The ESP8266 and ESP32 are popular choices for IoT projects and can be programmed using the Arduino IDE platform.

02 Raspberry Pi While not a microcontroller, the Raspberry Pi is a single-board computer that can be used for IoT projects. The Raspberry Pi Zero W and Raspberry Pi Pico are cost-effective options with builtin Wi-Fi and Bluetooth connectivity.

9


MADHATTER

Self Watering Plant Tutorial Let's go over the steps again for creating an IoT self-watering plant system using an ESP32 microcontroller, a soil moisture sensor, and the Arduino IDE. We encourage you to follow along. Components Needed: ESP32 microcontroller board Soil moisture sensor Water pump and relay module Tubing and water container Mobile device with the Blynk app installed (for remote control)

10


MADHATTER

Roadmap Building IoT Solutions

Get hardware

Hardware

Download the Blynk app on your phone

Blynk

Upload code into the microcontroller

Upload

Place the sensor in the soil & monitor from app.

Arduino IDE

Install Arduino IDE & needed libraries

Code

Write or copy paste code from library

App

Configure Blynk app

Test

11


MADHATTER

Self Watering Plant Step by Step

01 Hardware Connect the soil moisture sensor to the ESP32's analog input pin. Connect a water pump to one of the ESP32's GPIO pins using a relay module. Set up the water container above the plant, with tubing connecting the pump to the plant's soil.

02 Arduino IDE

03 Blynk App

Install the Arduino IDE on your computer if you haven't already. In Arduino IDE, go to Sketch > Include Library > Manage Libraries and install the required libraries: Blynk (for IoT communication) Adafruit Seesaw (for the soil moisture sensor, if needed) Other specific libraries.

Download the Blynk app on your mobile device. Create a new project in the app. Add a "Value Display" widget for moisture level feedback and a "Button" widget for manual watering control. Obtain the Blynk authentication token for your project.

12


MADHATTER

Self Watering Plant 04 Arduino Code Open Arduino IDE and create a new sketch. Write the following sample code, replacing <YourSSID>, <YourPassword>, and <BlynkAuthToken> with your Wi-Fi credentials and Blynk authentication token:

#include <WiFi.h> #include <BlynkSimpleEsp32.h> char auth[] = "<BlynkAuthToken>"; char ssid[] = "<YourSSID>"; char pass[] = "<YourPassword>"; int moistureSensorPin = A0; int pumpPin = 2; void setup() { Serial.begin(115200); Blynk.begin(auth, ssid, pass); pinMode(pumpPin, OUTPUT); }

void loop() { Blynk.run(); int moistureLevel = analogRead(moistureSensorPin); // Adjust the threshold as per your plant's needs if (moistureLevel < 500) { // Soil is dry, turn on the pump digitalWrite(pumpPin, HIGH); Blynk.virtualWrite(V1, "Watering..."); } else { // Soil is moist, turn off the pump digitalWrite(pumpPin, LOW); Blynk.virtualWrite(V1, "Good"); } delay(1000); // Delay to avoid rapid readings }

13


MADHATTER

Self Watering Plant Step by Step

05 Upload Code Connect the ESP32 to your computer via USB. Select the ESP32 board and port in the Arduino IDE. Click the "Upload" button to upload the code to your ESP32.

06 Configure App In the Blynk app, configure the "Value Display" widget to read data from Virtual Pin V1. Configure the "Button" widget to control the pump using Virtual Pin V2.

07 Voilà! Place the soil moisture sensor in your plant's soil. Power on the ESP32 and open the Blynk app on your mobile device. You can now remotely monitor the moisture level and manually water your plant through the app.

14


MADHATTER

In this book, we embarked on a journey into the exciting world of IoT, exploring how simple chips and sensors can transform our surroundings and empower us to be creators of smart, connected solutions. We've witnessed the incredible potential of IoT in various real-world applications, from smart cities that enhance our urban lives to innovative self-watering plant systems that make our everyday tasks more efficient. But beyond the convenience and efficiency, IoT carries with it a powerful message of hope and responsibility. As we face global challenges like climate change and resource scarcity, the Internet of Things emerges as a formidable ally. Through sensors and datadriven insights, we can monitor and mitigate environmental risks, reduce energy consumption, and ultimately contribute to a more sustainable planet. In the world of IoT, we are all creators. Whether you're an aspiring maker, an experienced engineer, or someone who simply wants to make their home a little smarter, you have the tools at your disposal. The examples and possibilities outlined in this book are just the beginning of what we can achieve together. So, let's rise to the challenge, ignite our creativity, and embark on a journey to shape a smarter, more connected, and sustainable world for generations to come. The future is in our hands, and with IoT, it's brighter than ever before.

15


MadHatter

About The Author Asad Ayub is a World Economic Forum Global Shaper. He is a board member at MadHatter & has worked in the field of social impact for the EU, MasterCard Foundation and Google.org.


Turn static files into dynamic content formats.

Create a flipbook
Smart Cities (IoT) by MadHatter by MadHatter Foundation - Issuu