This is the public access version of the University of Michigan Radiological Health Engineering Laboratory Do-It-Yourself Geiger-Muller Device code. This code is built to run on a Raspberry Pi Zero W with Bluetooth enabled using the UMRHE DIYgm Board and Raspbian.
Below is a description of how to set up the raspberry pi with the DIYgm software. Before that is done it may be helpful to build your DIYgm. There are video tutorials that will be helpful to look at. We are working on a written Wiki and will hopefully have that soon; however, the video tutorials will always be our first recommendation.
Before installing the software make sure you have updated your raspberry pi. To do this open up the terminal (">_" in the toolbar) and type sudo apt-get update
This software requires python-bluez for Buster and pip3 pybluez.
You may install these on the Raspberry Pi using:
sudo apt-get install python-bluez
sudo pip3 install pybluez
Now install the software with:
git clone https://github.com/UMRHELab/DIYgm
The final step after setting up Bluetooth is to type:
cp -R DIYgm/rpi-only/* .
There exists an optional mobile application for use with the DIYgm software for IOS or Android that links through Bluetooth.
Raspberry Pi software for Bluetooth connection to Mobile Applications
-
First we need to install the pybluez dev library, which will let the Pi connect to the app via Bluetooth. Type:
sudo apt-get install libbluetooth-dev
into the Terminal and press Enter. -
We now need to edit the newly installed software to make it compatible with the Pi. After installation,
type:sudo nano /etc/systemd/system/dbus-org.bluez.service
and hit Enter. You should now be editing a text file. -
Use the arrow keys to go to the line
ExecStart=/usr/lib/bluetooth/bluetoothd
. Go to the end of the line and add--compat
to the end. It should now sayExecStart=/usr/lib/bluetooth/bluetoothd --compat
. Then, press Ctrl+X, Y, and enter. This should end the editing. -
We then need to reload some parts of the Pi:
a. Typesudo systemctl daemon-reload
and press Enter.
b. Typesudo systemctl restart bluetooth
and press Enter.
c. Typesudo chmod 755 /var/run/sdp
and press Enter. -
To get to the base directory, where we will install our application files, type:
cd /
-
To get the mobile-app files from inside the folder, type in:
sudo cp -R /home/pi/DIYgm/mobile-app/* .
(including the period) -
We need to install node.js, which will let the Pi connect to the mobile apps via Bluetooth. To do this, type:
sudo tar -xf node-v4.3.1-linux-armv6l.tar.gz
(Tip: press Tab to autocomplete the filename) -
Type
sudo service bluetooth stop
to turn off the Pi’s Bluetooth for now. -
Node.js has already been downloaded as one of the DIYgm files, so we now just have to move it to a system folder. Type
cd node-v4.3.1-linux-armv6l
and press Enter. -
Type
sudo cp -R * /usr/local
and press Enter. -
Restart the Pi’s Bluetooth by typing
sudo service bluetooth start
and pressing Enter -
Type
cd /
to get back to the main directory -
You may want to change the name of your Raspberry Pi so you can recognize it in the mobile app. To do this, type:
sudo nano name.txt
Replace “Raspberry-Pi-DIYgm” with your preferred name for the Pi. -
We now need to tell the Raspberry Pi how to run the app, to do this we will type:
a.sudo chmod +x startup.sh
b.sudo chmod +x discoverable.sh
-
Now we are all set to run the app with the Raspberry Pi!
-
After downloading the application to your mobile device, all that is left to do is input the command:
sudo ./startup.sh
When you are finished with the application, you can either remove power from your raspberry pi, or hit ctrl + C on your keyboard to stop the software.
For IOS you must install the test flight application prior to downloading the DIYgm app. You can do this by either searching for the Test Flight application in the app store, or clicking the link below on your mobile device.
Once you have Test Flight downloaded, go to the DIYgm on IOS Download Page.
For android you must download and install the DIYgm APK.
Download the apk file on your mobile device.
Run the apk file on your Android phone to install the app
If you want the DIYgm app to run on your Raspberry Pi when you power it on instead of starting it manually, you should set up a cron job.
Crontab is a software built in to raspberry pi that will run commands on any sort of schedule. We will add a cron job to start the DIYgm software any time the Raspberry Pi reboots.
-
to get to Crontab type:
sudo crontab -e
-
crontab should ask you which text editor you want to use, you want to choose "nano"
(Tip: Crontab will also draw an arrow to it telling you it's the easiest). -
you should be in a text editor now, you'll want to use your arrow keys to scroll down to the first empty line past the #'s
-
When in the empty line type:
@reboot /./auto-launch.sh
-
You can now close nano by hitting ctrl+X, Y, and enter, one after another.
-
The last thing to do is to type
sudo chmod +x auto-launch.sh
Your Raspberry Pi is now setup to run the DIYgm software the moment it starts up!