Sensors

Enter Your Electronics & Design Project for a chance to win a $200 shopping cart!

Submit an EntrySubmit an Entry  Back to homepage
Project14 Home
Monthly Themes
Monthly Theme Poll

 

Design and build a system to monitor the status of a laboratory using the Microchip AVR-IoT WG Development Board.

 

Things used in this project

 

Hardware components
AVR-IoT WG Development Board
Microchip Technology AVR-IoT WG Development Board
×1
Arduino Nano R3
Arduino Nano R3
×1

 

NeoPixel Ring: WS2812 5050 RGB LED
Adafruit NeoPixel Ring: WS2812 5050 RGB LED
×1

 

DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1

 

Grove - Barometer Sensor (BMP280)
Seeed Grove - Barometer Sensor (BMP280)
×1

 

Grove - Gas Sensor(MQ2)
Seeed Grove - Gas Sensor(MQ2)
×1

 

Custom PCB
Custom PCB
×1
Jumper wires (generic)
Jumper wires (generic)
×1

 

Software apps and online services
Atmel START
Microchip Technology Atmel START
Arduino IDE
Arduino IDE
Atmel Studio 7
Microchip Technology Atmel Studio 7
Cloud IoT Core
Google Cloud IoT Core



Story

Why Did We Build This?

The maintenance of the ambience in places such as laboratory, especially chemical lab is essential. The temperature, humidity and the ambient light has to be monitored continuously and the level of Air quality and heat levels are used as interrupt to prevent the laboratory accidents.

 

Hardware Build

First of all, I would like to thank Microchip for supporting this project with the amazing AVR-IoT WG Development Board, I really felt informative using this board and able to achieve some of the complex projects integrated within a PCB.

 

Basic Hardware Components

AVR-IoT WG Development Board:

  • Go from out-of-the-box to cloud-connected in 30 seconds
  • Onboard 8-bit MCU brings the processing power and simplicity of the AVR architecture with Core Independent Peripherals (CIPs) which further decrease power consumption
  • Secure authentication with hardware-based private key storage

 

Features:
  • ATmega4808 microcontroller
  • TEMT6000 Light sensor
  • MCP9808 Temperature sensor
  • ATECC608A CryptoAuthentication™ device
  • WINC1510 WiFi Module
  • On-board nEDBG Debugger
  • USB and battery powered
  • Integrated Li-Ion/LiPo battery charger

Arduino Nano:

Arduino Nano is a small board compatible with breadboards which is compatible with ATMega328. It has comparable usefulness to the Arduino Uno, however, when it comes to DIP module package, it works with a Mini-B USB link. This Arduino clone board is superbly compatible with Arduino IDE.

 

 

Step 1: Getting Started with Microchip's AVR-IoT WG Board

This board has an inbuilt temperature sensor and a light sensor which a preloaded firmware that publishes the data from the sensors to cloud.The AVR-IoT WG development board features two sensors:
            • A light sensor
            • A high-accuracy temperature sensor - MCP9808
In addition to this, we use a few more sensors with Arduino that will be explained in the further part.

Step 2: Adding the Device to the Cloud

First Login to the Google IoT core and create a new project and note your Project ID which will be needed later, when you program the hardware to connect to the project.
Note: Here I had used a free trial account. Complete your billing procedure to enable the API.
In the Google Cloud console, you can find the IOT core at the sidebar.
Create a registry:

 

 

To Register the device:
Note the Device ID from the Click me file, which will direct you to a link.

 

 

In the next form, Fill up device ID with an alphabet at first, the Public key format is of ES256 which can be verified, and add the PUBKEY.txt file in the add device page.

 

 

Now the device is successfully added to the Google Cloud.Go to the ATMEL START program and enter your Project IDRegistry ID. i.e. Project ID: avr-iot, Registry ID: AVR-IoT and MQTT host: mqtt.googleapis.comin case of my project

 

 

Finally, Export the project to ATMEL Studio 7 and enable the debugger to start the program.

Step 3: Interfacing Other Sensors Using Arduino

Connecting the Peripheral to the Arduino:

Now we will see how to interface the other sensors with Arduino nano.
Interfacing DHT11:
The DHT11 sensor detects water vapor by measuring the electrical resistance between the two electrodes. The humidity sensing component is a moisture holding substrate. When water vapor is absorbed by the substrate, the ions are released by the substrate which increases the conductivity between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity computed. Higher relative humidity(RH) decreases the resistance between the electrodes, while lower relative humidity increases the resistance between the electrodes i.e Relative humidity is inversely proportional to the resistance between two electrodes.
Here we connect the DHT11 temperature and humidity sensor to the digital pin of the Arduino.

 

 

The Digital pin 7 of Arduino nano is used for the Output signal. Connections:
Arduino ------------------------------------- DHT11
VCC(3.3v)                  ->                        Vcc(3.3v)
GND                           ->                        Ground(0V)
D7                              ->                         Signal
The Temperature and the humidity from the DHT11 are calculated and stored in the variables which will be carried to the next section of the project.
Interfacing NeoPixel:
Then we connect the NeoPixel to the digital pin of the Arduino.

 

 

