as225rr
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # A safety system for gas leakage **Name** : Amirhossein Soltaninejad **Short project overview:** A safety system for gas leakage is based on the Internet of Things system, where the system sends a value that expresses the percentage of gas in the air of the apartment and sends it on the dashboard to track the percentage of gas in the air while determining the percentage of danger. **How much time it might take to do:** I have spent around 30 hours programming the project and about 8 hours testing the functionality. # Objective **Why you chose the project:** I have chosen to do this project, first because of showing the strength and effectiveness of the Internet of things in effectively solving daily problems and also have a simple solution for the problem that can happen to every people. **What purpose does it serve:** Due to the presence and danger of gas leakage in the apartment and its impact on human life, this project can help to identify and measure the gas leakage and prevent possible upcoming damages **What insights do you think it will give:** It can be an opportunity to provide gas meters with the additional task of not only measuring consumption but also securing people's lives by adding this system to the meter. # Material **List of material:** 1. Microcontroller (NodeMCU esp8266) ![](https://i.imgur.com/ig62Huy.jpg) 2. Gas Sensor (MQ4) ![](https://i.imgur.com/8A53eaP.jpg) 3. Jumpers for connections ![](https://i.imgur.com/6DBGcFK.jpg) **What the different things (sensors, wires, controllers):** * **Microcontroller** It contains the processor and storage memory (flash memory) that holds the code that runs the entire system. **specification:** WeMo’s NodeMCU V3 ESP8266 CH340G WIFI Module With Extra Memory 32M Flash module is based on widely explored esp8266 System on Chip from Expressif.We add extra memory size to 32Mb. This better, for making a big project with the big library. You do not need to worry about the size of memory. Onboard have USB-TTL serial converter CH340G, with Micro-USB socket. Power In for DC 4~9V, to pin VIN. * **Gas Sensor (MQ4)** This sensor reads the gas value in the atmosphere and converts it into a voltage signal and sends it to the controller.Sensitive material of MQ-5 gas sensor is SnO2, which with lower conductivity in clean air. When the target combustible gas exist, the sensors conductivity is higher along with the gas concentration rising. The sensor convert change of conductivity to correspond output signal of gas concentration. MQ-5 gas sensor has high senility to Methane, Propane and Butane, natural gas and could be used to detect both Methane and Propane. **specification:** Main chip: LM393, ZYMQ-5 gas sensor Operating voltage: DC 5 Volt Size: 32mm X22mm X27mm * **Jumpers for connections** It is a wire that ends with a conductor, it connects three pins to the controller, which are: VCC Ground Analog Signal Pin **Where you bought them and how much they cost:** I have bought the microcontroller from https://www.styrahem.se with the price of 149kr. I have bought the gas leak sensor from https://AliExpress.com for 13kr. I have bought jumpers from https://elektristad.com/ for 25kr. # Computer setup **How is the device programmed:** The device is programmed using micro-Python firmware, which consists of three files, the first file is called boot.py and this is responsible for starting the firmware in the controller first when the system starts. And the second file is called config.py and it is responsible for adjusting the settings in the controller before working. The last one is main.py which contains the main function to be executed. **Inital steps** For inital setup it is needed to download specific version of the micro-python firmware for specific microcontroller from micro-python website. Then, by using uPyCraftV1.1 and choose upload firmware configure the setting for your microcontroller and upload it. **Chosen IDE:** I have used uPyCraftV1.1 which is editor and serial communication built-in. **How the code is uploaded:** 1. Created three files for the project boot.py, config.py and the main.py 2. Using uPyCraftV1.1 and choose upload and upload them in order. **Steps that you needed to do for your computer:** 1. Download uPuCraftV1.1 for windows. 2. Download specific version of the micro-python firmware for specific microcontroller from micro-python website. # Electronics and Connections * The sensor has four PINS, one for the input voltage, one for ground, one for the output analog signal, and one for the digital output signal. * We will connect the input voltage to 3.3 volts from the micro. * And the ground to micro ground. * Output analog signal to A0 in micro. **Circuit diagram** ![](https://i.imgur.com/UtW2ygc.jpg) 1. VCC -> need 3.3 volt to work 2. Ground -> Ground 0 volt 3. OUT -> A0 change as sensor work 4. For resistor we don’t need here as we use power from micro. I should mention that the project is only for development and the only step to go to production is to merge micro with sensor to reduce the cost. # Platform **Platform Choice:** I have used node-red because it is simple and allows the user to customize and design their system. It depends on the local host. **Local or cloud:** I have used a cloud service that is a free hiveMQ free broker. And to scale need to subscript for cloud service. **platform in terms of functionality:** platforms in terms of functionality are the MQTT protocol to send and used data on free broker hiveQM. Or microcontroller based on. # The code The code is uploaded in the GitHub following link and it contains 3 classes. boot.py and this is responsible for starting the firmware in the controller first when the system starts. And the second file is called config.py and it is responsible for adjusting the settings in the controller before working. The last one is main.py which contains the main function to be executed. The code link: https://github.com/mantoomine/IOT_Project # Transmitting the data / connectivity **How often is the data sent:** Data is sent every second because the project is critical and depends on the speed, and the size of data is 4 bytes. **Which wireless protocols did you use (WiFi, LoRa, etc …):** Wi-Fi wireless protocols are used for this project. **Which transport protocols were used (MQTT, webhook, etc …):** MQTT protocol is used to send and use data on free broker hiveQM. # Presenting the data **Visual examples on how the dashboard looks:** ![](https://i.imgur.com/tXB4JMQ.png) ![](https://i.imgur.com/bweusRc.png) **How often is data saved in the database:** I have used Excel, but the data can be saved in any database. I used Excel because the data sent is a lot, as the sensor sends readers every second, and it is not important, so storing it is a waste of time and resources. I only record important events, such as when the reading increases dramatically, there is a leak here. I record the event, not the reading. # Finalizing the design As it was my first experience with microcontrollers and python programming language, I have chosen a simple project it can help me to learn the basics of IoT and python. And also I have tried to choose a project that is helpful in people's lives. This system can be added to the gas meters so that the meter comes with the system built in, making it more effective in the direction of productivity. This is a picture of the final result of the system while it is working, and it shows the outputs on the dashboard and displays a real reading in real-time. ![](https://i.imgur.com/boRS9zl.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully