This git repo is for the code on the Raspberry Pi
Heroku Cloud Server & Web Browser Repo | Raspberry Pi (Network Adapter) Repo | Ventilator (Arduino) Repo |
---|---|---|
Ruby on Rails | Flask | Arduino Board |
Javascript | Python | C++ |
Create a lightweight Raspberry Pi application to serve as a network adapter to relay data from Arduino-Based ventilators to a central monitoring dashboard (javascript web-browser application).
This software is currently only a concept - it is neither approved nor intended to be used in any medical setting.
Many of the rapidly manufacturable ventiltor designs utilize and arduino-based control system which does not have a network interface. The raspberry pi provides this network interface, serving as an API endpoint which can connect to central monitoring dashboard (javascript web-browser application). Raspberry pi's are cheap, easy to program, available in large quantities, locally sourceable, and reliable (by consumer hardwarwe standards).
As of 3-April-2020: Currently, the app is in demo/testing mode only. The server consists of a python flask app. A typical data request from the dashboard is handled like this:
- The flask app receives a request from the javascript dashboard application
- The flask app sends a request to the ventilator (Arduino) for data via the USB serial cable
- The flask app receives the data back from the ventilator (Arduino)
- The flask app sends the data to the javascript dashboard application
- Obtain a Raspberry Pi board. Many raspberry pi's will work, but the Raspberry Pi 3 Model B+ is widely available for an affordable price (~$ USD). These products are widely avialable, so shop around. Newark is the main US distributor and currently has about 56,000 Raspberry Pi 4 Model B's in stock for ~$55 USD each.
- Obtain a power supply and a The Rasperry Pi is power hungry, especially when you have an arduino plugged in, so be sure to pick up a beefy power supply if you don't already have one. Be sure to pick up the correct power supply for your board - the Raspberry Pi Model 4's now use a USB-C power supply instead of the old boards, which use a USB micro power supply.
- If you'll be using a display monitor with your pi (recommended - easier than headless mode) you will need the appropriate HDMI cable. Please note that the Raspberry Pi 4 now uses a mini-HDMI instead of a full size HDMI video cable.
- Obtain an SD card - buy a high quality one with a good amount of memory. The Sandick Ultra Plus microSDHC UHS-I 32 GB seems to work nicely.
- Obtain an SD card reader if you don't already have one.
Eventually we'll have pre-deployed images ready for download and quick install onto your SD card. For now, there is a lot of manual work:
- Download the SD Card Formatter tool to your desktop computer and format your SD card.
- Download the Raspberry Pi Imager for your desktop computer operating system.
- Open the Raspberry Pi Imager and install the Rasbian Lite Image onto your SD card
- Insert your SD card into your pi, connect your desktop monitor, keyboard, and mouse, and plug your pi into your power supply
- When the pi boots, enter the default username: pi and password: raspberry
- Either plug your raspberry pi into your local ethernet network or add your wifi credentials to the wpa_supplicant.conf file.
- The default hostname of the pi is
raspberrypi
which will make your pi accessible on your local network via the url http://www.raspberrypi.local. Here, we will change the host name toventilator-1
so the pi will be accessible on our LAN via the url http://www.ventilator-1.local. Change the host name of your raspberry pi using the nano (new to nano?):sudo nano /etc/hostname
-> change the host name toventilator-1
or similar. Use a different host name for each pi. - Edit the /etc/host file
sudo nano /etc/hosts
and changeraspberrypi
toventilator-1
- Update the apt package manager
sudo apt-get update
- Install git
sudo apt-get install git
- Install the python 3 package manager
sudo apt-get install python3-pip
- Install our application dependencies
sudo pip3 install flask flask-cors pyserial
- Clone this git repo:
git clone https://github.com/Open-Ventilator-Remote-Monitoring/remote-ventilator-monitor-pi.git
cd remote-ventilator-monitor-pi
- Start the server using the start script:
./start.sh
(You may need to runchmod 777 start.sh
first). - Open a web browser on your desktop (connected to the same network as your pi) and visit the url
http://ventilator-1.local
You should see the index info page. - After you connect your properly programmed Arduino via a USB cable, you should be able to visit
http://ventilator-1.local/api/ventilator
and view JSON result of the latest ventilator stats. Refresh the page to query the Arduino again and get different values.
Having a problem? Leave a message on the Slack Channel and we'll help you out.