Introduction: DIY Cheap Ventilator ESP32

Hello everyone!

As we all know COVID19 is the only topic these days. Here in Spain the disease is hitting very hard. Although it seems that slowly the situation is being controlled, the lack of breathing machine in hospitals is a really serious problem. So taking advantage of the time that confinement gives us, I decided to develop my own model (ONLY AS AN EXPERIMENTAL EXERCISE).


Here you have the bill of materials

DM board 10mm thickness -----------------------------------------------7€

Methacrylate board 5mm thickness------------------------------------12€


NEMA17motors (2uds.)---------------------------------------------------12€

TTGO-T DISPLAY board---------------------------------------------------6€

Driver DVR8825( 2uds.)----------------------------------------------------2€

Lineal bearing 8mm (4uds)------------------------------------------------6€

3D Printer guide 8mm de 400mm(2 uds)----------------------------10€

DC-DC stepdown -----------------------------------------------------------1€

Power supply 12v 3A------------------------------------------------------13€

Small electrical material, resistors, capacitors 100mf, wires)-----8€

TOTAL ___________________________________________93€

All materials are quite affordables and they are bought at local hardware stores and on-line shops (Amazon,Ali-Express).

Step 1: The Software

For this project I have used these three programs.
Autocad to design in 3d, is the program which I am most familiar with although you can choose another one.

I have selected Arduino IDE to program the ESP32 board. Here there are also different options, like micropython.

Slic3r has been used as laminator for 3d printed parts.

I share these two files: cad file and arduino sketch .

Step 2: The Process

When I realized there was a problem due to the lack of ventilators in hospitals , I also saw how the maker community in Spain began working and several respirator projects came up.

Personally, I did not get involved in any of them because there are much better qualified people and my first idea was to try to manufacture one of those projects, but due to lack of materials, I tried to make one with the stuff I had available.

The design of the device is inspired by a 3d printer and all the pieces are included in the cad file. The main parts are made of DM and glued among them. Brackets , tensors and the shovel are printed in PLA

I thought a stepper motor could be a good option because of its precision. So I designed the mobile table, the support and I added the shovel that pushes the AMBU (maker community design). The first tests were with one motor, because I didn't have the AMBU yet. Based on an example, I was building the code and adding functionalities:

A temperature sensor and a buzzer to configurate an excessive temperature alarm on the motor.

Two potentiometers to regulate the speed and the volume of air propelled.

Two hall sensors to have better control of the position of the actuator.

The first problem appeared when the AMBU arrived and I realized that the motor did not have enough power.

I was looking for different options as 360º servos or DC motors with reductions and both could serve but they were not available.

Then someone told me to use two motors, so instead of waiting I began working with the materials I had. After made a few adjustments I began to code.

Step 3: The Code

I wanted to ask you to not be scared if you see many errors in the code, I have just learned what I know by searching the web.

It has been very hard and it would be impossible for me without the libraries and the tutorials .
I am also willing to listen any tips, improvements or any constructive comments.

I have written some notes in the code in case someone wants to follow it, take it as a starting point or improve it.

Basically what the sketch does is operate the motor in the following way;

-Back to home marked by the hall sensor

-Advance to the desired position controlling both volume and speed.

Other added functionalities are the tft screen to view the data, a temperature sensor to monitor the engine temperature and a buzzer as an alarm.

I have another version of the code to monitor via mqtt through the Blynk application,

I had problems implementing this code with the potentiometers so the air volume and speed values can be changed through the application. I have also implemented an alarm that sends an email if the device fails and does not go through hall sensors. The TTGO-DISPLAY is easily powered by a 18650 battery as an emergency system that could send the alarm if the general power go down.


This is a project that I have done experimentally and I would only use it if it was my last chance.

And only with more powerful and reliable engines.

Here in Spain it seems that the needs of respirators are being covered but if in other countries the COVID19 extends as here, they will need many ventilators and they are very expensive devices.

If someone can use my project as a starting point or inspiration I would be extremely happy.