ttsk8r
Posts: 12
Joined: Sun Oct 05, 2014 4:42 pm

need help making a device's on off status an input.

Tue Oct 28, 2014 10:24 pm

Hello there, I'm trying to figure out how to accomplish my current task. Basically I have a fan that is connected to 120VAC. My raspberry pi polls the temperature of my room every 5-10minutes if it is above a certain temperature my Rpi uses lirc to blast the Fan's IR code to power it on. What I want to do is figure out a way that the pi can determine if the device is currently on or off. Before I just included a True/False toggle in the python script. However, whenever start the script over, manually turn the fan off/on etc the boolean toggle becomes pointless. Any tips or advice would be much appreciated.

User avatar
default_user8
Posts: 680
Joined: Mon Nov 18, 2013 3:11 am

Re: need help making a device's on off status an input.

Wed Oct 29, 2014 2:05 am

How about using a pi camera and running motion and instead of snapping a picture it writes an on/off state in a file.
Two heads are better than one, unless one's a goat head.

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: need help making a device's on off status an input.

Wed Oct 29, 2014 8:21 am

I'd probably go for a very simple approach, have a small piece of rigid plastic (hinged from the top) in the airflow, orientated such that the fan will blow it into contact with a microswitch and when the fan doesn't blow the plastic drops out of contact with the switch. A hall effect sensor could be used instead of a microswitch if preferred. the microswitch or hall effect sensor could be orientated at the rest position instead of the on position for easier monitoring.

Industrially we monitor the status of fans with differential pressure switches, although these only work if the fan is in ductwork.
Doug.
Building Management Systems Engineer.

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: need help making a device's on off status an input.

Wed Oct 29, 2014 9:57 am

1) sense if the fan is using current or not (this can be done with non invasive sensors on the line cable of the fan, but those are oftene analogue so you need also a ADC). Fail if the fan is blown up and simply heats up the motor instead of turning :)
2) put a "wind speed" sensor in front of the fan. This is far more expensive, but has the pro that can be used also if you want to control also fan speed.
3) put a "bend sensor" in front of the fan
4) put a hall sensor and a couple of magnets near and on the fan (i say a couple not to unbalance the fan rotating). This is cheap and let you know all the above. The cons is that mecanically is harder to obtain.. and you have to check the "resolution" of hall sensor (if fan is turning fast maybe you loose some contacts)

wow a lot of options :)

User avatar
aTao
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: need help making a device's on off status an input.

Wed Oct 29, 2014 10:51 am

use a wheatstone bridge with one resistor in the path of the air from the fan
use an opto coupler which shines through the fan blades
use a microphone in the path of the air
depending on the orientation of the fan: weigh it or put a torque sensor on its mounting
>)))'><'(((<

User avatar
Burngate
Posts: 6302
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: need help making a device's on off status an input.

Wed Oct 29, 2014 11:56 am

Do you want to know if it's powered, or actually rotating (i.e. not broken)? Do you care if its switch is on but it's fuse has blown?

ttsk8r
Posts: 12
Joined: Sun Oct 05, 2014 4:42 pm

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 1:00 am

The fan in question is not a typical box fan rather it's a tower fan, all i care is that it is powered

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 8:43 am

ttsk8r wrote:The fan in question is not a typical box fan rather it's a tower fan, all i care is that it is powered
it is probably a tangential fan.. that's not a problem, it's always spinning, so you can put a reed sensor and a couple of magnets on the axle..
But if you only need to know if it's powered, you can put a thoroidal current sensor on the cable (you need to split the couple of cables going to the fan, indeed..)

User avatar
aTao
Posts: 1093
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 9:03 am

Provided you are competent at 120V wiring then put a relay with a 120V coil in parallel with the fan
Set a GPIO to input with pull-up enabled and connect a NO contact in the relay to 0V on the RPi
To prevent damage to the RPi put a 10k resistor from the GPIO you use to the relay contact.
>)))'><'(((<

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 10:50 am

ttsk8r wrote:The fan in question is not a typical box fan rather it's a tower fan, all i care is that it is powered
Does it have an indicator lamp or LED?

PiGraham
Posts: 3932
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 11:11 am

Good suggestion above. I like the current sensing toroidal transformer best. There are all-in-one modules that do this. I don't know price of availability but see http://nktechnologies.com/current-sensi ... witch.html.
Another approach could be to leave the fan on all the time, if that is possible, and plug it into a wireless remote power socket. There are various options for controlling 433MHz mains sockets from Pi. The advantage is they have discrete on and off functions rather than a toggle that you have on the IR control.

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 12:01 pm

PiGraham wrote:Another approach could be to leave the fan on all the time, if that is possible, and plug it into a wireless remote power socket. There are various options for controlling 433MHz mains sockets from Pi. The advantage is they have discrete on and off functions rather than a toggle that you have on the IR control.
This is not going to tell you if the fan is powered. You don't know if your wireless command has reached the powerswitch. You don't know if the power switch has worked right.

southpaw
Posts: 52
Joined: Wed Nov 30, 2011 2:23 pm

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 6:31 pm

given you already have a setup with temp sensors a simple solution would be to install another temp sensor in the airstream of the fan, and code that polls it for sudden drops (indicating fan is on)

ttsk8r
Posts: 12
Joined: Sun Oct 05, 2014 4:42 pm

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 8:32 pm

That may work I do have a spare DHT11 Laying aroudn somewhere, hopefully it'll be able to pull that sort of job due to it being rather inaccurate. I'm going to check out microswitches as i feel I'd have the most luck setting them up.

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: need help making a device's on off status an input.

Tue Nov 04, 2014 9:34 pm

Buy another fan.

Return to “Automation, sensing and robotics”