tutorials:it:microcontroller_environmental_sensor

This is an old revision of the document!


Microcontroller Environmental Sensor System

In the interest of storing analytical data about environmental stimuli in and around the buildings at Kuckucksmuehle, an environmental sensor system has been created.

The sensor system measures:

  1. temperature
  2. humidity
  3. light level

The system can subsequently can send this data via wireless network connection to central data store.

  • A light-dependent resistor (LDR) to track changes in light level in the immediate environment of the sensor
  • A DHT11 sensor to gather both temperature and humidity readings from the immediate environment of the sensor
  • An ESP8266 module, called 'NodeMCUv2' for 2 purposes:
    1. To act as the central microntroller interpreting readings from all sensors (LDR & DHT11)
    2. A wireless networking device which can connect to a router in a LAN configuration and send pre-formatted data to specific ports

In terms of software the program operating chip is C++ adapted from a previous project published by Ben Picco: BlinkenDisplay. The software uses gcc 'make' functionalities to compile and flash the chip.

A schematic which is representative of the system including the microcontroller is shown here:

  1. Ensure that you have all necessary componentry as detailed by the schematic above:
    • Wires
    • NodeMCU v2 module
    • Light-dependent-resistor
    • DHT11 module
    • 2x 10kΩ resistors
    • 1x USB cable (MicroUSB v2 –> USB type A)
  2. Arrange the components on a breadboard as per the schematic
  3. Clone repoitory External Link
  4. Connect the usb cable between your workstation and the NodeMCU v2 module
  5. Open a terminal (Operating System dependent) and run './prepare.sh' in the cloned directory. Ensure there are no failures reported
  6. Run 'make' to ensure all files compile correcttly. Ensure there are no failures.
  7. Run 'make upload' to flash the NodeMCU v2 device with the program
  8. Use a program like 'NetCat' to monitor and print out incoming packets going to a specific port over LAN and print them out to screen on the terminal. Listen on port 1337 as this is the port designated within development as a port to test the transmission on.
    • N.B: if you do not have 'NetCat' you can download it with common package managers such as 'homebrew' (OSX), 'Chocolatey' (Windows), 'apt-get' (Debian-based Linux)
  • tutorials/it/microcontroller_environmental_sensor.1551041036.txt.gz
  • Last modified: 2019/02/24 21:43
  • by srmes