My cottage has a cellar which is relatively humid, so I purchased a system that keeps the humidity at reasonable levels using a set of fans and a dehumidifier. The system runs two different control loops as far as I can determine.

One controls the fans: when the absolute humidity is lower outdoors than indoors, the fans run to swap in the dryer air and out the more humid air. The control box controls four 24V DC fans by driving them directly.

The other one controls the dehumidifier: when the relative humidity is above a particular threshold, the unit is started. I think it is some sort of simple PID controller, but I am not sure. The control box controls a 240V relay with a 12V signal (as far as I can determine).

As it is black box system, I don't know exactly what is going on. I have managed to reverse engineer the protocol between the box and the PC software in order to read out the humidity values, but I cannot determine using that protocol if either of the loops are engaged.

My thinking is therefore that I would like to use my Raspberry Pi (which is already connected to the box) to detect voltage changes on the fan controller and on the relay controlling the dehumidifier.


How do I safely detect voltage changes using my Raspberry Pi? Design priorities are (1) safety, (2) reliability, (3) cost, in that order. As this system controls the humidity, it is critical that my measurement does not interfere with the operation of the contorl box.

Ideas I have thought of, and my conclusions:

  • Using LEDs on the control box: Cannot be done, LED status does not correlate with fan or dehumidifer controls. :-(
  • Using some sort of optical measurement for the fans: could work, as all of them are operated in unison it would be reasonable to place an RPM metering system on one of them. Drawback is lots of cables.
  • Using some sort of switch that can detect the air movement: could be simple, but I don't know how reliable. Also involves a lot of cables.
  • Using some sort of voltage detection: seems most reasonable, but I don't want to toast the Raspberry Pi or interfere electrically with the operation of the control box.

My thinking so far is to build some sort of voltage divider circuit as I have done with an Arduino, but the Raspberry Pi lacks an ADC. An option would be to use a digital input, but my window of error shrinks: I need to be able to hit the 3.3V within a margin, and the voltage spikes from a DC fan controller I guess are terrible news for a Raspberry Pi GPIO port. Another alternative would be to introduce an external ADC, but how do I then connect it to the fan controller to avoid interfering with the control box?

Are there any standard patterns for this kind of thing?

Kindly advise! Thanks! :-)

  • There must be some sort of isolated digital input daughtercard (shield, cape, whatever) for the RaspberryPi that would allow you to directly detect the voltages used to drive the fans and dehumidifier relay. I'll migrate your question so that you can get advice specific to that platform.
    – Dave Tweed
    Dec 28, 2016 at 12:11
  • Note if you are familiar with Arduinos and already know how you would use one here, you can easily attach it to a Pi via UART (or I2C and I believe SPI). Although I'm not sure what that will offer you beyond an ADC or why it's implied here that the later will "interfere" but the former would not?
    – goldilocks
    Dec 28, 2016 at 13:37
  • Other than the fact you are planning to use a Pi this question has nothing to do with Raspberry Pi. Omit mention of "Raspberry Pi" and ask on aan electronics site.
    – Milliways
    Dec 28, 2016 at 21:40
  • Agreed, but as you see my question was migrated from the electronics exchange yesterday. Dec 29, 2016 at 14:10
  • 1
    You should really ask this question again on EE but leave out any reference to the pi. If that doesn't make sense to you, you should stay away from playing with high voltages.
    – goldilocks
    Jan 26, 2017 at 12:43


Browse other questions tagged or ask your own question.