https://github.com/wissance/labwatcher
Scientific laboratory processes automation using Raspberry Pi 2 as a central management system
https://github.com/wissance/labwatcher
automation-api laboratory-automation mossbauer mossbauer-spectroscopy raspberry-pi-3 raspberry-pi-projects scientific scientific-laboratory software-control software-external
Last synced: about 2 months ago
JSON representation
Scientific laboratory processes automation using Raspberry Pi 2 as a central management system
- Host: GitHub
- URL: https://github.com/wissance/labwatcher
- Owner: Wissance
- License: apache-2.0
- Created: 2022-06-17T07:58:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-08-15T19:33:31.000Z (about 2 months ago)
- Last Synced: 2025-08-15T21:46:39.777Z (about 2 months ago)
- Topics: automation-api, laboratory-automation, mossbauer, mossbauer-spectroscopy, raspberry-pi-3, raspberry-pi-projects, scientific, scientific-laboratory, software-control, software-external
- Language: C#
- Homepage: https://wissance.github.io/LabWatcher/
- Size: 3.13 MB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wissance.MossbauerLab.Watcher
A set of tools that helps to **automate measure/control processes of any Scientific / Industrial Lab**. Current solution is using for:
* **collect** measurements **data** produced by **another our software** working over existing scientific equipment (`mossbauer spectrometer`);
* **notify** about **measurements state** and send **data** itself over multiple channels (`e-mail`, `Telegram`)
* **watch events and notify** about possible issues;
* **provides Web interface** to obtain stored spectra even any intermediate;
* **run an AI tools** with computer vision (if future versions).This software **is a laboratory specific** and made as example **if you would like to automate your laboratory / industry** please **contact us** using email in our organization info.




Mossbauer laboratory automation tool controls spectra measurements from `SM2201 Mossbauer spectrometer` and watches state of other equipment.
### Key features
* `SM2201` spectrometer controlled by software that is running on **`Windows 98`**
* ***Target Platform where `Wissance.MossbauerLab.Watcher` is running - `Raspberry Pi (v2)` + `Raspbian` as OS***## 1. Watching objects and notifications
### 1.1 Watching objects
* `Messbauer spectra` accumulation process (monitoring auto save process) from `SM2201` spectrometer (controll by date+time)
of file last change (on `Windows98` machine system ***clock must be set right***)### 1.2 Notifications
* Send fresh (-2h of Date,Time) spectra by e-mail and Telegram bot (*NOT IMPLEMENTED YET*)
* Analyze power loss (*NOT IMPLEMENTED YET*)## 2. Configuration
There are 2 run profiles (`Development` and `Production`) and 2 possible configs variants of `Wissance.Mossabuer.LabWatcher`:
1. Running on Windows allows to use Net Directory class with network path to files && folders, therefore `SM2201` config section
looks like:
```csharp
"Sm2201SpectraStoreSettings": {
"Address": "192.168.10.212",
"Domain": "MOSSBAUERLAB",
"Folder": "Autosaves",
"UserCredentials": null
}
```
2. Running on any Linux requires to mount Windows shared folder using `cifs.mount`, because `Directory` in Linux doesn't
understand Windows network Path, therefore `SM2201` config section looks like:
```csharp
"Sm2201SpectraStoreSettings": {
"Address": "",
"Domain": "MOSSBAUERLAB",
"Folder": "/mnt/sm2201/dev",
"UserCredentials": null
}
```Solution could be run either on `Windows` or `Linux`
### 2.1 Running solution on Raspberry Pi
1. Configure SMB (/etc/samba/smb.conf) as follows, add to `global` section:
* `client min protocol = NT1`
* `client lanman auth = yes`
* `client ntlmv2 auth = no`
To check is there access to shared folder using `smbclient` use following command
```bash
smbclient //MICHAEL/Autosaves -m NT1 -w MOSSBAUERLAB
```
Where:
* `MICHAEL` - computer name
* `MOSSBAUERLAB` - workgroup name
* `AUTOSAVES` - name of shared folder
2. To watch save process we monitor windows shared folder but in linux we have to mount shared folder using `cifs`(All names must be Uppercase):
`sudo mount -t cifs -o user=guest,pass=,vers=1.0,sec=none,domain=MOSSBAUERLAB,ip=192.168.10.217,servern=MICHAEL //MICHAEL/AUTOSAVES /mnt/sm2201/dev`
Where:
* `MICHAEL` - computer name
* `MOSSBAUERLAB` - workgroup name
* `AUTOSAVES` - name of shared folder
## 3. How to run
### 3.1 Run once
1. Configure `appsettings.Production.json` before run and set `Address` to "" and set `Folder` to mount point if you are running
solution on `Raspberry Pi`
2. Run solution `dotnet Wissance.MossbauerLab.Watcher.Web.dll --environment=Production`### 3.2 Run as a service
To run `Wissance.MossbauerLab.Watcher.Web` as a service it should be configured as `systemd` service:
1. Create group - `sudo groupadd mossbauer`
2. Create user - `labwatcher - sudo useradd -r -g mossbauer -d /usr/local/sbin/labwatcher -s /sbin/nologin labwatcher`
3. Create labwatcher.service file with following content:
```[Unit]
Description=Wissance.MossbauerLab.Watcher service
After=syslog.target network.target
Before=httpd.service
[Service]
WorkingDirectory=/usr/local/sbin/labwatcher/app
User=labwatcher
Group=mossbauer
LimitNOFILE=102642
PIDFile=/var/run/mossbauer/labwatcher.pid
ExecStart=dotnet /usr/local/sbin/labwatcher/app/Wissance.MossbauerLab.Watcher.Web.dll --environment=Production
StandardOutput=syslog
StandardError=syslog[Install]
WantedBy=multi-user.target```
4. Change directory owner to `mossbauer:labwatcher` - `sudo chown -R labwatcher:mossbauer /usr/local/sbin/labwatcher`
5. Copy `labwatcher.service` file to `/etc/systemd/system`
6. Execute `sudo systemctl daemon-reload`
7. Execute `sudo systemctl enable labwatcher`
8. Execute `sudo systemctl start labwatcher`## 4. Troubleshooting
1. If we are mount automatically and got error like:
```
Jan 08 18:14:32 LabControl mount.sh[495]: mount error(101): Network is unreachable
Jan 08 18:14:32 LabControl mount.sh[495]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) ...
```
there are many solutions but for me helpful was adding `sleep 20s` in `.sh` script prior to `mount`## 5. Web API
There are following endpoints to receive/manage state from browser or other clients:
* `GET /api/Spectrum` - list all spectra from database;

* `GET /api/Spectrum/{id}` - return one spectrum by its id;
* `GET /api/Spectrum/{id}/samples` - return spectrum data including list of all intermediate measurements;
* `GET /api/Spectrum/{id}/samples/{sampleName}/spectrum` - return spectrum with file name = `{sampleName}`
## 6. Contributors