Advertisement

Friday, July 12, 2013

First beta test of HESA

I performed the first beta test of the Home Environmental Sensor Array at the Milwaukee Makerspace last night.  Unfortunately, the test was not a success.

Setup Headaches
First of all, it took about 30 minutes for me to get completely setup.  I spent most of the time hunting for a monitor with the right kind of HDMI plug.  After giving up on that, I borrowed someones HDMI cable that would connect my PI to a monitor.  I need to get a mini-HDMI to HDMI cable.

Pump Leaks
The next issue I had is that one of my pumps had an output with two openings.  When I turned on the pump, it started spraying water into the air.  I tried fixing that by stuffing the hole with some clear epoxy.  The container says it is water proof not just water resistant so I hope it works and can resist the pressure.

Email Module Issues
After getting everything setup, I fired off the program.  It kicked out with an error related to loading the email module (at least I think that is where the error came from).  My theory is that it was not able to load the module because I was not connected to the internet and an SMTP server.  However, now that I think about it, it was probably trying to SEND an email and could not find an SMTP server.  In any event, I commented the email stuff out and moved on.

GPIO Input Problem
I fired up the program without the email features and it did not raise an error but it immediately exited.  All the wiring looked correct.  I tried turning on debug mode and the program then turned on the PowerSwitch Tail but exited after five seconds.  Hmmm....  Five seconds is the wait time I built-in at the start of the program if it is run in debug mode.  So, the program would turn on the powerswitch tail, pause five seconds then immediately exit.  Why?

Long-story-short, the problem is with the circuit design for detecting power on the input pin.  Tom G. from the Makerspace looked over what I was doing and explained that I can't just connect a lead into the digital GPIO input pin on the Raspberry PI and expect it to work correctly.  Apparently, connecting a wire to an input pin where the wire is open to the air causes unexpected problems.  Tom had two suggestions.

First, he suggested that I abandon the wire as a way to detect water and instead put a float in my crock that will activate a switch that is connected to the circuit on the PI.  When the water rises to the right level, the switch will close and the PI will receive a signal.  A float / switch solution is more reliable than bare wires, it is not dependent on the content of the water (meaning that the resistance of the water is not a factor), nor will it corrode over time.

The other suggestion Tom had was to add a small resistor to the input part of the circuit and connect it to ground.  That would draw off any phantom electrical signals but not stop the real signal from reaching the PI if the circuit got closed.  Adding a resistor would be a simpler solution but still has the disadvantages noted above.

Follow-Ups and Next Steps
I don't really understand why a bare wire plugged in to the GPIO port will generate phantom input signals.  I suspect it is because there is EM radiation in the air at the Makerspace that the lead was picking up.  I will need to do some research into this.

Also, Tom mentioned that the larger the resistor, the more current it will let through.  He suggested that I use a 10k, or better yet, 1k resistor and not a 1M resistor.  The larger resistor will not stop small signals from getting through.  That sounds backwards to me but as I know nothing about electricity, I need to research it.

Maybe I will add a small resistor to the circuit just to make sure it works.  Then, I might build a float switch to make the design more robust.  I should build two float switches--one to send a signal to the HESA, and one to turn on the pump that simulates a sump pump in my test system.