• Damn Updates that BRAKE things

    Saabman06/10/2018 at 02:23 0 comments

    I still hadnt got around to relocating the Tank temperature sensor to protect it from the boiling water and so needed to replace the Tank Sensor again. No problems just fit a new one up and update the code to accept the new address. 10 minute job and shes apples right - 24Hours later and lost of cursing and going over my code like it was working all I did was change ONE temperature sensor address.

    After much F*&king around I discovered that only 5 of the 6 senors were updating. but for no obvious reason -

    After banging my head against the wall it finally dawned on me since developing this project and the subsequent updates to it I had shifted most of my development from my desktop to a Laptop. A quick checked confirmed I Was running Arduino 1.8x on my Laptop and 1.6x on my desktop - recompiled on the desktop and loaded the NODEMCU board up from the desktop and off it went.

    Arduino people WHY the FK does the update have to actually break working code??  No Errors it just kind of worked. Thats a day of my life I wont get back. I know my codeing skills are rather poor but dont make it any harder than it needs to be. 

  • Failure

    Saabman12/24/2016 at 01:13 2 comments

    hmm the system has been running well for a number of weeks now.

    Logging data happily and producing web pages and graphs - I added a 1.5w solar pannel to keep the battery topped up and that has been working well though a small miscalculation of the divider resistors for the battery voltage monitoring has a max vin of 13v.

    But big issue yesterday afternoon I noticed the tank temperature dropped suddenly from around 90deg to 0. Given the system is still spitting out valid data for other sensors I suspect strongly the tank sensor which is submersed in water has failed - so much for a water proof sensor - I guess they aren't realy designed for continuous submersion in our rather nasty town water.

    I'll replace the sensor in a day or two and maybe rework the voltage divider as well to increase the battery monitoring range. Might even add a over voltage cut off to protect the battery from over chargeing.

  • Python script

    Saabman10/23/2016 at 04:18 0 comments

    Well after some head banging and stuff Ive got soem working python code. if its a bit dodgey sorry its my first attempt at python and quiet frankly I dont have a clue what Im doing but the end result is t will connect to my MQTT broker and subscribe to my MQTT topics and write the data to an SQLlite3 database.

    So now I can get on with loghing the data which I have desperately wanted to do all winter - now winter has come to an end - Oh well I expect to see lots of very high temps by lunchtime most days.

    Interesting just while its beenrunning and Ive been playng with it I have already found the freeze point in the system which has caused me to have no hot water on a couple of days this year - its been a very mild wet winter here so not much problem with freezing but next year will probably be nasty.

    I have a lot tlearn about writing python so now im not trying to make this project work Ill go back and do some tutorials and learn what Ive done and come back and fix things like my bunch of global variables in a function.

  • Createing the Database

    Saabman10/17/2016 at 10:24 0 comments

    This is a type while thinking log.

    Ive already installed SQL lite on the Pi so for the time being thats what ill use - this may change in the future but will do for now.

    Things I have - Data set every 15minutes from the Hotwater heater

    • Battery Voltage
    • Ambient Temp
    • Tank Temp
    • Booster Temp
    • Inlet Temp

    Each value is published to its own MQTT Topic.

    • HOME/SOLAR/WATER/BATTERY
    • HOME/SOLAR/WATER/TEMP/AMBIENT
    • HOME/SOLAR/WATER/TEMP/TANK
    • HOME/SOLAR/WATER/TEMP/BOOSTER
    • HOME/SOLAR/WATER/TEMP/INLET

    What I need now is a way to read the values published and store them in a database and include the time they are stored.

    I am planing to use a python script to do the dirty work.

    It needs to know when new data is written to each topic and write it to the DB.

    My data base needs

    Date Time Battery_Voltage Ambient_Temp Tank_Temp Booster_Temp Inlet_Temp

    I created a db solarwater.db

    then created the table

    BEGIN;
    CREATE TABLE Hotwater (tdate DATE, ttime TIME, Battery NUMERIC, Ambient NUMERIC, Tank NUMERIC, Booster NUMERIC, Inlet NUMERIC);
    COMMIT;

    Now to get Python to read the Topics and populate the DB

  • accessingthe data

    Saabman10/16/2016 at 09:52 0 comments

    Now that I have regular data coming from the hotwater heater now I need to store that data in a database and make it available for retrieval.

    I initaly plan is to use a python scriptto subscribe to the MQTT topics and place the data into a SQLlite db along with a time stamp ready for access and analysis.

  • Deep sleep

    Saabman10/16/2016 at 09:47 0 comments

    From my previous experiments with NODEMCU boards running off a battery I was only getting about a week from a device updating every 2 seconds running of a 12V 7AH battery. Now I figgured a 2 second update is a bit excessive and between samples the NODEMCU is just sucking power so I have added

    ESP.deepSleep(15 * 60 * 1000000);

    after all the data has been sent to the broker.

    What this does is put the ESP to into deep sleep for 15 minutes after which it wakes up connectes to the AP sends the data to the broker and goes back to sleep.

    In order to have the NODE MCU wake its self up it was necesary to connect D0 to RST

    I also noticed on the board I omitted the 4K7 pull up resistor for the one wire data bus.

    I Was happy with the way this all worked so I popped the module in a box - I have a pile of cheap plastic food starage conatiners and theyare great as reasonably water proof enclosures for these pseudo temperay projects.

    The sensors are now mounted on the HW heater -

    • One in the tank - As my tank is open vented I just dropped the sensor in through the vent hole and sits roughly in the middle of the tank.
    • The return from the booster sensor is slipped under the pipe insulation and I attempted to push it down to just below the bottom of the tank to reduces the impact of the tank temperature.
    • Inlet sensor underr the insulation on the inlet pipe
    • Ambient temp is just a to92 package ds1820 mounted on the PCB this sits on top of the tank so is effected by the tank heat leakage.

    I did implement a 5th sensor for the water temp to the booster which comes from the bottom of the tank but i decided in the end that this was of limited vaue and required etending the leads to the sensor some what whaich at this stage I dont feel is of benfit - I may implement it at some later stage.

    So now the NODEMCU sends data to the MQTT broker on the raspberry PI and the latest values can be viewd by subscribing to the appropriate Topic.

    Currently

    • Battery Voltage 12.53V
    • Ambient Temp 23deg C
    • Tank Temp 91.94 deg C
    • Booster temp 20.25 deg C
    • inlet temp 32.56 deg C

    Unfortunatley due to lead length constraints the inlet temp sensor is too close to the tank so reads substantialy high - a modified location is needed and the ambient temp senor needs to be moved away from the tank also as the actual temp is curently 17.5deg C

  • Firmware Update

    Saabman10/10/2016 at 09:35 0 comments

    I had been struggling with sending a floating point value to the MQTTserver. The MQTT implememtation sends a string and message was formatted by using snprintf to create a string array from the data but it doesnt seem to work with floating point values.

    I had been getting around it by multiplying the temperature and volatge readings by 100 converting to and int and then sending that figgure. The plan was to read the value later and divide by 100 to recreate the 2 decimal places I wanted - 1 decimal place would be more than adequate but.

    Figgureing someone else must have had to deal with this situation I applied some good google foo and found a Home Assistant tutorial by Paulus Schoutsen that did just what I wanted and he used

    client.publish(temperature_topic, String(temp).c_str(), true);

    https://home-assistant.io/blog/2015/10/11/measure-temperature-with-esp8266-and-report-to-mqtt/

    .c_str() was just what I needed so updated my client.publish and gotrid of the *100 business - all much tidier.

    Thanks Paul :)

    Now having seen the Home Assistant project I think that might give mesome more toolsto use in what I wish to achieve.

  • Firmware stage one

    Saabman10/07/2016 at 11:05 0 comments

    I now have the firmware working to read the DS1820 temp sensors and battery voltage and print the vaules on the arduino serial monitor.

    This doesnt seem like much and could have just used one of the example files of the net but that would not integrate nicely with my next step of sending the data to my MQTT server via wifi.

    A point of interest when designed the board to hold the NodeMCU module I mistakenly caluclated the resitive divider network for the Battery monitor believing that the NODEMCU had a 1V ADC input as per the ESP8266 but the NODEMCU board already has a divider built in to allow the Ain to read up to 3V.

  • Specs

    Saabman09/25/2016 at 01:06 0 comments

    I Would like to monitor

    • Ambient Temp
    • Tank Temp
    • To Booster Temp
    • From Booster Temp
    • Supply Water Temp
    • Battery Voltage ( The sensor unit will be mounted on the roof and powered by a 12V SLA for the moment with possible Solar charging)

    Use a Node MCU Board

    5 DS1822 water proof Sensors

    From experience using the NODE MCU board running a logging system updateing a BLYNK server every 2 seconds a 12V 12AH SLA last about a week.

    I dont think I need that kind of resolution so will initially set the update rate to once every 15minutes and put the ESP8266 to sleep between updates. As I will me monitoring the battery voltage I will be able to reasses the energy requirements once I start to obtain real data