The Digital pin 2 of Arduino nano is used as Data IN. Connections :
Arduino -----------------------------------------WS2816
VCC(3.3v)                  ->                        Vcc(3.3v)
GND                           ->                        Ground(0V)
D2                               ->                        DI (Data In)
The NeoPixel library is attached in the repository.
The NeoPixel ring which I had used is a 16-bit NeoPixel, i.e. the ring consists of 16 LEDs.
The color of the NeoPixel is switched depending on the temperature and humidity stored in the variables.
Interfacing BMP280 sensor:
The BMP280 air pressure sensor from Bosch gives the measured air pressure (ambient air pressure) and the ambient temperature as raw values, whereby the output can now be either via I2C or via the SPI interface. But also the BMP280 waits with some improvements compared to the BMP180.
The default I2C address of the mapped module is 0x76 and can be changed to 0x77 with a solder bridge on the module.
Here I had used SPI protocol to communicate with Arduino.
With the aid of 12 compensation parameters stored in the sensor, it is possible to determine the atmospheric pressure at the location (station level air pressure), altitude and the ambient temperature from the raw values.

 

 

The I2C pins of Arduino nano are A4 & A5. Connections :
Arduino ------------------------------------- BMP280
VCC(3.3v)                    ->                        Vcc(3.3v)
GND                             ->                        Ground(0V)
D10                              ->                         CS
D11                              ->                         MOSI
D12                              ->                         MISO
D13                              ->                         SCK 
Interfacing Air sensor:
Here I interface the MQ5 gas sensor which is a generic gas sensor available in the market which is more suited to detect and determine LPG concentrations. This module has two output possibilities
  • The analog output can be used to detect Gas leakage and to measure the volume of Gas leakage using certain algorithms which are implemented in the firmware and the level of Gas leakage is specified in ppm.
  • The digital out can be used to detect Gas leakage. When there is a leakage of gas, an Interrupt is set by the Arduino which indicates the leakage of gas.

 

 

The digital pin 8 of Arduino nano is used for the Output signal. Connections :
Arduino ------------------------------------- MQ5
VCC(3.3v)                  ->                        Vcc(3.3v)
GND                           ->                        Ground(0V)
D8                              ->                         Data
Interfacing Buzzer:
A buzzer is added to the circuit to alert in case of an emergency.

 

 

The digital pin 9 of Arduino nano is used for Output signal which is a PWM signal. Connections :
Arduino ------------------------------------------ Buzzer
D9                                ->                         VCC
GND                            ->                        Ground(0V)

Step 4: Uploading the Firmware:

Before uploading the firmware, we have to create a bus to connect Arduino with the Microchip AVR-IOT-WG Board.
Connections :
Arduino -------------------------------------  Microchip AVR-IoT-Wg Board
VCC(3.3v)                  ->                        Vcc(3.3v)
GND                            ->                        Ground(0V)
D0 (RX)                        ->                         PC0 (TX)
D1 (TX)                         ->                         PC1 (RX)
Once the connection is done upload the code for sensors using Arduino IDE. The code is added the GitHub Repository which can be found in the code section. In the case of Microchip, export the project from ATMEL start.

 

 

Select the solution configuration as release and debugger as UDPI as nEDBG.

 

 

Finally, press the green arrow next to Solution configuration to start the program. Note: Make sure that the program is properly uploaded without errors, i.e. you'll can find the writing process in the output dialog.

Step 5: Setting Up the Google Cloud for Publish and Subscribe

Create a new function in the Google Cloud Functions.Set the following parameters:
  •     Trigger -  Cloud Pub/Sub
  •      Topic - AVR-IOT

 

 

 

 

It automatically generates the code for PUB/SUB functions.

 

 

 

Step 6: Enclosure

I had used an Acrylic enclosure for this project.

First, I placed all the circuitry inside the enclosure and screw it firmly.

I made a small opening for the Neopixel Ring and for the Light and Temperature sensor.

Finally, all the screw are firmly mounted and the power cable is inserted via a slot.

 

 

 

Step 7: Let's See It Working

You can find the data is being published on the Google Cloud.

This data which is logged can be display on either a website or with a mobile application.

 

 

 

Video:

Code Repo: https://github.com/Rahul24-06/Real-time-Laboratory-Monitoring

Give a thumbs up if it really helped you and do follow my channel for interesting projects.

 

If you faced any issues in building this project, feel free to ask me. Please do suggest new projects that you want me to do next.

Share this video if you like.

Blog - https://rahulthelonelyprogrammer.blogspot.com/

Github - https://github.com/Rahul24-06

Instagram - https://www.instagram.com/rahul_khanna_d/

Happy to have you subscribed: https://www.youtube.com/c/rahulkhanna24june?sub_confirmation=1

Thanks for reading!