Boat Fan Control

Conmtrolling a fan in my boat with an ATTiny85 (DigiSpark) an a DHT11 temperature and Humidity sensor

Similar projects worth following
A Small controller based on a Digispark ATTiny controller I have lying around and a spare DHT11 combined temperature and humidity sensor. Turns a vent fan On and Off (and several speeds in between) depending on the temperature, humidity, user input and battery state (voltage).

Currently Hardware complete, but needing some work for the software. 

..when my time permits

Files @

Temperature/Humidity Fan controller for my boat; incorporates a voltage sensor so that it can reduce power when the battery is low on energy, and a button so I can trigger a quiet mode.

  • DigiSpark Based
    • ATtiny85, plenty powerful enough for this application, and with a robust toolchain. It has 6 IO pins & very little extra cruft
    • Has a onboard 5v regulator, I can supply it with the battery voltage, and I can power the DHT11 from the 5v line
    • Somewhat tricky to flash/develop for, Lack of a uart is a total pain during debug since BitBang serial emulators eat half the memory+
  • DHT11 Temperature and Humidity sensor
    • Not ideal, something more accurate would be prefered, but this is what I have.
    • A DHT22 would be an easy (plug and go) upgrade
  • PWM fan control via a high-current logic-level NPN mosfet
  • Battery voltage sensing for powersave and shutdown
  • A button.. to allow on/off/quiet overrides

The Hardware is complete; it has a case etc. So.. I need to complete the Software side of things now too.

I have working hardware test sketches (see the Code/ folder):

  1. VoltageCalibrate.ino : Test and calibrate the Voltage sensor using USB-CDC serial to feedback
  2. SensorReader.ino : Test and relay readings from all sensors;
  • Readings are sequentially flashed out in groups using a LED connected in place of the fan

These Sketches have verified my wiring and confirmed the calibration of the resistor divider used to sense the battery voltage.



Adobe Portable Document Format - 22.17 kB - 09/18/2019 at 14:53


x-kicad-pcb - 46.33 kB - 09/18/2019 at 14:52



KiCad Schematic

x-kicad-schematic - 8.90 kB - 09/18/2019 at 14:52



Case.. Openscad

scad - 8.94 kB - 09/18/2019 at 14:52


  • 1 × Digispark ATMega85 devboard on a USB plug.
  • 1 × DHT11 Cheap-ass Temperature and Humidity sensor
  • 1 × NPN signal level Mosfet Big enough to switch the fan you use
  • 1 × Diode reverse voltage protection
  • 4 × Resistors for the voltage detector divider, and the mosfet drive.

  • Testing: Virtual DHT11 (emulator); perfect!

    Owen09/30/2019 at 14:36 0 comments

    From here:

    Looks like this could solve a lot of testing headaches. If it works on my Uno.

    I might extend it so I can simply pass values via the serial interface.

  • Interrupts

    Owen09/30/2019 at 14:22 0 comments

    I had time recently to look at the Interrupt routines I want to use; got a couple of ATTiny examples working, one for timer and the other for a pin interrupt.

    I will use sleep mode for the times between readings, but one of the relatively hight power modes that leave the PWM running. I might investigate using super low power mode for battery low conditions, in these modes even the PWM is off, but if the fan is running I need to limit sleep mode to one of the mid states.

  • What Nu!!

    Owen09/18/2019 at 19:54 0 comments

    I now need to define the main control loop; and implement it.

    • One reading every 30S and then decide how to set fan.
    • Power Control
      • Vmin->11.8V : Powersave mode; no activity, wake every 30s to take and process a voltage reading. Ignore button
      • 11.8->12.6V : Low Power Mode(s); start running the fan; limit max speed. respect quiet/off overrides
      • 12.6->Vmax : Full power mode. respect quiet/off overrides
    • Fan Control
      • Need to think about this
    • User Control
      • Off/Quiet/Idle
    • Average readings; discard outliers
    • Testing will be tricky.. I'll need to 'fake it' somehow for the humidity/temp readings.
    • I'd like to use interrupts and have the controller sleep between readings/decisions.

View all 3 project logs

Enjoy this project?



Owen wrote 09/18/2019 at 19:29 point

Comfort and condensation control. This is actually an Input fan, not an extractor, though it does blow into the bilge area.

She's a 6m sailboat with a small cabin and electric motor, no gas fears with her, though 'Clancy is correct; bilge vents can be a really good idea if you have flammable fuels about, and are mandatory in lots of houseboats etc.

  Are you sure? yes | no

Dan Maloney wrote 09/18/2019 at 15:21 point

Is the fan just a comfort fan? Or is it for bilge ventilation? Just asking because I once read a Tom Clancy story where he made a point of the need for bilge ventilation before starting the engines in some boats. In which case I'd imagine a gas sensor would be a nice addition.

  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