IOT Air Compressor

ESP8266 Based air compressor controller with WiFi.

Similar projects worth following
WARNING!!! Please note that compressed air in a tank can be LETHAL!
I have installed a mechanical valve in my tanks to ensure if the pressure hits 200PSI the valve will open and ensure that the pressure never exceeds the rated pressure of the tank.
Please read the WARNING part of the post.

Some years ago I purchased an old compressor that has been a work horse. A year ago the mechanical pressure switch and contractor's gave out causing the compressor to no longer turn off despite trying to persuade it with a hammer.

I replaced the assembly at a cost of about $120.00

The other day to my dismay the switch failed again, this time it will not turn the compressor on.

Rather than just replace the switching system again I decided to build a new one with some smarts and using an ESP8266, a pressure sensor and a solid state relay I have begun putting together and coding a smart switching system that connected to the local network.

Before you even consider altering an air compressor make sure you have a pressure release valve so the pressure will never exceed what your tank is rated for. 
Water will gather in the bottom of your tank and it will rust from the inside out so be sure your tank is not compromised.
make sure you dump the water from your tank on a regular bassis.

Watch this video to see what can happen if your tank explodes, this guy was lucky.

What is required:

The primary function is to keep a track of the pressure, for this I hunted down a pressure sensor that ran on 5V and output a value from 0-174Psi.

The next step was to decide on a processor, initially I was going to just use an arduino with an LCD screen but as the compressor is outside I really did not want to have to walk out there to check the pressure and make adjustments so I opted for an EP8266.

As the ESP only has one analog input I decided to use the wen interface to set the upper and lower pressure. Actually what I ended up with was a lower pressure setting and a Hysteresis setting that would allow me to set how much the pressure would go over the required pressure before the motor turned off, then when the pressure droped to the minimum required pressure it would turn back on and bring the pressure back up.

The next thought was to add an on and off button so if i was sitting there watching TV and the compressor turned on I could turn it off without having to go outside. It is also picking up the time from the NTP server so when im finished I can ensure the compressor is not running in the middle of the night and annoying my neighbors. (or if they have been playing loud music the night before turn it on early in the morning)

  • 1 × ESP-8266 LoLin NodeMCU
  • 1 × 5V 240V Switch Mode PSU
  • 1 × Pressure Sensor Transmitter DC 5V G1/4 0-1.2 MPa / 0-174 PSI For Water Gas Oil
  • 1 × FORTEK SSR-40DA Solid State Relay
  • 1 × 10K resistor

View all 6 components

  • Compressor Bleed Valve

    Boris van Galvin01/22/2018 at 23:40 0 comments

    After watching a recent video on compressors I found that there is a one way valve on my one between the compressor and the tank, this reduces the chance that pressure will appear in the head of the compressor. In commercial compressors the feed line between the compressor and the tank has a valve that once the original mechanical switch kicks in dumps the air out of the feed line so the next time the compressor starts pumping it is not trying to compress air that is already compressed.

    I have just ordered in a small air solenoid that I will look at installing in the line so once the compressor has  reached the desired pressure it will open and remove the pressure from the feed line between the compressor head and the tank.

  • Power Outage

    Boris van Galvin11/28/2017 at 01:31 0 comments

    So the system prety much went live at the beginning of the month and has been running without a glitch ever since. Some times it gets turned off at night other times I end up just leaving it on (forget to turn it off).

    Today we had our first power outage, no warning and everything just went off. I had actually had the compressor in the off mode for the last 3 days as had not been using it and had forgotten about it.
    Power came back on and as everything in the workshop slowly started up the compressor kicked in replenishing the pressure back up to its set levels :)

  • Still Running :)

    Boris van Galvin11/14/2017 at 22:02 0 comments

    Well the unit has been on and running since my last post and has not missed a beat.
    We lost net the other day for the whole day and the unit kept on trucking regardless. Forgot to turn the pump off the other night and it fired up at about midnight, went to the page on my phone and turned it off. Mostly its been used for air brushing to pressure has been low however a couple of times I cranked the pressure up to about 120PSI for a couple of other jobs.

    Lost power once over the last week during a thunder storm, power came back and everything ran as expected.  

  • uploading you index.html

    Boris van Galvin11/05/2017 at 21:50 0 comments

    for those having issues getting the index.hml page running have a look at this.

  • Two days running

    Boris van Galvin11/04/2017 at 07:59 0 comments

    two days in and its running a treat so far. dropped the pressure down to 50psi and the trigger to 10psi and the air leaks that are in the line (something i really should fix one day) causes the pressure to drop and the pump to start every 5 or so hours. Pump runs for a few seconds to bring the pressure back up to 50psi then shuts off. 


    Boris van Galvin11/02/2017 at 22:15 0 comments

    Not exactly pretty but it works a treat!

  • Source Code

    Boris van Galvin11/02/2017 at 22:06 0 comments

    I have just created a github repository for the source

