README.md 6.58 KB
Newer Older
ebonvin's avatar
ebonvin committed
1
2
# rpi-vibration-analysis

Eric Bonvin's avatar
Eric Bonvin committed
3
RaspberryPi powered automatic vibration monitoring station.
4

Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
5
To-do:
Eric Bonvin's avatar
Eric Bonvin committed
6
- Troubleshoot/fix/test writing to influxDB.
Eric Bonvin's avatar
Eric Bonvin committed
7
- Consider changing the service to restart automatically on failure with `Restart=always`, see [here](https://serverfault.com/questions/252137/how-to-automatically-restart-a-service-on-failure-in-linux)
8

Eric Bonvin's avatar
Eric Bonvin committed
9
## Vibration monitoring station: Instructions
Eric Bonvin's avatar
Eric Bonvin committed
10
![vibration station control panels](VibrationStation.jpg)
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
11
12
13
14
15
16
17
18
19
20
21
22
23

### Configuration files and output files
The vibration station loads its measurement parameters from config files stored on Cerberous, a network file storage system hosted in our lab. The recorded data is saved to Cerberous as well. Therefore, if you want to use the built-in DAQ to measure data, **it is imperative that the vibration station has a conenction to the network.**

#### Connecting to Cerberous
In your file explorer of choice, connect to `cerberous.ee.ethz.ch`. The vibration data is stored in the subfolder `BuildingVibration`. By default, members of our group have read-only access to this folder. If you need write access, e.g. to modify a config file, you should connect with the `vibrationLogger` credentials. The corresponding password can be found in our group OneNote. (This repository is public, I don't want to share the password here)

#### File structure of Cerberous
The `BuildingVibration` folder contains 4 main subfolders:
- `config` contains the configuration files for the measurement parameters
- `d` and `m` contain the automated measurement data done by the D-floor station and M-floor station respectively
- `custom` contains manual measurement data

Eric Bonvin's avatar
Eric Bonvin committed
24
### Configuration of measurements
Eric Bonvin's avatar
Eric Bonvin committed
25
If you want to modify the configuration of a measurement, connect to Cerberous and edit the corresponding file in the `config` folder (auto/manual measurements, d/m floor station). Then, toggle the `Auto`/`Manual` switch. This prompts the vibration station to reload its settings from Cerberous. 
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
26

Eric Bonvin's avatar
Eric Bonvin committed
27
Once again, **the station must be connected to the network** or else it won't be able to read the config files from or save data to Cerberous.
Eric Bonvin's avatar
Eric Bonvin committed
28

Eric Bonvin's avatar
Eric Bonvin committed
29
30
31
32
33
34
Most fields to be edited are self-explanatory. The measurement related ones are:
- `measurement_time`: duration of measurement in minutes
- `settling_time`: time to wait between button press and start of measurement (mainly relevant for automatic measurements, where the pre-amp needs some time to settle)
- `sampling_rate`: sampling rate of DAQ in Hz. Going beyond 1000Hz doesn't make much sense since the amplifier low-pass filters at 450Hz.
If you want to restore a file to its default state, simply copy the corresponding config file in this repository.
- `measurement_period`: Time between measurements. Only applies to automatic measurements. 
Eric Bonvin's avatar
Eric Bonvin committed
35

Eric Bonvin's avatar
Eric Bonvin committed
36
37
### Automated measurements of building vibrations at regular intervals
1.	Connect the station to power and to the network
Eric Bonvin's avatar
Eric Bonvin committed
38
2.	Verify that the accelerometer settings are correct: `On`, `450Hz`, `1000V/g`
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
39
3.	Set the control switch to `Auto` (top position). One LED should be on at all times. If either both or neither are on, something's wrong.
Eric Bonvin's avatar
Eric Bonvin committed
40
41
42

### Manual measurements using the built-in DAQ
1.	Connect the station to power and to the network
Eric Bonvin's avatar
Eric Bonvin committed
43
2.	Verify that the accelerometer settings are correct: `On`, `450Hz`, `1000V/g`
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
44
45
3.	Set the control switch to `Manual`. One LED should be on at all times. If either both or neither are on, something's wrong
4.	Press the Record button to launch a measurement using the settings found in `config_manual.json` (See section [Configuration of Measurements](#Configuration-of-measurements) on how to edit settings)
Eric Bonvin's avatar
Eric Bonvin committed
46
5.	When you’re done, turn off the accelerometer (switch to off) and shutdown the station (see below)
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
47
6.	Your measurements can be found on Cerberous, in the folder `/BuildingVibrations/custom`, with the filename specified in `config_manual.json`
Eric Bonvin's avatar
Eric Bonvin committed
48
49
50
51
52
53
54

### Manual measurements using an external DAQ
1.	Shutdown the station (see below)
2.	Disconnect the station from power and network
3.	Choose your accelerometer settings on the front panel
4.	Use the BNC output at the back of the station to connect your DAQ

Eric Bonvin's avatar
Eric Bonvin committed
55
56
### Charging the batteries
If the batteries ever get completely discharged, you may want to recharge them without ever measuring. When the station
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
57
is in the `Ready` state, press and hold the record button for 2 seconds to put the station into a charging state.
Eric Bonvin's avatar
Eric Bonvin committed
58
Both LEDs should turn on. In this state, the batteries are constantly connected to the charger. To exit this state, 
Eric Bonvin's avatar
Eric Bonvin committed
59
toggle the `Auto`/`Manual` switch.  
Eric Bonvin's avatar
Eric Bonvin committed
60
Note that under normal operation, this charging mode shouldn't be necessary.
Eric Bonvin's avatar
Eric Bonvin committed
61
62

### Shutting down the station
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
63
64
When the station is in the `Ready` state, press and hold the record button for 2 seconds to put the station into
its charging state. Press and hold the button for 2 seconds again to shut down the station.
Eric Bonvin's avatar
Eric Bonvin committed
65
66
67
68
Alternatively, connect to the station via SSH, and shut down with 
sudo shutdown now

### Other things you may want to do:
69
70
71
72
#### Interrupt a measurement
There's currently no simple way to do that. If you really care about interrupting a measurement, you should connect to the station remotely, and restart the `vibration-logging` service by running `sudo service vibration-logging restart` in a terminal


Eric Bonvin's avatar
Eric Bonvin committed
73
#### Connect to station remotely
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
74
Connect to the station via SSH (e.g. `ssh pi@raspberry-pi-02.ee.ethz.ch` in a terminal) or via VNC Viewer
Eric Bonvin's avatar
Eric Bonvin committed
75
76
77
78
79
(free app from RealVNC). 
The log-in details are listed on the group OneNote.

#### Verify the status of the python program
1.	Connect to station remotely
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
80
2.	In a terminal, type in the command: `service vibration-logging status`
Eric Bonvin's avatar
Eric Bonvin committed
81
82
83

#### Verify the logs
1.	Connect to station remotely
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
84
2.	In a terminal, type in the command: `tail -f ./Documents/vibration-logger.log`
Eric Bonvin's avatar
Eric Bonvin committed
85
86
87

#### Use different config files
1.	Connect to station remotely
Eric Bonvin's avatar
Tweaks    
Eric Bonvin committed
88
2.	Edit the config file names (`config_file_auto` or `config_file_manual`) in `/home/pi/Documents/rpi-vibration-analysis/main.py`
Eric Bonvin's avatar
Eric Bonvin committed
89
90
91
92

### Other notes
Requires: [daqhats](https://github.com/mccdaq/daqhats),
[influxdb-client-python](https://github.com/influxdata/influxdb-client-python), and the usual
ebonvin's avatar
ebonvin committed
93
suspects (`numpy`, `h5py`, `scipy`, `pandas`)
Eric Bonvin's avatar
Eric Bonvin committed
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

### Installing this on a new raspberry pi
1. Clone this repo somewhere on the raspberry pi's home directory
2. Create a service file in `/lib/systemd/system/vibration-logging.service` with the following contents:
```buildoutcfg
[Unit]
Description=Logs building vibration to cerberous.
After=multi-user.target

[Service]
Type=simple
User=pi
ExecStart=/usr/bin/python3 /home/pi/Documents/rpi-vibration-analysis/main.py
Restart=on-abort

[Install]
WantedBy=multi-user.target

```

3. Enable the service so that it starts automatically at boot with `systemctl enable vibration-logging`