Author Topic: Moteino + Spark Core gateway instead of Pi - Solar Powered Weather Station  (Read 58699 times)

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Impressive setup yourself.  I see you're using the SwitchDoc Labs WeatherPiArduino.  How do you like it? 

I haven't seen any ill effects of not using ListenMode.  My battery stays fully charged during the day and at night it only loses a small amount of power even with the rain bucket and the anenometer interrupting the MCU.

I'm thinking of adding Siri.... the cool factor alone is too much to pass up.

My brother-in-law gets full credit for the enclosure.  Damn fine piece of woodworking.  I'll post some more close-up pictures of the outdoor unit when I get back in town later this week.

We finished the first take on the "base station" and the "display" units.  All of the displays share the same network ID so the base station only has to send the data to one address and multiple stations around the house pick it up and display the data.  Since the base station has an 16x2 LCD for time/date/internal temp/humidity, I hacked the OTA code to display "Flashing code.  Please wait." on the screen when I'm updating OTA. 

xavier

  • Jr. Member
  • **
  • Posts: 65
  • Country: us
actually I'm not using WeatherPiArduino, just the weatherRack - I made my own board (always wanted to try!) which interfaces w the weather rack sold on amazon (https://www.amazon.com/gp/product/B00QURVHN6/ref=oh_aui_search_detailpage?ie=UTF8&psc=1) - Got a couple BME280 to get humidity/temp/pressure, works pretty well and it's quite accurate (once you figure out it needs a certain amount of air flow)

Silly question: how did you verify the rain gauge was working fine? I've been trying to find a way to convert say 10ml of water poured into the rain gauge to something I can verify...

I havent implemented OTA, probably should though... Trying now to figure out how to implement a wind speed and wind direction service in homebrdige since HomeKit does not define anything for weather specific devices as far as I know - lmk if you figure it out before me :-)

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
I can't say I've ever tried to verify the rain gauge.  I know it dumps 0.01" of rain each time and beyond that I'm taking it on faith.  I know the numbers I get coincide with the weather folks so it's probably close enough for me.

I've never used homebridge or HomeKit so I probably won't be of any use to you there.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Attached is one picture of the base station showing the screen and several showing the display units.  In case I didn't explain before my setup is "3-tiered".  Sensors of many kinds all gather data and send it to a base station which collects everything.  It has a RTC for logging and time management along with an SD card for logging.  It is also connected to my UPS so I don't lose events when the power goes off.  Finally there are display nodes (all with the same node ID) which display the various status messages all around the house.  The display backlights are turned off at 9pm and then back on at 6am.  The display unit in the bedroom has a small lighted pushbutton which will turn on the backlight for ~ 14 seconds so you can read all three rotating screens and then goes back out.  All displays and the base station also has a DHT11 for local temp/humidity readings.  The base station is serially connected to a Particle Photon which uploads a bunch of data to Freeboard.

All devices support OTA.  For the display units with LCDs (most are 16x2), I slightly hacked Felix's code to display a "Flashing code....please wait" message which appears on the LCD.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
The rest of the "display" pictures.

xavier

  • Jr. Member
  • **
  • Posts: 65
  • Country: us
nice enclosure! did you 3D print it?

