In this project, we aim to create a compact weather station that communicates with an Android app using Arduino and Bluetooth technology.
The weather station, powered by Arduino, will consist of a temperature sensor, a humidity sensor, and an ambient light-level sensor. To enable wireless connectivity, we will incorporate a Bluetooth Low Energy (BLE) module into the design, allowing the Android app to retrieve data without any physical connections.
For the Android app, we will design a user-friendly interface featuring a button that grants access to all the weather station measurements. Each measurement will be displayed in an enlarged text view, making it easy to read and interpret the data.
Hardware and software requirements
To start this project, you'll require an Arduino Uno board and a BLE module. We opted for the Adafruit nRF8001 chip due to its convenient Arduino library and pre-existing Android app examples for module control. In the previous chapter, we utilized the same module.
For sensor functionality, the DHT11 was chosen to measure both temperature and ambient humidity. The DHT11 is a digital temperature and humidity sensor that seamlessly integrates with Arduino. Among the various Arduino-compatible sensor options available, we selected the DHT11 for its ease of interfacing. To enable the sensor's compatibility with Arduino, a 4.7K Ohm resistor will also be needed.
We will utilize a photocell in conjunction with a 10K Ohm resistor to gauge the ambient light level. The photocell acts as a variable resistor, altering its resistance based on the intensity of incoming light. It will be connected to the Arduino's analog input, enabling us to measure the ambient light level.
To establish the necessary connections, a breadboard and jumper wires will be required.
Here's a comprehensive list of the hardware components needed for this project, along with corresponding links to find them online:
- Arduino Uno board - Link
- DHT11 sensor and 4.7K Ohm resistor - Link
- Photocell - Link
- 10K Ohm resistor - Link
- Adafruit nRF8001 breakout board - Link
- Breadboard - Link
- Jumper wires - Link
On the software side, you will need the following:
- Arduino IDE - As usual for Arduino projects.
- Arduino aREST library - Found at this GitHub repository.
- DHT library - Required for making measurements from the DHT11 sensor. Found at this GitHub repository.
- nRF8001 Arduino library - Needed for the BLE chip. Found at this GitHub repository.
To install any of these libraries, simply extract the corresponding folder into your Arduino /libraries
directory, or create the /libraries
folder if it doesn't exist yet.
Hardware configuration
We are ready to proceed with the hardware assembly for this project. To guide you, here's a schematic representing the setup:
Next, follow these steps:
Step 1: Breadboard Setup Place the Bluetooth module, the DHT11 sensor, and the photocell on the breadboard.
Step 2: Power Supply Connection Connect the power supply from the Arduino board to the breadboard. For this, attach the 5V output of the Arduino board to the red power rail and the GND to the blue power rail.
Step 3: BLE Module Connection Connect the BLE module to the breadboard. Connect GND to the blue power rail and VIN to the red power rail.
Step 4: SPI Interface Wiring Establish the SPI interface connections as follows:
- Connect SCK to Arduino pin 13.
- Connect MISO to Arduino pin 12.
- Connect MOSI to Arduino pin 11.
Step 5: Connect Control Pins Connect the control pins as follows:
- Connect the REQ pin to Arduino pin 10.
- Connect the RDY pin to Arduino pin 2.
- Connect the RST pin to Arduino pin 9.
Next, let's configure the pins for the DHT sensor:
Step 6: DHT Sensor Power Supply Provide power supply to the DHT sensor:
- Connect the VCC pin to the red power rail on the breadboard.
- Connect the GND pin to the blue power rail.
Step 7: Connect DATA Pin Connect the DATA pin of the DHT sensor to pin number 7 on the Arduino board.
Step 8: Add a Resistor Place a 4.7K Ohm resistor between the VCC and the DATA pin of the DHT11 sensor.
Now, let's proceed with the photocell:
Step 9: Connect the Resistor Connect a 10K Ohm resistor in series with the photocell. Make sure one pin of the photocell and one pin of the resistor are on the same row of the breadboard.
Step 10: Power Supply for Photocell Connect the other pin of the resistor to the blue power rail and the other pin of the photocell to the red power rail on the breadboard.
Step 11: Connect to Arduino Connect the common pin between the photocell and resistor to the analog pin A0 of the Arduino board.
Once you have successfully completed the above steps, your project will be completely assembled.
In the next part of this tutorial series "Bluetooth Weather Station: DHT Sensor testing" we will test the DHT sensor.