How to create a Smoke Detector using Arduino in Tinkercad

by Jul 5, 2022Arduino Uno, arduino uno projects

Introduction

In this project, we will create a smoke detector setup using Arduino in the Tinkercad platform. The setup is simple and can be made by anyone. Also, the components we use are cheap and the hardware setup can be used in our homes, workplaces, etc. So let’s get started with the project and see its simulation.

You can visit the Tinkercad platform by clicking here. If you’re unfamiliar with the Tinkercad platform and want to know more about it, you can click here.

Components Required

  • Arduino UNO R3
  • Gas sensor
  • Piezo sensor
  • RGB LED
  • 220Ω resistors (3)
  • 1kΩ resistor
  • 22kΩ resistor
  • Breadboard

Setting up the Smoke Detector

First and foremost, drag all the above-mentioned components into the Tinkercad workspace.

Subsequently, let’s start connecting the components one by one. So, let’s start by looking into the gas sensor connections. The gas sensor provided in Tinkercad has 6 terminals, namely A1, H1, A2, B1, H2, and B2. Connect the terminals A1, H1, and A2 to the power supply. After that, connect terminal B1 to the power supply and the terminals H2 and B2 to the ground. In order to increase the accuracy and sensitivity of the gas sensor, we connect a 22kΩ load resistor between the terminal B2 and the ground.

Gas sensor setup

Subsequently, let’s connect the RGB LED which acts as an indicator for the smoke detector setup. The RGB LED has 4 terminals, namely RED, CATHODE, BLUE, AND GREEN. Connect the cathode terminal to the ground. Next, connect the terminals red, blue, and green to the digital pins 13, 11, and 10 respectively (we have chosen these pins for this project, any of the digital pins can be used for the connection). We use the 1kΩ resistors in the connection between the terminals and the digital pins. This is done to limit the current through the LED. As a result, the setup would look like this

RGB LED connections

Following this, we connect the piezo sensor to our setup. This is done so as to make a buzzing noise when smoke is detected. The piezo sensor has two terminals namely POSITIVE(+) and NEGATIVE(-). Connect the positive terminal to pin number 6 and the negative terminal to the ground. We need to limit the current flow to the sensor. Hence, connect the 1kΩ resistor in between the connection from the positive terminal to the digital pin. Therefore, the final circuit would look as follows

Final circuit

Coding the Smoke Detector

So now that the smoke detector circuit is complete, let’s dive into the coding part. The complete code is as follows

// C++ code
//
void setup()
{
  Serial.begin(9600);
  pinMode(A1,INPUT);
  pinMode(6,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(13,OUTPUT);
}

void loop()
{
  int sensorValue = analogRead(A1);
  Serial.print("Gas sensor reading = ");
  Serial.println(sensorValue);
  if(sensorValue > 800){
    digitalWrite(13,HIGH);
    digitalWrite(11,LOW);
    digitalWrite(10,LOW);
    digitalWrite(6,HIGH);
  }
  else{
    digitalWrite(13,LOW);
    digitalWrite(11,LOW);
    digitalWrite(10,HIGH);
    digitalWrite(6,LOW);
  }
}
Code for the smoke detector

Firstly, within the setup() function, we use Serial.begin() function in order to establish a serial communication. We set pin A1 as the input, and pins 6, 10, 11, and 13 as the output using the pinMode() function.

Subsequently, we start coding the loop() function. We read the smoke sensor readings from pin A1 using the analogRead() function. Then we assign the values to an integer type variable named “sensorValue”. Next, we print the gas sensor readings to the serial monitor using the Serial.print() function. For this project, we have set the threshold value for gas sensor readings as 800. So, if the readings are over the threshold value, the LED turns RED and the piezo sensor starts buzzing. If the readings are below the threshold value, the LED remains GREEN and the piezo sensor doesn’t make any buzzing noise. We accomplish this by using the if-else loop and setting the pins as HIGH/LOW using the digitalWrite() functions.

So now, the coding part is complete. Further, let’s simulate the circuit and see the results.

When gas sensor values are below the threshold value

Here, we can see that when the gas sensor readings are below the threshold value, the LED remains GREEN and the piezo sensor doesn’t make any buzzing noise. The serial monitor continuously displays the gas sensor readings on a real-time basis.

When gas sensor values are above the threshold value

Here, we can see that when the readings are above the threshold value, the LED turns RED and the piezo sensor starts buzzing. The serial monitor value updates on moving the smoke nearer to the gas sensor.

Conclusion

So with this, we have completed our smoke detector setup using the Tinkercad platform. Hope that this project was informative as well as interesting.

Happy Learning!

Creating a multiplication Skill in Alexa using python

Written By Monisha Macharla

Hi, I'm Monisha. I am a tech blogger and a hobbyist. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. Thank you for reading my blog! Happy learning!

RELATED POSTS

How to use simulators to build Arduino Projects

How to use simulators to build Arduino Projects

Introduction In this tutorial, let's learn how to use simulators for building Arduino projects for beginners. In addition to it, We shall learn how to configure it and how to get started with simulation tools. Here, We shall take an example of blinking an led using...

Arduino and its various development boards

Arduino and its various development boards

1. What is Arduino? Arduino is an open-source software and software company, project, and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices....

MIT app inventor with Arduino

MIT app inventor with Arduino

MIT app inventor is a platform developed to help you expand your ideas into mobile applications that can be used throughout various devices. Arduino, as you most probably have heard of is mainly used to develop and implement many projects. When you put together the...

Arduino Compatible Temperature Sensors

Arduino Compatible Temperature Sensors

In this article, we will look at Arduino's popular temperature sensors which are the foundation for Arduino's entry level projects. Temperature Sensor Temperature sensors are designed to measure the temperature of an object or substance using the properties and...

ARDUINO MKR 1000

In this article, we are going to learn about Arduino MKR 1000. .Arduino MKR1000 is a powerful board that combines the functionality of the Zero and the Wi-Fi Shield. It is the ideal solution for makers wanting to design IoT projects with minimal previous...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....