Last year I connected a a touch screen to the PI (http://www.aliexpress.com/item/Free-Shipping-A562-2SA562-diode-Amplifier-Transistors-NPN-Silicon-TO-92-Transistor-100pcs-lot-New-and/1891748120.html) and had a proximity sensor to turn the screen on and off when someone walked by but frankly it did not look really good and the lack of enclosure let cables runs lose...I should have spent more time on it - attached is a photo, sensor data is coming from moteinos, 4 day weather was from underground i think. the first pict used the eleduino screen which was not touch-screen and low resolution

I need to upgrade my weather station node to support OTA updates and maybe do better than using breadboard for connections, did u design ur own board for connecting the weather sensors to the moteino?

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Thanks.

The enclosures are from Polycase.  They are from the AG series.  The base station is the large one and the display screens use the medium one.

My brother-in-law laid out perf boards and did all the connections.  We haven't designed PCB's yet.

Nice screen layouts.


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Nice interfaces and screens guys.
@xavier - what interface is that running on the touchscreen?

xavier

  • Jr. Member
  • **
  • Posts: 65
  • Country: us
hey Felix - from a code pov it's pretty ugly but long story short the UI is html5, socket.io to get data from local node server that caches for 1 hour 4 days weather from underground (for rate limiting purposes) and gets data from moteinos.

the grass in the background comes from http://labs.hyperandroid.com/js1k and then I hacked around to add a weather widget that I found online (I can find the code if you want it)

the Pi had a couple of script that would launch matchbox-window-manager and chromium in full screen at boot time and load the web page - I had a couple of local scripts as well to turn the screen on/off if the moteino thought someone was walking by so the screen is not always on.. I'm moving things to iOS now since I mostly now check weather data from my phone (and w the new siri SDK I should be able to just ask my iPhone!)

I'll make a "nice" UI for your nodes if you build me a prototype for my next project  ;D

xavier

  • Jr. Member
  • **
  • Posts: 65
  • Country: us
and just to make sure you enjoy the nice animation from http://labs.hyperandroid.com here is a video :-)

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Good stuff xavier.

I added two pictures of the base station.  One shows the inside and the other shows the rear of the box.  The inside picture shows the two halves of the unit.   The left side shows the Moteino, the Particle Photon, the DHT11, RTC, power jack and the SD card reader.  The right half is the LCD backpack.

The rear picture shows the SD card on the left, the DHT11 in the middle and the power jack on the right hand side.

xavier

  • Jr. Member
  • **
  • Posts: 65
  • Country: us
Fictiv has a breakdown of the netatmo weather module if anyone is interested: http://www.blog.fictiv.com/posts/netatmo-weather-station-teardown-part-1-outdoor-module

they say the module can work for 2 years on 2 AAA batteries a TI sub gig radio sends data to the receiver, arm cortex M3...anyhow, I suppose parts for the module can't be more than $15?

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Recently added a couple of new tricks:

1) Utilizing the Particle Photon, I am using webhooks to send SMS messages when any of the devices in the network (base station, sensors, or display units) boot.  It sends the timestamp and the name of the device.
2) I also use the SMS feature to send messages when the mailbox opens or closes.  This message also includes the current battery voltage.
3) The waterleak detectors also use SMS to send a "hello" packet every 12 hours with the battery voltage.  Of course, a water leak will send an immediate SMS message.
4) The base station sends a packet at midnight to the outdoor weather unit to reset the rain count for the past 24 hours to 0".  The max wind for the last 24 hours is also reset at midnight.

xavier

  • Jr. Member
  • **
  • Posts: 65
  • Country: us
that's neat - I suppose you have an RFM69 connected to the photon? (I suppose the photon is pretty much a feather WICED btw) - I like the idea of the ping to see if node is alive when not communicating at regular intervals.

I opted for putting everything server side (in the cloud!) - so my RFM69s talk to the PI (which is connected to a moteino by serial) - then I have https PHP entry points for saving data from the PI to the cloud server and in that erver I have node+socket.io running for doing RT stuff. The Pi is just a client, so are my iphone, web interface, iphone native app (though my native app just uses the php entry point for getting the data for now).

I reset only the water on a specific interval, the moteino clients are pinged at regular intervals by the PI, the PI runs a scheduler and I can change the timeframes using the web interface (socket.io). the PI then calls the server to save the data in a mysql table, then I can aggregate data there to draw5 min, 1 hour graphs. I only sample the wind data btw for 3 sec when doing a measurement, only the rain is computed on a fixed interval on the moteino and then reset. Not sure if this is optimum but since it never rains in CA I'll have to wait to make sure it works :-) - my garden humidity moteinos are fried so only the weather station is pushing data right now...(just in case you thought I had 10s of moteinos pushing data :-)

I can open up my php entry points if you want to try out the UI, it's not fancy but I can do a couple of changes and send you a https entry point (houseId, apiKey) where you can send your data and you can try out some of the UI. (I may have underestimated how much work I need to do for this but let me know if you want to try it out)

these are the fields I'm using right now in case you want to check it out, if you can fit your data in there it would be relatively easy I suppose...
Code: [Select]
CREATE TABLE `sensorDataTemp` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `houseId` int(11) DEFAULT '-999',
  `sensorId` int(11) DEFAULT '-999',
  `temperature` float DEFAULT '-999',
  `humidity` float DEFAULT '-999',
  `soilHumidity` int(11) DEFAULT '-999',
  `light` int(11) DEFAULT '-999',
  `pressure` float DEFAULT '-999',
  `windSpeed` float DEFAULT '-999',
  `windDirection` int(11) DEFAULT '-1',
  `windSpeedAvg` float DEFAULT '-999',
  `windDirectionAvg` int(11) DEFAULT '-1',
  `rainForPeriod` float DEFAULT '-999',
  `windGustForPeriod` float DEFAULT '-999',
  `batteryLevel` float DEFAULT '0',
  `timestamp` int(11) DEFAULT '0',
  `timestampServer` int(11) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
this is probably overkill for a side project but it's been fun!
« Last Edit: August 19, 2016, 06:34:38 AM by Felix »

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Added a simple temp/humidity sensor for the attic.

It's AC powered and checks in every 15 mins with the temp and humidity.  If the temp is over a pre-set limit it will send a text message.

Added a bunch of multilevel debug (DEBUG, DEBUG1, etc) which helped with a couple of obscure bugs.  Also consolidated the various packet types (enums, structs, and unions) into a library so now I don't have to change 15 copies of things when I want to add a new type of packet.

Hindsight is 20/20.