Skip to content

acme-iot/super-simple-ventilator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ventilator firmware, steps & shopping list

This project is based on https://github.com/jcl5m1/ventilator.

Version 0.1.0

Changes from 0.0.1,

  • additional 12v pump for the exhale phase
  • controller for the exhale pump
  • button to switch between adjusting the exhale and inhale cycle
  • software changes,
    • display shows the cycles/min of the inhale phase
    • display shows the cycles/min of the exhale phase
    • enables pump between exhale and inhale based on the phases' cycle setting

Display & Adjustment

The display shows two things

  1. what Mode the ventilator is currently in; exhale or inhale.
  2. the cycles per minute for both modes

The annotations in this image; Potentiometer & Button are used to adjust the ventilator. The button will switch the mode between inhale or exhale, while turning the potentiometer will adjust the cycles for the active mode. ventilator display 0.1.1

Display circuit

display circuit 0.1.0

Shopping List

Required

Almost all of these can be swapped out with similar components.

  • ESP8266 (any ESP8266 will do)

  • 12V air pump (make sure it is 12 volts and has a 2 amp AC power adapter) - Need 2

  • MOSFET 12v controller (can be substituted with a relay) - Need 2

  • Potentiometer 10k (can be substituted with lower resistances)

  • Button

  • OLED Display

  • CPAP tube (6ft with a 15cm diameter) - Need 2

  • 3D printer for mouth piece

    • TODO

Optional

  • 3.7v LiPo battery, 800mAh or higher (alternative, keep ESP8266 attached to powered USB)

  • TP4056 LiPo charger module

Version 0.0.1

Version 0.0.1 of this project has a basic/optional LED display and adjusts to a range of ventilation breathing cycles.

Ventilator cycles between a range of breathing cycles as shown on the display ventilator 0.0.1

Quick circuit using a glue gun and Dupont connectors circuit 0.0.1 MOSFET(left of red LED) is not regulating voltage and isn't generating heat

Simple circuit without battery powered board circuit 0.0.1

Shopping List

Required
Optional
  • 3.7v LiPo battery (alternative, keep ESP8266 attached to powered USB)

  • TP4056 LiPo charger module

3D printed display mount and case

ESP8266 Firmware

Build and deploy firmware using PlatformIO.

note, you can can find a partially completed ESP32 project in the master branch

Pre steps

Did you install PlatformIO's CLI?

on mac,
  1. pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
  2. vi ~/.bashrc (or .profile or zshrc...) and add export PATH="$PATH:~/.platformio/penv/bin"
  3. close your terminal and reopen or source ~/.bashrc to reload the PATH
  4. (optional) activate the virtual environment, . activate which should now be in the PATH
  5. can you run the cli? pio? if not go here, https://docs.platformio.org/en/latest/installation.html

PlatformIO extension to VSCode

  1. Just search for and install the extension PlatformIO
  2. Open settings.json in VSCode (from the Command Palette type Preferences Open Settings (JSON))
  3. Add the following (inside {...}),
     "platformio-ide.customPATH": "~/.platformio/penv/bin",
     "platformio-ide.useDevelopmentPIOCore": true
    
    note, customPATH probably isn't necessary since we added it to the PATH
  4. Restart VSCode

Running/Uploading the program to a board

  1. use the cli an run , pio run this will take a minute to fetch the board firmware and build it. Look in the newly created folder /.pio to see what is pulled down
  2. once everything is built then you need to upload the program (/src/main.cpp) to a board, this example uploads to the ESP32 board, pio run -e ventilator -t upload. Note, if you have all your boards connected via a serial port then you don't need to specify -e or which environment to upload to. upload_port is pegged to a specific port, this should change as needed.

Monitor Serial port

pio device monitor -b 115200

Notes

This project doesn't need VSCode or the PlatformIO extension in VSCode. If you look closely at the commands executed, all that is needed is PlatformIO Core and the included CLI.

Updating the toolchain

  1. Update PIO, pio upgrade --dev

  2. Find the latest PIO GCC ARM toolchain for Mac here, https://dl.bintray.com/platformio/dl-packages/ currently it is, toolchain-gccarmnoneeabi-darwin_x86_64-1.90201.191206.tar.gz, then add it to platform_packages

  3. add a platform_packages reference in plaformio.ini

[esp32]
platform_packages =
    toolchain-xtensa32 @ 2.80200.200226
    framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
  1. then have the environment definition reference this
[env:ventilator]
board = lolin32
framework = arduino
platform = espressif32
platform_packages =
    ${esp32.platform_packages}
stuck?

IDEs

CLion

Follow these articles

Once CLion is setup run, platformio project init --ide clion to refresh and rebuild all CMake targets