LowPowerLab Forum

Hardware support => Moteino => Topic started by: jlsimmo on December 13, 2014, 11:13:02 AM

Title: Sump Pump Project - General wiring diagram
Post by: jlsimmo on December 13, 2014, 11:13:02 AM
Hi Felix,

This is my first project with Raspberry Pi and Moteino.

I'm just wondering if you have any kind of sketch diagram of how to connect it all up?

I read the entire page at: http://lowpowerlab.com/blog/2013/04/25/sump-pump-alert-with-moteino-hc-sr04/

But didn't really manage to connect all the dots.

One other question... I need to enter my EMONcms code at some point - I assume that's the 'write' code and not the 'read' code - but let me know if I am wrong please.

Can you help?

Thanks,
John
Title: Re: Sump Pump Project - General wiring diagram
Post by: TomWS on December 13, 2014, 05:38:37 PM
Felix,
I hadn't noticed this project before.  My question is, having learned that Sump wells are notoriously unhealthy places for electronics, if, after 1 1/2 years of running, is this still running reliably?

Tom
Title: Re: Sump Pump Project - General wiring diagram
Post by: Felix on December 13, 2014, 06:18:29 PM
@jlsimmo: the wiring is very simple, as seen in the photo:
You need to power The Moteino from a 5V source. Then the HC-SR04 sensor is powered from the Moteino GND+VIN (5V), then ECHO=D3, TRIG=D4, that's it.
@TomWS: yes it's working, no problems.
Title: Re: Sump Pump Project - General wiring diagram
Post by: TomWS on December 13, 2014, 07:24:47 PM
Quote from: Felix on December 13, 2014, 06:18:29 PM
<...snip>
@TomWS: yes it's working, no problems.
Cool! Thanks for the quick response!

My fear was that condensation, mold, etc, would build up on the ultrasonic transducer and affect, at a minimum, the calibration of the sensor.  I suppose, any build up would simply attenuate the signal.  The distance measurement is a function of the speed of sound - independent of any build up.  As long as you get enough signal back then the timing should be constant... (sorry, just thinking out loud)

Tom
Title: Re: Sump Pump Project - General wiring diagram
Post by: Felix on December 13, 2014, 10:42:00 PM
Yep I see your points and they are valid. I have about 35% humidity in my basement, probably double that or more in the sump pump well. I had no issues with it though...
Title: Re: Sump Pump Project - General wiring diagram
Post by: Prodigal on December 14, 2014, 03:07:14 PM
I did a similar project with a Raspberry Pi.  It consists of two bare wires in the crock but above the water.  My Pi sends a signal out one wire and looks for it to come back on the other wire.  When the water rises enough to connect the two wires, the Pi realizes that there is water.  It sends me an email, and turns on the power to a backup pump.  Its been in place for about a year and works great.

I will be adding Moteinos to this project to do more sensing.

The project page is here: http://wiki.milwaukeemakerspace.org/projects/home_environmental_sensor_array (http://wiki.milwaukeemakerspace.org/projects/home_environmental_sensor_array)
The Instructable is here: http://www.instructables.com/id/Home-Environmental-Sensor-Array-Phase-1/ (http://www.instructables.com/id/Home-Environmental-Sensor-Array-Phase-1/)
My blog entries are here: http://beckermaker.blogspot.com/search/label/Home%20environmental%20sensor%20array (http://beckermaker.blogspot.com/search/label/Home%20environmental%20sensor%20array)
Title: Re: Sump Pump Project - General wiring diagram
Post by: Felix on December 15, 2014, 10:33:31 AM
Ken, nice tutorials and blog :)
Title: Re: Sump Pump Project - General wiring diagram
Post by: Reck_law on December 26, 2014, 12:56:13 PM
I am doing the sump pump in reverse.  I am filling a barrel with reverse osmosis water and using the moteino to detect when full.  Has anyone else notices that ripples cause the hc-sr04 to occasionally miss read.  In my code I now read 5 times drop high and low then ace the remaining 3.  This stops my relay for constantly turning the water in on and off.
Title: Re: Sump Pump Project - General wiring diagram
Post by: Felix on December 26, 2014, 03:37:21 PM
Yeah I would do several reads and averaging or make an algorithm to decide whether a read is bad (ie if the reads are too far off from each other).
Title: Re: Sump Pump Project - General wiring diagram
Post by: jlsimmo on January 11, 2015, 11:47:24 PM
Hi,

