Skip to content

VivianKuKu/CASA0016_DeskElf_Making-Designing-Building-Connected-Sensor-Systems

Repository files navigation

DeskElf: Indoor Environment Quality sensing & Pomodoro Technique

image

Background

With the blend work model prevailing, office workers spend most of their time inside the buildings as they did before–– but now stay in their homes more than offices. It is proved that indoor environmental quality has a significant influence on staffs’ productivity, health and wellbeing (U.S. Green Building Council, 2014). Unlike commercial buildings, most of the residential buildings have a lack of large-scale IT infrastructure and building-wise environmental controls which makes it hard to deploy state-of-the-art sensors in the building (Graham Coulby et al., 2020).

However, this problem provides a great opportunity to develop a lightweight and portable indoor environmental sensor for people who adopt a flexible working model. DeskElf is born for this need and manages to offer a desktop device helping workers keep productive and healthy at the same time. Besides, DeskElf can serve as an extended service of corporates’ wellbeing programmes, taking care of employees’ working environment just like what they do at the office.

Functionality

image

Building Process

To make DeskElf portable and keep flexible for data application, the data captured by sensors will be sent to the network server–– The Things Network via LoRa gateway. So, The Things Uno board is used, and it is designed based on the Arduino Leonardo board with a microchip LoRa module (RN2483).

image

image

Screenshot 2022-01-09 at 21 41 01

The building process of DeskElf consists of 4 stages from hardware setup, Arduino IDE code, The Things Network setup and the enclosure design and 3d printing.

image

1. Hardware setup

The reason for choosing The Things Uno (Arduino Leonardo) board is due to the data communication concern. Since DeskElf should work functionally wherever users work, its function must be low-power consumption and long-range coverage to reduce users’ hassle in charging and reconnecting. Therefore, the LoRa network, which can deliver a 2 to 3 km-wide coverage from its gateways in the urban area, becomes a feasible choice.

Find out more information about The Things Uno board here: https://www.thethingsindustries.com/docs/devices/the-things-uno/

For indoor environmental quality sensing, LCD is used to display real-time readings of each sensor which allows users to get updated information and take immediate action if they want. Besides, SGP30 and TCS34725 both are connected to The Things Uno board through I2C communication by occupying the SCL/SDA set and pins 2 and 3.

For Pomodoro Technique, the LDR will trigger the countdown timer function when users start working (In this case: Users will plug the FOCUS signage on the lid, changing the amount of light that LDR receives) and the LED will remind users that the working time is up, and it is time to take a break. All components are wired up as below schematic.

image

2. Arduino IDE code

Coding in Arduino IDE is an iterative process that requires several step-by-step testing to ensure the hardware, functions and libraries all work as estimated. To use these sensors and actuators, multiple libraries are needed. Besides, there are six values about indoor environmental quality required to be shown on the LCD, so the automatic screen-scrolling effect is designed by coding.

Refer to the testing files in the repos to see how it works:

  1. test_sgp30_DHT22_LCD
  2. test_tcs34725

Regarding the Pomodoro Technique, instead of using the delay function that will block other codes, the Timer library is adopted to support calling functions in/at/every specified unit of time (Michael Contreras, 2022). Here, the code will call an alert function every 25 minutes whenever the analogue reading of LDR is below 100 caused by the coverage of FOCUS signage. And the alert function will make LED start blinking 5 times.

Refer to the testing files in the repos to see how it works:

  1. test_PomodoroTimer
  2. Timer Library:

(note: You should wire up LDR before testing and the countdown time for the testing file is 5 sec.)

As for The Things Uno board, Serial is reserved for USB CDC communication, while Serial 1 is used for communicating via TTL serial on pin 0 (RX) and pin 1 (TX) which allows communication between The Things Uno and the microchip LoRa module (Arduino). Also, it is important to get the information of the board such as DevEUI (a unique identifier assigned by manufacturer) and AppEUI (a global application ID) in the beginning. And since the bandwidth is a fixed resource that is shared by many devices and there is a limited airtime (LoRa-Developers, 2021), it is necessary to minimize the size of the payload by converting sensor values to unsigned integers––uint16_t––which contains 16 bits for a word. In the end, ttn.sendBytes() is used to send messages with an array of bytes and their size (The Things Network, 2021d).

The setup process includes:

  1. Setup Arduino IDE
  2. Get your Device EUI on Arduino IDE
  3. Create an Account on TTN
  4. Add an Application on TTN
  5. Register your Device on TTN
  6. Activate your Device on Arduino IDE

The step-by-step setup can be found in the Quick Start page on The Things Network

You can find a full Arduino IDE template in the DeskElf_LoRa in the repo.

new.clip.mp4

3. The Things Network Setup

The Things Network (TTN) is a global, open, and crowd-sourced initiative to create an Internet of Things data network over LoRaWAN technology. Apart from setting up for Arduino IDE and TTN account, there are several issues should be considered.

(note: DeskElf uses EU863-870 as it is based in the United Kingdom, you should change it to your frequency plan according to your location)

4. Enclosure Design and 3D Printing

The enclosure of DeskElf contains three parts–– signage, lid and base. The signage allows users to plug in when they start to work, and it will cover the LDR beneath the lid and change the analogue reading of LDR and ultimately trigger the countdown timer function. The lid is used to hold signage, light sensor (TCS34725) and LED. And the base is designed to accommodate The Things Uno board, breadboard and other components with some holes on the walls to keep the circulation of air.

DeskElf is printed by Prusa 3D printer and you can find out the 3D printing files in the repo.

  • .stl: 3D model file format which can be used in Fusion360 or other CAS softwares
  • .3mf: Open source file format which can be used in PrusaSlicer

Reflection

1. Hardware setup

During the hardware setup process, different sensors can be considered to capture indoor environmental quality, for example, PM2.5 is also a good indicator of air quality. Besides, there are various solutions to trigger the Pomodoro technique as well such as RFID or light sensor; However, the choice of solution should be based on its purpose.

2. LoRa setup

During the LoRa setup process, the transmitting interval should be considered to make the most of the resources. It is possible to update data with a longer interval or set up a certain threshold that leads to transmitting sensor value (The Things Network, 2021a).

3. Future extension

DeskElf's mobile App can be used to allow users to set up their comfort settings and it will automatically send alerts when the environment needs to be adjusted. What’s more, sensor data should be analyzed and visualized in a long-term way, making users understand or find out the pattern or potential issue of the quality of their working environment.

Reference