By Waveguide
A sensor dashboard running on a Raspberry Pi to measure, display, and log key performance data for a Tesla Turbine.
This is how you can get this project up an running on your Raspberry Pi.
The minimum hardware requirement is a Raspberry Pi Zero 2, as a quad core CPU is needed to run this smoothly, as well as a monitor with an HDMI input.
Also, the following sensors are required:
- MEAS M32JM-00010B-100PG pressue & temperature sensor (2x)*
- QRD1114 optical sensor (1 or 2)
*Make sure you get the "J" version, as only those have digital output. Check the MEAS M3200 datasheet for more details on the available variations of this sensor.
Click here for the entire bill of materials
This project runs on Raspbian Lite with openbox, and has auto-login to console enabled, so the dashboard opens automatically on powering up the Pi.
Several additional packages were installed, and various customizations were made to the configs, so I highly recommend to use the link below to download the disk image instead of starting from scratch.
- Download latest disk image >> Below I also list the packages that need to be installed if you decide to not use the disk image
- Insert SD card into computer (optionally format it as FAT32)
- Download Balena Etcher
- Open Balena Etcher >> Click "Flash from file" >> Select the disk image from step #1 above
- Now click "Select target" and select your SD card, then click "Flash!" and wait for the flashing and validating to finish
- Eject SD card from computer & insert it into your Raspberry Pi
- Hook up the sensors** to the Raspberry Pi according to the following schematic: Ensure the RPM sensors are ~1mm from the shaft, with the sensor's LED and receiver positioned perpendicular to the shaft. Also use paint or a permanent marker to add a dark line to the shaft for the sensor to trigger on.
- Connect your Raspberry Pi to your monitor through HDMI & plug in the power cable, and you're good to go!
The Pi will take a minute or two to boot and auto-login, after which it will automatically launch the dashboard and will start reading data from the sensors.
** If you're using Paul Townley's miniature Tesla Turbine, you can download some 3D printable attachments here to make it super easy to attach the sensors: Download models
If you decide not to use the disk image, you can run the following commands to install the necessary packages on your Pi (might need to prepend with sudo
):
apt-get upgrade -y
apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox
apt-get install --no-install-recommends chromium-browser
apt-get install realvnc-vnc-server
apt install i2c-tools
apt-get install python3-smbus
apt install pigpio
apt-get install python-pigpio python3-pigpio
apt-get install python3-numpy
apt-get install python3-scipy
apt install git
The dashboard allows you to change several settings, like whether you're measuring a single stage turbine or a multi-stage turbine for example, and this requires a mouse to be connected to your Pi.
On a Raspberry Pi Zero you'll need a micro USB OTG cable to connect the mouse.
As mentioned above, you'll probably want to change the settings of your rotor dimensions for example to make sure the detailed figures shown in the dashboard are accurate for your setup.
To gain more control over your Raspberry Pi, I strongly recommend you enable SSH, so you can use the command line to interact with your Pi.
To enable SSH:
- Create an empty text file named
ssh
(without a file extension) - Insert your SD card into your computer
- Copy the
ssh
file into theBoot
folder - Eject SD card, insert it into your Pi, and power it up
- Open
Terminal
on Mac, or Putty on Windows
You can now log in to your Pi by typing:
ssh [email protected]
, ENTER, and then as password raspberry
, ENTER.
If you're running this on a larger Rasbperry Pi, you can just plug in an ethernet cable, but if you're running it on a Raspberry Pi Zero 2 W, then you should follow these steps:
- In a plain text editor create a new file called
wpa_supplicant.conf
- Copy/paste the following text into the file:
country=us
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
scan_ssid=1
ssid="**YOUR ROUTER SSID**"
psk="**YOUR ROUTER PASSWORD**"
}
- Replace
**YOUR ROUTER SSID**
with the name of your WiFi network, and replace**YOUR ROUTER PASSWORD**
with your WiFi password - Insert your SD card into your computer
- Copy
wpa_supplicant.conf
to theBoot
folder - Eject SD card, insert it into your Pi, and power it up, your Pi will now be connected to the internet
Once your Pi is connected to the internet, you can now use an FTP tool like FileZilla to access the files on your Pi.
- Download FileZilla
- Click
File >> Site Manager >> New site
- Set the following settings:
Where the password is
raspberry
- Now click "Connect" to access the Pi's filesystem
VNC allows you to use your computer as the screen, mouse, and keyboard for your Pi, which can be quite helpful.
- Download RealVNC Viewer
- Click
File > New connection
- Fill in
turbine.local
as the VNC Server, then click "OK" - Now double-click the tile that appeared, and use the password
raspberry
when you're asked for it.
That's it!
NOTE VNC will show a black screen if you haven't connected a physical monitor to your Pi. I haven't found a way around this yet.
The dashboard has a "Play" icon at the top, which when pressed, turns on a pin on the Pi, which is intended to open and close an electronic valve.
I tested this with a 12V US Solid valve and the following circuit:
However, a 5V relay might also be used.
Each time the RPM measurement goes from 0
to >0
, the software will automatically start a new session, which is then logged to a CSV file for later analysis.
These files are stored in the /telemetry/sessions
folder, and can be accessed through FTP.
The file names contain the time when the session started in the format YYYYMMDDHHMMSS
Each time the Pi boots up, it checks the master
branch for updates, and pulls them to the device. This way you always have the latest and greatest updates without having to do anything yourself.
To disable automatic over-the-air updates, comment out the line ota.run()
in server.py
by placing a #
in front of it.
Check pigpio deamon status
sudo service pigpiod status
Check if MEAS sensor is connected properly:
sudo i2cdetect -y 1
for the first, and sudo i2cdetect -y 3
for the second sensor
Edit boot command
sudo nano /etc/xdg/openbox/autostart
Find all processes on port 8000
lsof -i tcp:8000
or netstat -vanp tcp | grep 8000
Find and kill processes on port 8000
kill -9 $(lsof -ti:8000)
or lsof -t -i tcp:8000 | xargs kill
List all user-installed packages:
(zcat $(ls -tr /var/log/apt/history.log*.gz); cat /var/log/apt/history.log) 2>/dev/null |
egrep '^(Start-Date:|Commandline:)' |
grep -v aptdaemon |
egrep '^Commandline:'
Create SD card image:
sudo dd if=/dev/sdb of=/your/path/to/clone.img
Then shrink image file with PiShrink
Finally, compress the file using:
gzip /path/to/clone/img
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request