I have now wired my Sump Pump monitor, run the code, and all seems to be working - with one exception - i cannot get anything written to EMONCMS.

In the code, the setup lines for EMONCMS are:

# EMONCMS Settings
EMONPOST = True
EMONAPIKEY = "your EmonCMS key HERE"
EMONHOST = "localhost"
EMONHOSTPORT = 80
SUMP_LVL_LIMIT = 20
SUMP_ALERT_LASTSENT = 0 # send an email every so often when SUMP pump is dangerously full (minutes)

I added my EMONCMS Key as a long string (32 characters) that is shown as my Write API Key when i log into my EMONCMS account.  Is this correct? It appears not, because i don't see anything being written to the EMONCMS account - when i look at Node, it's empty.

Any help would be appreciated.

Thanks,

John
Title: Re: Sump Pump Project - General wiring diagram
Post by: jlsimmo on January 12, 2015, 09:02:05 AM
Hi,

I am also wondering if I need to edit the "Local Host" text too?

John
Title: Re: Sump Pump Project - General wiring diagram
Post by: Felix on January 12, 2015, 09:12:57 AM
The key is obtained from EmonCMS itself, I think there are read/write keys, you would need the write access key.
The localhost doesn't need to be changed. If you want you can try replacing it with the IP of your Pi on your LAN, but you shouldn't have to.
Title: Re: Sump Pump Project - General wiring diagram
Post by: jlsimmo on January 12, 2015, 04:29:14 PM
Thanks Felix.

I will look deeper into what is going on then.  The Gateway.py script runs in a terminal window, no problem there, but moving the sonar sensor does not result in any messages or any data to EMONCMS, so I will have to look at it and see what is going on.
Title: Re: Sump Pump Project - General wiring diagram
Post by: jlsimmo on January 12, 2015, 10:52:07 PM
Hi,

I switched on the Debug option in the code and I found that the program is waiting for data:

Start - waiting for data on /dev/ttyAMA0 @ 115200 baud...

Any ideas why no data is being sent? Both moteino boards are flashing and I am as sure as I can be that i set everything up correctly.

Thanks again for your help,

John
Title: Re: Sump Pump Project - General wiring diagram
Post by: Felix on January 13, 2015, 09:14:29 AM
You need to make sure your receiver/gateway moteino is receiving the data from the remote node, and that it will put out the received packets to the serial port. Have you verified that?
Title: Re: Sump Pump Project - General wiring diagram
Post by: jlsimmo on January 13, 2015, 07:43:48 PM
Hi - OK sounds good... but how do I do that? 
Title: Re: Sump Pump Project - General wiring diagram
Post by: Felix on January 14, 2015, 08:36:45 AM
You test them, take baby steps. Load them with Node and Gateway sketches in the examples, make sure all the settings are good, set the HW, frequency, node and network IDs. Once those work well, you make your changes for your own sketches, and test those. It helps to have both nodes attached to the same computer to see debugging info at the same time. Then when everything works install them in your Pi and remote locations etc.
Title: Re: Sump Pump Project - General wiring diagram
Post by: jlsimmo on January 16, 2015, 11:08:08 AM
Hi Felix,

I'm so sorry, I really am a newbie to this stuff.  Do you have a link to a step by step process that I can use to set the two Moteino's up and get them talking?  I probably need step by step instructions, but I looked at your site and couldn't find anything - maybe it would be helpful for others too?

Thank you so much,
John
Title: Re: Sump Pump Project - General wiring diagram
Post by: Felix on January 16, 2015, 12:02:59 PM
Please visit lowpowerlab.com/programming
That's a guide to programming/uploading to the boards rather than how to code. And it's codebender focused but you can do the same thing in the Arduino IDE. I don't really have a step by step line by line guide for programming, it's beyond the scope of this website. But that should help at least a little and the code is pretty decently documented with comments and instructions so any person who has coded before should be able to get around fairly easily. The code contains setting sections that you need to understand and change accordingly to your specific hardware (transceiver type) in order to get them working as expected. If you've never coded before then that's a challenge and again unfortunately it's not the scope of this website to teach c++/programming, mostly because of lacking the time/resources to do so.