Sunday, December 30, 2012

Internet Enabled Sump Pump Monitor

This project attempts to solve a problem.  Here is a picture of the project with the cover off: 

Figure 1:  System view of the Internet Enabled Sump Pump Monitor

 About three years ago, I moved into a new house with an unfinished basement.  The basement has flooded many times due to a sticky tar substance that comes in from the waterproofing of the foundation.  The tar was smeared on the outside of the foundation during construction.

Figure 2:  Parts of the sump pump monitor

Anyway, the tar comes into the sump well and either plugs up the sump pump or causes the float switch for the sump pump to lock on or off.  The tar/oil has also locked open several check valves on the output.  

This is a quick video I made of the system installed on the sump pump:

I have tried several things to keep the tar away from the sump pump.  One item I tried was putting window screen around the edge of the sump well.  Some of the tar did stick on the screen, but when there was a heavy rain, the window screen pushed in and stopped the float on the sump pump from activating.

Figure 3:  The tar can be seen on top of the water and on the window screen

I have two possible nicknames for my sump pump (sump well):
            1)  Exxon Valdez
            2)  Deepwater Horizon

Paper towels are occasionally used to clean up some of the sheen on the top.  The oil sticks to absolutely everything.  WD-40 works well for removing the oil if it gets on my skin. 

This project monitors the sump pump without effecting its operation.  There are two things monitored:

            1)  Is the water level too high in the sump well?  If so, send an alert email and activate an audio alarm.

            2)  Has the sump pump been on too long? If so, send an alert email and activate an audio alarm.

I didn't want the project to control the sump pump in case the MCU locks up or doesn't not behave correctly.  "Do no harm" is the motto I'm going by. 

Since this was a project I wanted to get done somewhat quickly, I decided to use an off the shelf board.  I choose the Seeeduino Ethernet board, which is an arduino with an Ethernet port.  This is my first arduino board and the first time I'm using the arduino development system.  It's ok, but I much prefer AVR-GCC and AVR studio.  Although, the Ethernet library in the arduino was nice.

Figure  4:  Internet page for the sump pump monitor

Shown above is the web page.  There was one activation of the sump pump 1 minute ago and one activation about 49 minutes ago.  Minute data that is older than 8 hours drops off the table.

An IO gear Ethernet to wireless 802.11 adapter was used to complete the internet connection.  An LCD from 4D systems was used to display user information.  An ip address in browser can also be used to look up some of the status information.

Figure 5: Water level float

If the water level gets too high, the float above will hopefully activate before the oil stops it from moving.  The float came from ebay.  It seems to have a magnet on the float and a hall effect sensor in the main body.  It is shown above in the activated  position.

There are some commercial sump pump monitors available.  But, they tend to be pricey. 
Plus, I'm not really sure how the tar would effect the operation of either of these units.

 Figure 6:  The current sensor for the sump pump

The above image shows the neon transformer in it's housing.  The transformer was assembled around the "hot" wire of the electrical cord running to the sump pump.  This induces a small current (voltage) in the neon transformer that then goes out the black and white wires to the main arduino board.

Figure 7:  The LCD main screen

The LCD is read the following way:
            Line 1:  Title
            Line 2:  This is the IP address of the board on my locale network
            Line 3:  The Arduino is using 103 bytes of ram
            Line 4:  The water float is not activated
            Line 5:  The sump pump is not on
            Line 6 and 7:  The sump has been turned on 51 times
            Line 8:  Counting down to turn off the LCD
            Line 9:  The number of seconds the sump pump has been on
            Line 10:  If the user presses the "EEPROM reset" button for 15 seconds,  51 -> 0

There were a couple of problems I had during the software development phase.  First, I could not get the Ethernet to work when I was running the ATMEGA328 at 16MHz.  The Ethernet would work when I had the divide by 8 fuse on.  The source of the problem was the AVR ISP MKII programming header.  It was loading down the SPI line going to the Ethernet chip on the Seeeduino Ethernet board.  Second, there seems to be no way to turn off the 4D systems LCD through software.  So, I ended up using a P-channel MOSFET to cut power to the LCD.  This acts to prevent burn in on the LCD. 

The schematic is shown below. 

Figure 8:  Schematic of the sump pump monitor

Wednesday, July 18, 2012

Defense Against The Dog Arts!


Here is the video:

This project uses six ultrasonic emitters on bicycle to be repulsive to a dog.

Dogs tend to be a problem for most cyclists.  Residential areas are by far the worst.  There seems to be some wiring in a dogs head that makes them insanely aggressive when they see a person on a bicycle. 

There are several things you can do to help protect yourself from dogs.  Some suggest yelling  things like "Bad dog!", "go home!" or obscenities.  I have tried this and found it to be completely useless.  I had a friend that would carry ammonia in a squirt bottle.  He would squirt the ammonia on the ground and when the dog smelled it, the dog would completely forget about chasing you and go investigate the strong smell of the ammonia.  I never tried this.  Others claim that a capsaicin based spray is the only way to go.  But, windy days can effect your aim.  I even found that a small revolver was invented in France specifically for shooting a dog from a bicycle.   It was a revolver without an external  hammer so the hammer would not get stuck on clothing.  (click here)  That seems a bit extreme.  The final way is to use high pressure sound waves to get the dog to move away from you.  There are two ways to accomplish this.  The first is a CO2 based horn.  If a CO2 canister from an air rifle were used to generate high frequency noise, the output could be tremendously loud.  (there are off the shelf dog whistles, but they do not have any sound intensity ratings.)  Since I like the electronics more than the mechanical side of things, I decided to build a custom circuit board and enclosure to power 6 ultrasonic emitters.
What ever you do, you want to first avoid getting hit by a car, wrecking, or getting bit by the dog.

From what I have read on the internet, smaller dogs can hear higher frequencies than a larger dog.  But, since smaller dogs have little chance of catching a cyclist, there is not much a threat there.  So, I used four emitters at 25KHz and two at 40KHz.  (I had the 40KHz emitters from a previous project)  

For the main MCU, I used an Atmel ATmega644.  I needed an MCU with three timers for the different frequency outputs.  Besides, I already had the MCU.   (the board in the picture above uses and ATMEGA32)  When a dog is heard getting close, the rider flips a toggle switch under the seat on.  The emitters then start doing their thing and hopefully drive the dog away.  I put a human audible piezo emitter next to the toggle switch to let me know it is working.  (this is much better than an LED, I would have to look at the LED, which would take my eyes off of the road and the dog)

The code is written in AVR studio and uses the GCC compiler.  Most of the time, the software is at the ultrasonic transducers resonant points.  (25KHz and 40KHz)  But, the software does move around the output frequency some to get a "siren" effect. 

Did it work?

I have not had a dog chase me since the box was installed on my bicycle.  But, I did try it out on my cat, Willie.  I disabled the human audible peizo emitter near the toggle switch before the test.  (I didn't want that to skew the test.)  The video is at the top of the post.
In all honesty, Willie is 18 years old and doesn't hear well.