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)