View all 7 project logs

Enjoy this project?



ejm91206 wrote 07/29/2022 at 17:35 point

this is really cool... I wonder, is it possible to make this work with a solenoid valve to control tire deflation and wifi direct connect to a smartphone (instead of relying on the internet)? 

  Are you sure? yes | no

kaxax77452 wrote 06/21/2021 at 08:03 point

I just wanna say one thing Its unique idea very impressive I will suggest you that If you face any issue in this project you can visit air compressor website to learn anything about air compressors.

  Are you sure? yes | no

Jayant Benjamin wrote 06/04/2019 at 11:24 point

Hi! amazing project I wanted to know how did you calibrate the sensor ?

Saw the analog read in the code, I didn't understand map float 

  Are you sure? yes | no

mriordan1 wrote 06/03/2019 at 01:10 point

i have tried to use your sketch and it does not work.

how do we connect to the  web interface?

  Are you sure? yes | no

alexhenrique wrote 11/05/2017 at 15:07 point

I try to flash esp8266 and didnot work. In browser shows “FileNotFound”. Where is the file “index.html” is going to be stored? Inside de esp8266? Or SD card?

  Are you sure? yes | no

Boris van Galvin wrote 11/05/2017 at 21:49 point

have a look at this....

  Are you sure? yes | no

Boris van Galvin wrote 11/04/2017 at 21:38 point

Thanks, Yes this was something I have checked, I had thought about changing this out for an electronic type as there are times when I need to run really high pressures and I know the tank is rated to handle these however for safety reasons I decided to leave the mechanical one in place. I have seen way too many tanks fail catastrophically to want to run the risk of that.

Another sensor I was thinking about adding to the mix is an internal moisture sensor, as we all know the tanks eventually get water in them and a sensor connected to a dump valve on the bottom could be a great addition.

  Are you sure? yes | no

Bharbour wrote 11/04/2017 at 22:43 point

You could probably just actuate the dump valve after every 1/2 hour or hour of compressor run time. That is what the commercial units do. I thought about a similar thing on my compressor, but I don't want to just blow oily water out over the grass in my back yard. It would get tracked into the house and my wife, who is remarkably patient with metal swarf, would be really unhappy with me. What to do with the discharge is the hard part to me. Dumping it into a closed plastic bucket is the best sounding idea that I have had so far, but that only delays having to go out and dump it.

  Are you sure? yes | no

Boris van Galvin wrote 11/04/2017 at 23:15 point

Haha.. I have taken over the whole lower area of our house, milling machine, lathe, electronics gear, welding gear and 3D printers to name just a few of the toys. Thank goodness for understanding wives! :)
Oh and the Electroplating system take up most of the bench in the washing area. 

A dump every 1/2 hour sounds like a perfect solution :) for the small amount of fluid its going to produce I wonder if its worth just dropping it in to a larger pan and letting it evaporate. at some stage I need to also build a better air intake system and looking at adding a valve to turn the pump so it will pull a vacuum for and allow me to make a small vac form unit. 

  Are you sure? yes | no

diehl.mike.a wrote 11/05/2017 at 13:57 point

I’m an industrial air compressor technician and would like to offer up some design ideas. I’ve worked on controls for everything from small garage machines to high speed turbos with active magnetic bearings.

  Are you sure? yes | no

Boris van Galvin wrote 11/05/2017 at 21:46 point

I would love to have some input :) 

  Are you sure? yes | no

Bharbour wrote 11/04/2017 at 13:11 point

Make sure that your mechanical overpressure valve is in good shape. A firmware bug that left the pump running could have ugly results if that valve is absent or stuck!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates