Farm ventilation control


I was making simple ventilation control for my farm.

PHOTOS and SCHEMATIC are here:

Main functions of system: * Display current temperature & relative humidity * Intelligently control 4 fans depending on average temperature of current period * Ability to set target temperature via buttons

  • Relays just open/close 3-phase contactors for each fan. There are buttons for manual contactor ON/OFF + button to break the Arduino relay circuit from contactor box.


  • Arduino UNO Rev3
  • DHT21 sensor
  • 4 optoisolated relay array
  • LCD keypad shield 16x2

Features: * Current temperature is being smoothened using moving average * Fans are being turned on/off every 60 secs * On sensor failure - fans are turned off & arduino freezes throwing out an error * There is a 2 sec delay between starting each fan (so to not overload line - each fan ~0.55kW) * Target temperature is being saved to EEPROM

Arduino source code:

P.S. This is my first project with Arduino and with low-voltage electronics. I will be very glad to receive comments and criticism.

Assuming it works, it looks fine. There are a few minor oddities, such as your boolean functions that unconditionally return true.

Personally, I'd leave the debugging serial prints in, without checking whether the debug flag is set - the arduino doesn't care if there's no-one listening. I'd also put an L suffix on the large constants just to make sure the compiler treats them correctly. I don't see the need for an array of temperatures, you can just keep a running average. However, these are very small nitpicky things; overall, it looks clean and clear.

Thank You for Your remarks.

Edited code, added photos.

I would add an fire-alarm function if the temperature comes above some (serious) threshold.

Thanks fire alarm would be fine, yet currently I have no GSM module and not much pins left on UNO.

I'm planning on more advanced farm control system.

Including SMS alerts, web console, ammonia sensor, feeder/water failure sensing and so on...

Added schematic.

and not much pins left on UNO.

go for an I2C LCD that uses only 2 pins.

Thanks for great idea. There are cheap adapters for I2C -> 1602 LCD.

I thought I will need a MEGA...