This is an old revision of the document!


Smart Home Bluetooth System

Student: Ionescu Sergiu, ACES
Code archive:
Presentation:

1. Introduction. Description of the project

The purpose of this project was to make a basic smart home system using wireless communication between the nodes. The architecture is based on the IoT level 5. Furthermore, the project constitutes the basics for a bigger future project. I will basically have one node monitoring the living room and one node monitoring the kitchen ( so far ). They will communicate with a gateway node using bluetooth, which is a raspberry pi pico w system at its base. However, the raspberry pi pico was not powerful enough to maintain the control for the entire system…so I needed the help of other 2 picos. In the future I plan to replace the picos with an Intel Nuc or a Raspberry Pi. The data that was collected was stored in a Google Firebase and could be monitorized accesing the database using any PC or using an Android app that I made using MIT APP inventor.

The 2 nodes that are monitoring the rooms have the following utilities :

  • the kitchen node monitors the temperature, humidity and the level of gas in the room
  • the living room node monitors the temperature, humidity, light intensity and also can control a LED strip in various ways, including lighting up the strip according to the distance you are at. Also there is another functionality that notifies me whether I got new mail, and it does it by controlling an LED.

2. Hardware components and wiring

The hardware components needed for this project are:

  • 3 x Raspberry Pi PicoW
  • 2 x Arduino Nanos
  • 4 x HC-05 Bluetooth Modules
  • 3 x Breadboard
  • Jumper wires
  • 220 Ohm and 10 kOhm resistors
  • LED Strip
  • Micro and Mini USB data cable
  • Android Smartphone to run the monitoring application
  • Sensors
    • HC-SR04 ultrasonic distance sensor.
    • DHT11 - temperature and humidity sensor.
    • TEMT6000 - light intensity sensor.
    • MQ135 - Gas Sensor

 Controllers

               fig.1 Controllers(Raspberry Pi PicoW, Arduino Nano, HC-05 Module)

 Sensors

                   fig.2 Sensors(HC-SR04, DHT11, TEMT6000, MQ135, LED-Strip)

The electric scheme of the project that I did is the following (done in https://www.circuit-diagram.org/editor/):

Controllers brief overview:

  • Raspberry Pi PicoW. It is a low-cost, high-performance microcontroller board with flexible digital interfaces. It has a RP2040 microcontroller, Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz, 264kB of SRAM, and 2MB of on-board flash memory, Low-power sleep and dormant modes, 26 × multi-function GPIO pins, 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels, Accurate clock and timer on-chip, Temperature sensor, Accelerated floating-point libraries on-chip, 8 × Programmable I/O (PIO) state machines for custom peripheral support. It works on 3V3 levels.
  • Arduino Nano. It is microcontroller board based on the Atmega328P. The board has 14 digital input/output pins (6 of which can be used as PWM outputs), 8 analog inputs and a 16Mhz quartz crystal. It works on 5V levels.
  • HC-05 Bluetooth Module. It is a small, low-cost device that enables wireless communication between devices using the Bluetooth Protocol. It can operate in both slave and master modes, and is commonly used in projects such as remote control systems, wireless data transfer and wireless sensor networks. It can be easily interfaced with a microcontroller, using the UART protocol. It can be powered from 3.6 to 6 volts, because it comes on breakout board which contains a voltage regulator. However, the logic voltage level of the data pins is 3.3V. Because it is a bluetooth module it can communicate with only one slave/master at once. In order to pair it with another module either as a master or as a slave, we must use AT commands to do so.

Sensors brief overview:

  • HC SR04. It's a device that uses ultrasonic waves to measure distance to an object. It transmites high-frequency sounds and measures the time it takes for the sound to bounce back to the sensor, which is then used to calculate the distance to the object. The sensor consists of an ultrasonic transmitter (Trig pin), a receiver (Echo Pin) and a control circuit. It has an operating voltage of 5V and operating current of 15mA.

  • DHT11. It's a basic, low cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air. The sensor also includes an 8-bit SOIC-14 packaged IC. This IC measures and processes the analog signal using stored calibration coefficients, converts the analog signal to digital, and outputs a digital signal containing the temperature and humidity. The values are provided through a single-wire digital interface, making it easy to interface it with a microcontroller or other controller circuit. DHT11 can measure temperatures from 0°C to 50°C with an accuracy of ±2°C. In addition, the DHT11 sensor can measure relative humidity from 20 to 80% with an accuracy of 5%. It has an operating voltage from 3V to 5V and operating current of maximum 2.5mA.
  • TEMT6000. The TEMT6000 is a ambient light sensor which is a small, surface-mount device that detects the intensity of ambient light. It is designed to detect visible light in the range of 390–700 nm, and convert it into an electrical signal output (the S pin). The sensor is based on a phototransistor that changes its electrical resistance based on the amount of light it receives.It is suitable for a variety of applications such as automatic lighting control, display backlight control, and camera light detection. This sensor can handle voltages from both 5V and 3.3V devices.
  • MQ135. The MQ135 is a gas sensor that is designed to detect a wide range of gases, including ammonia (NH3), sulfur dioxide (SO2), carbon monoxide (CO), and volatile organic compounds (VOCs) in the air. It is based on a metal oxide semiconductor (MOS) that is sensitive to the target gases. The sensor generates an electrical current that is proportional to the concentration of the target gas. The MQ135 sensor can detect gases in a concentration range between 10 to 1000ppm. It is commonly used in air quality monitoring systems, indoor air quality monitoring, and other applications where the detection of harmful gases is important.

3. Software implementation and the overall logic


The implementation consists of 6 main parts :

  • The monitoring of the first room. The first room which would be the kitchen has the DTH11 and MQ135 sensors installed. Thus, we are monitoring the temperature, humidity and gas levels in the room. After the values are read, they are sent via Bluetooth to the Pico1. For each sensor value I have used 2 bytes, thus sending a series of 8 bytes every 2 seconds after each read.
  • The monitoring of the second room. The second room monitors the humidity, temperature and light intensity. Again I am using 2 bytes for each value thus sending 8 bytes every 2 seconds after each read. Furthermore, the microcontroller also has a ultrasonic sensor and a LED strip connected to it. After reading the commands from the PICO2, it can decide in which mode the LED strip is operated. So far, I can have the LED's lighting up when you are close to them ( thus using the distance sensor ), or have them lighting up and off at different frequencies or intensities.
  • Sending data to the Firebase and receiving it with PICO1.
  • Reading data from the Firebase with PICO2 and sending commands with PICO2
  • Reading data from the Firebase with the Android App and sending commands

  • Lighting up when receiveing email with PICO3

A little description of the protocol used :

  • webSockets
  • iMap

4. Demonstration

A video demonstrating the functionality of this project can be seen in the video from this archive:

5. Difficulties

It was hard bla bla bla

6. Overlook and conclusion

The proposed project has reached its goal. I understood how ESP32 board can be used as a web server, and I employed this functionality for creating an interactive and easy way for a user to control multiple LEDs. It could be further improved by adding more security, using a HTTPS connection. Moreover, it could also be scaled up to more complex installations or adding different functionalities such as automatically turning on the LEDs when the light intensity is low and consulting their level of brightness through a web server.

7. Resources

iothings/proiecte/2022/smart_home_bluetooth_system.1674148255.txt.gz · Last modified: 2023/01/19 19:10 by sergiu.ionescu3107
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0