Introduction: Weather-Station

About: Student MCT Kortrijk

In this project we will make a weather station that will measure the temperature, humidity and UV index by using Raspberry Pi, Python (coding), MySQL (database) and Flask (web server).


The required components for this project


- Cover cap

- DHT11 humidity sensor

- DS18B20 temperature sensor

- GUVA-S12SD UV sensor

- LCD Display

- Servo motor

- MCP3008

- Raspberry Pi 3

- Trimmer

- Total cost is around € 110.

The tool I used:

- Conical drill

- Double-sided adhesive tape

Step 1: Circuit



- VSS to Raspberry Pi’s ground

- VDD to Raspberry Pi’s 5V

- V0 to middle pin trimmer

- RS to GPIO pin

- R / W to Raspberry Pi’s ground

- E to GPIO pin

- D4 to GPIO pin

- D5 to GPIO pin

- D6 to GPIO pin

- D7 to GPIO pin

- A to Raspberry Pi’s 5V

- K to Raspberry Pi’s ground Trimmer

- To Raspberry Pi’s 5V

- To LCD pin V0

- To Raspberry Pi’s ground


- VCC to Raspberry Pi’s 3V3

- GND to Raspberry Pi’s ground

- DAT to Raspberry Pi’s GPIO pin 4

- 470 ohms between VCC and DAT


- VCC to Raspberry Pi’s 3V3

- GND to Raspberry Pi’s ground

- DAT to Raspberry Pi’s GPIO pin 4

-470 ohms between VCC and DAT

Servo motor:

- VCC to Raspberry Pi’s 5V

- GND to Raspberry Pi’s ground

- DAT to Raspberry Pi’s GPIO pin


- VDD to Raspberry Pi’s 3V3

- VREF to Raspberry Pi’s 3V3

- AGND to Raspberry Pi’s ground

- CLK to GPIO pin 11 SCLK

- DOUT to GPIO pin 9 MISO

- DIN to GPIO pin 10 MOSI

- CS to GPIO pin 8 CE0

- DGND to Raspberry Pi’s ground

- CH0 to GUVA-S12SD (UV sensor)

Step 2: DHT11

DHT11 is a digital

temperature and humidity sensor. Output to a digital pin.

DHT11 specifications:

- Operates on: 3.3 - 6V.

- Temperature range: -40 - +80 ºC.

- Temperature accuracy: ± 0.5 ºC.

- Humidity range: 0-100% RH.

- Humidity accuracy: ± 2.0% RH.

- Response time: <3 sec.

Step 3: DS18B20

DS18B20 Sensor Specifications

- Programmable Digital Temperature Sensor.

- Communicates using 1-Wire method.

- Operating voltage: 3V to 5V.

- Temperature Range: -55°C to +125°C.

- Accuracy: ±0.5°C.

- Unique 64-bit address enables multiplexing.

Step 4: LCD

LCD controller with 16 × 2 characters display module with blue

backlight and white characters. 2 lines, 16 characters per line. High contrast and large viewing angle. Contrast adjustable by means of an adjustable resistor (potentiometer / trimmer).

LCD 16 × 2 blue specifications:

- Operates on: 5V

- Adjustable contrast.

- Dimensions: 80mm x 35mm x 11mm.

- Visible display: 64.5mm x 16mm.

Step 5: MCP3008

An analog-to-digital converter or AD-converter (ADC) converts an analogue
signal, for example a speech signal, into a digital signal. The MCP3008 has 8 analog inputs and can be read with an SPI interface on an Arduino, Raspberry Pi, ESP8266 The MCP converts an analog voltage to a number between 0 and 1023 (10 bit).

When using the MCP3008 you need to enable SPI, you can do this by (images added with the steps) :

  1. Typ in the console: sudo raspi-config
  2. This will launch the raspi-config utility. Select “Interfacing Options”
  3. Highlight the “SPI” option and activate .
  4. Select and activate.
  5. Highlight and activate .
  6. When prompted to reboot highlight and activate.
  7. The Raspberry Pi will reboot and the interface will be enabled.

Step 6: Servo Motor

Size: 32 × 11.5 × 24mm (Tabs included) 23.5 × 11.5 × 24mm (Tabs not include)

Weight: 8.5g (Cable and a connector not include) 9.3g ( Cable and a connector included)

Speed: 0.12sec/60degrees (4.8V) 0.10sec/60degrees (6.0V)

Torque: 1.5kgf-cm (4.8V) 2.0kgf-cm (6.0V)

Voltage: 4.8V-6.0V

Connector type: JR type (Yellow: Signal, Red: VCC, Brown:GND)


GUVA-S12SD Sensor Specifications

- Operating voltage: 3.3 V to 5 V

- Output voltage: 0 V to 1 V (0-10 UV index)

- Response time: 0.5 s

- Accuracy: ± 1 UV index

- Wavelength: 200-370 nm

- Consumption: 5 mA

- Dimensions: 24 x 15 mm

Step 8: Case

I used a cover cap for the hull where I drilled 2 holes for the temperature and the uv sensor, the humidity sensor, servo motor and lcd were mounted in 1 of the holes at the top. The cover cap was mounted on a board for a better look

Step 9: Database

Step 10: Code