Commit d001b698 authored by Andreas Egger's avatar Andreas Egger
Browse files

Update Docs “data-sources/ambient-sensors/index”

parent e3fb5e3f
Loading
Loading
Loading
Loading
Loading
+12 −22
Original line number Diff line number Diff line
@@ -9,24 +9,24 @@ summary: Overview of the used sensors

Several ambient sensors were installed in the room to provide both discrete and continuous sensor data. Each sensor was connected to a separate Raspberry Pi 3B+.

| ID                                                                                                                                              | Sensor Type                 | Description                                                                                | Height  | Position (x, y) |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------ | ------- | --------------- |
| reed_switch_door                                                                                                                                | Reed switch                 | Type: Discrete sensor, Location: Door                                                      | 2.03 m  | 0 m x 1.18 m    |
| | reed_switch_mouse_cupboard |
| -------------------------- |                                                                                   | Reed switch                 | Type: Discrete sensor, Location: Mouse cupboard                                            | 1.165 m | 1.18 m x 7.50 m |
| | | reed_switch_keyboard_cupboard |
| ----------------------------- | |
| ------------------------------------------------------------------- | | Reed switch                 | Type: Discrete sensor, Location: Keyboard cupboard                                         | 1.165 m | 2.03 m x 7.50 m |
| distance_sensor_laptop_shelf                                                                                                                    | Distance sensor             | Type: Continuous sensor, Location: Laptop shelf, Model: Ultrasonic distance sensor HC-SR04 | 1.52 m  | 0 m x 6.38 m    |
| temp_hum_sensor_window                                                                                                                          | Temperature/humidity sensor | Type: Continuous sensor, Location: Window, Model: Temperature and humidity sensor DHT11    | 1.84 m  | 5.50 m x 3.75 m |
| ID                                                                   | Sensor Type                 | Description                                                                                | Height                                             | Position (x, y) |                 |
| -------------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------- | --------------- | --------------- |
| reed_switch_door                                                     | Reed switch                 | Type: Discrete sensor, Location: Door                                                      | 2.03 m                                             | 0 m x 1.18 m    |                 |
|                                                                      | reed_switch_mouse_cupboard  |                                                                                            |                                                    |                 |                 |
| \--------------------------                                          |                             | Reed switch                                                                                | Type: Discrete sensor, Location: Mouse cupboard    | 1.165 m         | 1.18 m x 7.50 m |
|                                                                      |                             | reed_switch_keyboard_cupboard                                                              |                                                    |                 |                 |
| \-----------------------------                                       |                             |                                                                                            |                                                    |                 |                 |
| \------------------------------------------------------------------- |                             | Reed switch                                                                                | Type: Discrete sensor, Location: Keyboard cupboard | 1.165 m         | 2.03 m x 7.50 m |
| distance_sensor_laptop_shelf                                         | Distance sensor             | Type: Continuous sensor, Location: Laptop shelf, Model: Ultrasonic distance sensor HC-SR04 | 1.52 m                                             | 0 m x 6.38 m    |                 |
| temp_hum_sensor_window                                               | Temperature/humidity sensor | Type: Continuous sensor, Location: Window, Model: Temperature and humidity sensor DHT11    | 1.84 m                                             | 5.50 m x 3.75 m |                 |

{{< figure src="all_sensor_pos.png" alt="Sensor positions." caption="Sensor positions" >}}

## Reed Switches

A reed switch operates by means of an applied magnetic field. Reed switches were installed on cupboard doors and the entrance door to monitor when they were opened and closed. This setup helps tracking access to stored IT assets and to observe the door. An event was recorded every time the status of the switch changed from close to open or vice versa. [](https://docs.sunfounder.com/projects/euler-kit/en/latest/component/component_reed.html)
A reed switch operates by means of an applied magnetic field. Reed switches were installed on cupboard doors and the entrance door to monitor when these were opened and closed. This setup helps tracking access to stored IT assets and to observe the door. An event was recorded every time the status of the switch changed from close to open or vice versa.[](https://docs.sunfounder.com/projects/euler-kit/en/latest/component/component_reed.html)

### Reed Switches at Mouse and Keyboard Cupboards (rsmk and rskc)
### Reed Switches at Mouse and Keyboard Cupboards

{{< figure src="beacon-reedswitch.jpg" alt="Reed switch mounted at the keyboard cupboard for detecting door opening and closing." caption="Reed switch mounted at the keyboard cupboard for detecting door opening and closing" >}}

@@ -60,8 +60,6 @@ now = datetime.now()
date_time = now.strftime("%Y%m%d_%H%M%S")
file_path = "/home/set02/Desktop/sensordata/" + "reed_switch_2_" + date_time + ".csv"

endpoint = "https://ntfy.dtdi.de/solve_for_x_rs2"

f = open(file_path, "a")
f.write("time, reed_switch_state" + "\n")
os.fsync(f)
@@ -90,10 +88,6 @@ while(True):
        os.fsync(f)
        f.close()
        #data_str = curr_time + ",reed_switch_closed"
        #try:
        #    requests.post(endpoint, data = data_str.encode(encoding='utf-8'))
        #except:
        #    print("reed_switch_closed")
        blink_led(2, 0.1)
        previous_state_closed = True
    elif not current_state_closed and previous_state_closed:
@@ -103,10 +97,6 @@ while(True):
        os.fsync(f)
        f.close()
        data_str = curr_time + ",reed_switch_opened"
        #try:
        #    requests.post(endpoint, data = data_str.encode(encoding='utf-8'))
        #except:
        #    print("reed_switch_opened")
        blink_led(2, 0.1)
        previous_state_closed = False
    sleep(0.5)