Page 1 of 1

Emmercy shutdown of devices

Posted: Fri Jan 30, 2015 3:17 pm
by samip537
Hi,

I have an interesting idea, but have no idea nor parts to deploy it. Any ideas/thoughs about this?

The basic idea is: have an RPi reading the tempeture and humidity of the room with some kind of sensor and if humidy is 91+% send an signal to UPS to shutoff power (USB connection) and send an alert email to me about it including the current tempeture and humidy.

The requiments:
- Sensor/sensors needs to be able to handle -20 degrees C
- Easy as possible configuration

UPS Model: PowerWalker VI 1000.
RPI Model: B.

Re: Emmercy shutdown of devices

Posted: Sat Jan 31, 2015 1:25 am
by Tarcas
Sounds fairly easy, if you can get the Pi to do each of those parts. A DHT22 will go from -40 to 80 C, so that fits your specs. Can you send a signal to the UPS to make it shut off?

If so, write a script like this (this is pseudocode, so you'll have to translate it to whatever language you want to use. Just use this as a template.)
Main()
while 1
temp = sensor.read
if temp < minthresh || temp > maxthresh
then alarm()
else sleep 60 # 60 seconds = 1 minute
loop # go back to the top

alarm()
email me@mydomain.com "Temperature threshold out of bounds. Shutting down equipment. Current temperature = "+temp
/home/pi/scripts/upsshutdown #execute a script to shut down the UPS
sudo halt #turn off the Pi, assuming that's desired. Of course this means the script needs to be running as a user with sudo permissions.

Re: Emmercy shutdown of devices

Posted: Mon Mar 30, 2015 1:55 pm
by samip537
Tarcas wrote:Sounds fairly easy, if you can get the Pi to do each of those parts. A DHT22 will go from -40 to 80 C, so that fits your specs. Can you send a signal to the UPS to make it shut off?

If so, write a script like this (this is pseudocode, so you'll have to translate it to whatever language you want to use. Just use this as a template.)
Main()
while 1
temp = sensor.read
if temp < minthresh || temp > maxthresh
then alarm()
else sleep 60 # 60 seconds = 1 minute
loop # go back to the top

alarm()
email me@mydomain.com "Temperature threshold out of bounds. Shutting down equipment. Current temperature = "+temp
/home/pi/scripts/upsshutdown #execute a script to shut down the UPS
sudo halt #turn off the Pi, assuming that's desired. Of course this means the script needs to be running as a user with sudo permissions.
Actually, it's not that easy even though it uses some sort of serial interface. :(
I cannot directly send an signal to it. I need to use a 3rd party application to communicate with it.