Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Thucar
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Thucar

    @Thucar

    IoT & Smart Home enthusiast. Love making Things understand each other.

    46
    Reputation
    64
    Posts
    589
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Location Estonia Age 41

    Thucar Follow

    Best posts made by Thucar

    • RE: MY_GATEWAY_TINYGSM

      It is alive!!!

      MQTT Client gateway with GSM modems and ESP8266 as a modem seems to be working as intended.

      To replicate, do this:

      • Install the TinyGSM library
      • Use this MyGatewayTransportMQTTClient.cpp
      /*
      * The MySensors Arduino library handles the wireless radio link and protocol
      * between your home built sensors/actuators and HA controller of choice.
      * The sensors forms a self healing radio network with optional repeaters. Each
      * repeater and gateway builds a routing tables in EEPROM which keeps track of the
      * network topology allowing messages to be routed to nodes.
      *
      * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
      * Copyright (C) 2013-2017 Sensnology AB
      * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
      *
      * Documentation: http://www.mysensors.org
      * Support Forum: http://forum.mysensors.org
      *
      * This program is free software; you can redistribute it and/or
      * modify it under the terms of the GNU General Public License
      * version 2 as published by the Free Software Foundation.
      */
      
      
      // Topic structure: MY_MQTT_PUBLISH_TOPIC_PREFIX/NODE-ID/SENSOR-ID/CMD-TYPE/ACK-FLAG/SUB-TYPE
      
      #include "MyGatewayTransport.h"
      
      #if defined MY_CONTROLLER_IP_ADDRESS
      IPAddress _brokerIp(MY_CONTROLLER_IP_ADDRESS);
      #endif
      
      #if defined(MY_IP_ADDRESS)
      IPAddress _MQTT_clientIp(MY_IP_ADDRESS);
      #if defined(MY_IP_GATEWAY_ADDRESS)
      IPAddress _gatewayIp(MY_IP_GATEWAY_ADDRESS);
      #elif defined(MY_GATEWAY_ESP8266) /* Elif part of MY_IP_GATEWAY_ADDRESS */
      // Assume the gateway will be the machine on the same network as the local IP
      // but with last octet being '1'
      IPAddress _gatewayIp(_MQTT_clientIp[0], _MQTT_clientIp[1], _MQTT_clientIp[2], 1);
      #endif /* End of MY_IP_GATEWAY_ADDRESS */
      #if defined(MY_IP_SUBNET_ADDRESS)
      IPAddress _subnetIp(MY_IP_SUBNET_ADDRESS);
      #elif defined(MY_GATEWAY_ESP8266) /* Elif part of MY_IP_SUBNET_ADDRESS */
      IPAddress _subnetIp(255, 255, 255, 0);
      #endif /* End of MY_IP_SUBNET_ADDRESS */
      #endif /* End of MY_IP_ADDRESS */
      
      #if defined(MY_GATEWAY_ESP8266)
      #define EthernetClient WiFiClient
      #elif defined(MY_GATEWAY_LINUX)
      // Nothing to do here
      #else
      uint8_t _MQTT_clientMAC[] = { MY_MAC_ADDRESS };
      #endif /* End of MY_GATEWAY_ESP8266 */
      
      #ifdef MY_GATEWAY_TINYGSM
      #include <TinyGsmClient.h>
      static TinyGsm modem(SerialAT);
      static TinyGsmClient _MQTT_gsmClient(modem);
      static PubSubClient _MQTT_client(_MQTT_gsmClient);
      #if defined(MY_GSM_BAUDRATE)
      uint32_t rate = MY_GSM_BAUDRATE;
      #else
      uint32_t rate = 0;
      #endif
      #else
      static EthernetClient _MQTT_ethClient;
      static PubSubClient _MQTT_client(_MQTT_ethClient);
      #endif /* End of MY_GATEWAY_TINYGSM */
      
      
      static bool _MQTT_connecting = true;
      static bool _MQTT_available = false;
      static MyMessage _MQTT_msg;
      
      bool gatewayTransportSend(MyMessage &message)
      {
      	if (!_MQTT_client.connected()) {
      		return false;
      	}
      	setIndication(INDICATION_GW_TX);
      	char *topic = protocolFormatMQTTTopic(MY_MQTT_PUBLISH_TOPIC_PREFIX, message);
      	GATEWAY_DEBUG(PSTR("GWT:TPS:TOPIC=%s,MSG SENT\n"), topic);
      #if defined(MY_MQTT_CLIENT_PUBLISH_RETAIN)
      	bool retain = mGetCommand(message) == C_SET ||
      	              (mGetCommand(message) == C_INTERNAL && message.type == I_BATTERY_LEVEL);
      #else
      	bool retain = false;
      #endif /* End of MY_MQTT_CLIENT_PUBLISH_RETAIN */
      	return _MQTT_client.publish(topic, message.getString(_convBuffer), retain);
      }
      
      void incomingMQTT(char* topic, uint8_t* payload, unsigned int length)
      {
      	GATEWAY_DEBUG(PSTR("GWT:IMQ:TOPIC=%s, MSG RECEIVED\n"), topic);
      	_MQTT_available = protocolMQTTParse(_MQTT_msg, topic, payload, length);
      }
      
      bool reconnectMQTT(void)
      {
      	GATEWAY_DEBUG(PSTR("GWT:RMQ:MQTT RECONNECT\n"));
      	// Attempt to connect
      	if (_MQTT_client.connect(MY_MQTT_CLIENT_ID
      #if defined(MY_MQTT_USER) && defined(MY_MQTT_PASSWORD)
      	                         , MY_MQTT_USER, MY_MQTT_PASSWORD
      #endif
      	                        )) {
      		GATEWAY_DEBUG(PSTR("GWT:RMQ:MQTT CONNECTED\n"));
      
      		// Send presentation of locally attached sensors (and node if applicable)
      		presentNode();
      
      		// Once connected, publish an announcement...
      		//_MQTT_client.publish("outTopic","hello world");
      		// ... and resubscribe
      		_MQTT_client.subscribe(MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "/+/+/+/+/+");
      		return true;
      	}
      	return false;
      }
      
      bool gatewayTransportConnect(void)
      {
      #if defined(MY_GATEWAY_ESP8266)
      	while (WiFi.status() != WL_CONNECTED) {
      		wait(500);
      		GATEWAY_DEBUG(PSTR("GWT:TPC:CONNECTING...\n"));
      	}
      	GATEWAY_DEBUG(PSTR("GWT:TPC:IP=%s\n"),WiFi.localIP().toString().c_str());
      #elif defined(MY_GATEWAY_LINUX) /* Elif part of MY_GATEWAY_ESP8266 */
      #if defined(MY_IP_ADDRESS)
      	_MQTT_ethClient.bind(_MQTT_clientIp);
      #endif /* End of MY_IP_ADDRESS */
      #elif defined(MY_GATEWAY_TINYGSM)
          GATEWAY_DEBUG(PSTR("GWT:TPC:IP=%s\n"), modem.getLocalIP().c_str());
      #else /* Else part of MY_GATEWAY_ESP8266 */
      #if defined(MY_IP_ADDRESS)
      	Ethernet.begin(_MQTT_clientMAC, _MQTT_clientIp);
      #else /* Else part of MY_IP_ADDRESS */
      	// Get IP address from DHCP
      	if (!Ethernet.begin(_MQTT_clientMAC)) {
      		GATEWAY_DEBUG(PSTR("!GWT:TPC:DHCP FAIL\n"));
      		_MQTT_connecting = false;
      		return false;
      	}
      #endif /* End of MY_IP_ADDRESS */
      	GATEWAY_DEBUG(PSTR("GWT:TPC:IP=%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "\n"),
      	              Ethernet.localIP()[0],
      	              Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
      	// give the Ethernet interface a second to initialize
      	delay(1000);
      #endif /* End of MY_GATEWAY_ESP8266 */
      	return true;
      }
      
      bool gatewayTransportInit(void)
      {
      	_MQTT_connecting = true;
      
      #if defined(MY_GATEWAY_TINYGSM)
      
      #if defined(MY_GSM_RX) && defined(MY_GSM_TX)
      	SoftwareSerial SerialAT(MY_GSM_RX, MY_GSM_TX);
      #else
      	// TODO: Needs sanity checks
      #endif
      
      #if !defined(MY_GSM_BAUDRATE)
      	rate = TinyGsmAutoBaud(SerialAT);
      #endif
      
      	SerialAT.begin(rate);
      	delay(3000);
      
      	modem.restart();
      
      #if defined(MY_GSM_PIN) && !defined(TINY_GSM_MODEM_ESP8266)
      	modem.simUnlock(MY_GSM_PIN);
      #endif
      
      #ifndef TINY_GSM_MODEM_ESP8266
      	if (!modem.waitForNetwork()) {
      		GATEWAY_DEBUG(PSTR("!GWT:TIN:GPRS FAIL\n"));
      		while (true);
      	}
      	GATEWAY_DEBUG(PSTR("GWT:TIN:GPRS OK\n"));
      
      	if (!modem.gprsConnect(MY_GSM_APN, MY_GSM_USR, MY_GSM_PSW)) {
      		GATEWAY_DEBUG(PSTR("!GWT:TIN:APN FAIL\n"));
      		while (true);
      	}
      	GATEWAY_DEBUG(PSTR("GWT:TIN:APN OK\n"));
      	delay(1000);
      #else
          if (!modem.networkConnect(MY_GSM_SSID, MY_GSM_PSW)) {
              GATEWAY_DEBUG(PSTR("!GWT:TIN:WIFI AP FAIL\n"));
              while (true);
            }
            GATEWAY_DEBUG(PSTR("GWT:TIN:WIFI AP OK\n"));
            delay(1000);
      #endif
      
      #endif /* End of MY_GATEWAY_TINYGSM */
      
      #if defined(MY_CONTROLLER_IP_ADDRESS)
      	_MQTT_client.setServer(_brokerIp, MY_PORT);
      #else
      	_MQTT_client.setServer(MY_CONTROLLER_URL_ADDRESS, MY_PORT);
      #endif /* End of MY_CONTROLLER_IP_ADDRESS */
      
      	_MQTT_client.setCallback(incomingMQTT);
      
      #if defined(MY_GATEWAY_ESP8266)
      	// Turn off access point
      	WiFi.mode(WIFI_STA);
      #if defined(MY_ESP8266_HOSTNAME)
      	WiFi.hostname(MY_ESP8266_HOSTNAME);
      #endif /* End of MY_ESP8266_HOSTNAME */
      #if defined(MY_IP_ADDRESS)
      	WiFi.config(_MQTT_clientIp, _gatewayIp, _subnetIp);
      #endif /* End of MY_IP_ADDRESS */
      #ifndef MY_ESP8266_BSSID
      #define MY_ESP8266_BSSID NULL
      #endif
      	(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD, 0, MY_ESP8266_BSSID);
      #endif /* End of MY_GATEWAY_ESP8266 */
      
      	gatewayTransportConnect();
      
      	_MQTT_connecting = false;
      	return true;
      }
      
      bool gatewayTransportAvailable(void)
      {
      	if (_MQTT_connecting) {
      		return false;
      	}
      	//keep lease on dhcp address
      	//Ethernet.maintain();
      	if (!_MQTT_client.connected()) {
      		//reinitialise client
      		if (gatewayTransportConnect()) {
      			reconnectMQTT();
      		}
      		return false;
      	}
      	_MQTT_client.loop();
      	return _MQTT_available;
      }
      
      MyMessage & gatewayTransportReceive(void)
      {
      	// Return the last parsed message
      	_MQTT_available = false;
      	return _MQTT_msg;
      }
      
      
      • Define these in your gateway sketch:
      #define MY_GATEWAY_MQTT_CLIENT
      // Enable gateway ethernet module type
      #define MY_GATEWAY_TINYGSM
      
      // Define the GSM modem. See TinyGSM documentation for full list
      //#define TINY_GSM_MODEM_ESP8266
      #define TINY_GSM_MODEM_A6
      #define MY_GSM_APN "internet" // your mobile providers APN
      #define MY_GSM_USR "" // Leave empty if not used
      #define MY_GSM_PIN "" // Leave empty if not used
      #define MY_GSM_PSW "" // This is either your mobile providers password or WiFi password, depending if you are using the ESP8266 or a GSM modem
      #define MY_GSM_SSID ""
      
      // Use Hardware Serial on Mega, Leonardo, Micro
      #define SerialAT Serial1
      #define MQTT_VERSION MQTT_VERSION_3_1 // I apparently need this to be able to run mosquitto
      
      posted in Development
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      A long overdue update.

      In the end I basically ended up using a GSM gateway with a LCD and couple sensors (air temperature and air humidity) and two relays. The relays control my Dutch bucket system pump and ventilation fans.

      As a separate sensor I'm using a Z-Wave multisensor to keep track of nursery temperatures and lux levels.

      The pH meter module did arrive but I do not feel comfortable keeping it submerged in the nutrient solution at all times so I've been just taking a sample of the nutrient solution from the tank after mixing a new batch, and testing it indoors, at the computer.

      As for the EC meter, I failed to get any of the "arduino only" examples to produce reliable readings. So I've ordered 5 PCB's for this thing: https://www.sparkyswidgets.com/portfolio-item/miniec-i2c-ec-interface/
      Once they arrive, I'll see if I can get more reliable results with a separate module.

      So far the whole thing has been running almost perfectly. The only drawback is an occasional reboot of the gateway when switching off the Dutch bucket system pump. I'm using two separate power sources for Arduino and the pump, Added a 1000uF cap to the Arduino power rail and a flyback diode across the pumps power lines. Still getting that reboot about 50% of the time.

      Some pics to wrap up my rant.
      PS. Yes, that's a webcam in my greenhouse. It's taking hourly snapshots for a timelapse 🙂

      0_1526815202323_P5201185_v1.JPG
      My NFT rails for herbs. A good eye can spot some dill, basil and cilantro plants in there.
      0_1526815222254_P5201186_v1.JPG
      That's my "Nursery" - an old fish tank I can cover with a piece of glass when night temps dip below 10C
      0_1526815238126_P5201187_v1.JPG
      That's my Fibaro Motion sensor. An easy way to get some essential readings. Like the length of day, hours of sunlight, temperature.
      0_1526815313192_P5201191_v1.JPG
      This is my ratsnest. I should have moved the relays to a separate enclosure further away. Right now I think the arc when breaking contact is what's causing an EMP pulse and rebooting my Mega.
      0_1526815355995_P5201190_v1.JPG
      Ventilation fans. The temps soared to high 40's and low 50's with door and both ceiling hatches wide open. The fans kick in when air temp reaches 25C
      0_1526815372094_P5201193_v1.JPG

      posted in My Project
      Thucar
      Thucar
    • RE: What did you build today (Pictures) ?

      Built half of my dutch bucket system. Namely the drain part. Irrigation to follow.

      0_1523760716315_P4141131_v1.JPG 0_1523760724731_P4141133_v1.JPG 0_1523760736892_P4141140_v1.JPG 0_1523760744189_P4141141_v1.JPG
      0_1523760676911_P4141144_v1.JPG

      posted in General Discussion
      Thucar
      Thucar
    • MySensors Hydroponics Greenhouse project

      So, I’ve been using MySensors all around the house as test devices. I also set up a solar powered Beehive node last autumn, to monitor my hives conditon (went a bit overboard with a total of 6 temp sensors and a humidity sensor.) By the way, the sensors ended up saving my bees.

      Anyhow, I’m now tackling my biggest project yet. A 6.6m2 greenhouse which I’ll be converting to hydroponics. 44 dutch buckets for tomatos, cucumbers, radishes and a vertical NFT system for herbs.

      The goal for now is to monitor the following:

      • Nutrient solution pH levels - a kit from Aliexpress
      • Nutrient solution EC(parts per million) - a probe from Aliexpress
      • Nutrient solution temperature - NTC thermistor 10k
      • Nutrient solution level in the tank - ultrasonic transceiver
      • Dutch bucket substrate moisture - Moisture pitchfork
      • Ambient air temperature - NTC thermistor 10k
      • Ambient air relative humidity - SHT21
      • Ambient light levels - BH1750
      • Some way to monitor if the water is flowing?

      As for the actuators, my greenhouse ventilation windows are operated by sylinders with heat expanding gas. So I will have no direct control over them. The only thing I’m thinking that needs operating, are the circulation pumps. I’ll be using a simple dual relay module for that at first with the possibility of switching to a mosfet later on, as it seems the pumps might respond well to a variable input voltage and thus, allow me to fine tune the rate of liquid flow.

      The brains for the operation will be Arduino Mega with a sensors shield. I only later realized it's an Uno shield, but luckily the pinouts match and I should be able to use it without much hassle. Might actually be a good thing because I can use a dedicated header for the radio and whatever else I need to connect to the 22+ ports.

      posted in My Project
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      Got some work done on the hardware side of things. Drainage is done, next up is feed part.

      0_1523760716315_P4141131_v1.JPG
      0_1523760999160_P4141137_v1.JPG 0_1523761006369_P4141139_v1.JPG
      0_1523760989088_P4141136_v1.JPG 0_1523760724731_P4141133_v1.JPG 0_1523760736892_P4141140_v1.JPG 0_1523760744189_P4141141_v1.JPG
      0_1523760676911_P4141144_v1.JPG

      posted in My Project
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      A quick video update: https://youtu.be/vnUFV_amSPQ
      The tomatos and peas are trying to go through the roof. Cucumbers are close to follow. They are all aiming for the ventilation hatches - I think they are planning a grand escape...

      The NFT system pump stopped working coupe weeks after setting it up. Have not gotten around to ordering a new pump. That will be a project for next year.

      posted in My Project
      Thucar
      Thucar
    • RE: Secondary ESP8266 gateway

      Guess we can mark this one down to iffy PA/LNA modules. After verifying that a repeater solves the problem, I replaced both, the gateway and beehive sensor radios out for regular nrf24l01's. At first I had a repeater as well in between the two, but after making sure the communication was there, I disconnected the repeater.

      And lo and behold - the communication still works fine. So now I modified the gateway radio by cutting the pcb antenna trace and soldering in a SMA connector. Now I have a high DBi wireless antenna attached to the gateway and no more reception issues.

      posted in Troubleshooting
      Thucar
      Thucar
    • MY_GATEWAY_TINYGSM

      I've been toying with this idea for a while now. Have attempted it once before, got stuck and am trying again now.

      The idea is simple - have a GSM/GPRS modem connected to your gateway so you can set it up in a remote location, stick a SIM card in it and be done.

      I chose the TinyGSM library due to its light weight and active maintenance by the author. As an added benefit, the library supports the ESP8266 as well. So you can have a beefy arduino with plenty of IOs as your Gateway and have the ESP just do your wireless networking for you.

      Supported modems

      • SIMCom SIM800 series (SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868)
      • SIMCom SIM900 series (SIM900A, SIM900D, SIM908, SIM968)
      • AI-Thinker A6, A6C, A7, A20
      • U-blox SARA U201 (alpha)
      • ESP8266 (AT commands interface, similar to GSM modems)
      • Digi XBee WiFi and Cellular (using XBee command mode)
      • Neoway M590

      More modems may be supported later:

      • Quectel M10, M95, UG95
      • SIMCom SIM5320, SIM5360, SIM5216, SIM7xxx
      • Telit GL865
      • ZTE MG2639
      • Hi-Link HLK-RM04

      Right now I'm at a point where I can get the code to compile, the modem gets initialized, connection to the internet is achieved and in Client mode, the GW tries to connect to the predefined address/port.

      Unfortunately I have yet to find a controller that allows incoming gateway connections, so I have not managed to test it. And my network contract on the SIM does not have static IP or open ports, so can't test it as a regular server.

      Working on trying to set up a MQTT gateway now. With this nasty flu I have, it's not going too smoothly.

      i'm doing my testing/development here: https://github.com/thucar/MySensors

      posted in Development
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      Update:
      LCD + rotary click encoder working
      ArduinoMenu4 in place and easily expandable.
      Relay control works 100%
      EC/ppm measurement in place, not yet 100% working
      SHT21 code in place, can confirm if working or not once the darn thing arrives

      Some eye candy:
      0_1521972359235_P3251110_v1.JPG0_1521972941808_P3251111_v1.JPG
      0_1521972951209_P3251112_v1.JPG 0_1521972959027_P3251113_v1.JPG 0_1521972966435_P3251114_v1.JPG

      posted in My Project
      Thucar
      Thucar
    • RE: Secondary ESP8266 gateway

      The tin foil wrap tip should definitely be mentioned on the radio page. That trick really works wonders. I used ventilation aluminum foil tape. The glue on it acts as insulation so no need to use food wrap. It's also thicker than regular food grade tin foil and it being a tape makes it super easy to use.

      posted in Troubleshooting
      Thucar
      Thucar

    Latest posts made by Thucar

    • RE: project for some farming

      I’d look into Node-Red. It’s perfect for a simple system like that but it will be able to handle pretty much anything else he decides to throw at it down the line.

      posted in My Project
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      A quick video update: https://youtu.be/vnUFV_amSPQ
      The tomatos and peas are trying to go through the roof. Cucumbers are close to follow. They are all aiming for the ventilation hatches - I think they are planning a grand escape...

      The NFT system pump stopped working coupe weeks after setting it up. Have not gotten around to ordering a new pump. That will be a project for next year.

      posted in My Project
      Thucar
      Thucar
    • RE: Feasibility / Brainstorm for idea of Mobile outdoor Mysensors Network

      As you will be wanting to receive the information and perform actions in the vicinity of the GW, I would go with a RPi + NodeRed + NRF24. Then switch the Raspi into Access Point mode and you'll be able to hook your phone up to it to receive notifications and control settings.
      For a GSM connection, either add a USB modem or a GSM module to the IO pins, then connect to a MQTT broker on a VPS

      That way you will only need to supply power to the Raspi and you're done.

      posted in Development
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      Confirmed. Removing the jumper and using a power supply separate from the arduino’s has cured it from reboot issues.

      posted in My Project
      Thucar
      Thucar
    • RE: node-red-contrib-mysensors release thread

      Awesome work! I was trying to create a bridge between a MQTT gateway and a Serial gateway (over TCP) so I could use firmware upload function of the MySController. However for some reason it seems to only work one way. I can send commands from the MySController to MQTTGateway but nothing is being received on the MySController side when data is sent from MQTT

      This is my flow, would be awesome if someone would spot the issue...

      [{"id":"e6a66581.c16ec8","type":"mysdecode","z":"229ed636.c3ff2a","name":"","mqtt":false,"x":450,"y":460,"wires":[["58ac0291.04974c","a3ba801.a63be8"]]},{"id":"eb5b52a1.29566","type":"tcp in","z":"229ed636.c3ff2a","name":"","server":"server","host":"","port":"5003","datamode":"stream","datatype":"utf8","newline":"\\n","topic":"","base64":false,"x":270,"y":460,"wires":[["e6a66581.c16ec8","ab0f8982.8a9588","78954899.688c28"]]},{"id":"58ac0291.04974c","type":"debug","z":"229ed636.c3ff2a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":510,"y":560,"wires":[]},{"id":"a3ba801.a63be8","type":"mysencode","z":"229ed636.c3ff2a","name":"","mqtt":true,"mqtttopic":"myGreenhouse-in","x":1040,"y":200,"wires":[["8d64662e.fbada8","595543a3.f537cc"]]},{"id":"ab0f8982.8a9588","type":"globalGetSet","z":"229ed636.c3ff2a","name":"Save Session","topic":"","context":"msg","variable":"_session","outContext":"global","outVar":"_session","x":440,"y":420,"wires":[[]]},{"id":"78954899.688c28","type":"debug","z":"229ed636.c3ff2a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":500,"y":720,"wires":[]},{"id":"cdf94190.9fb8e","type":"myscontroler","z":"229ed636.c3ff2a","database":"5fdbb924.88fb48","name":"","handleid":true,"x":770,"y":200,"wires":[["a3ba801.a63be8"]]},{"id":"8d64662e.fbada8","type":"mqtt out","z":"229ed636.c3ff2a","name":"","topic":"","qos":"","retain":"","broker":"1920bc44.5c3304","x":1270,"y":200,"wires":[]},{"id":"595543a3.f537cc","type":"debug","z":"229ed636.c3ff2a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1270,"y":260,"wires":[]},{"id":"c800320f.2a2b","type":"mysdecode","z":"229ed636.c3ff2a","name":"","mqtt":true,"x":560,"y":200,"wires":[["cdf94190.9fb8e","aa22f275.cc8ec"]]},{"id":"2222f84e.56c4e8","type":"mqtt in","z":"229ed636.c3ff2a","name":"","topic":"myGreenhouse-out/#","qos":"2","broker":"1920bc44.5c3304","x":320,"y":200,"wires":[["41588b7e.b61114","c800320f.2a2b"]]},{"id":"aa22f275.cc8ec","type":"switch","z":"229ed636.c3ff2a","name":"","property":"nodeId","propertyType":"msg","rules":[{"t":"eq","v":"203","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":360,"wires":[[],["ea8a0d53.8140b"]]},{"id":"41588b7e.b61114","type":"debug","z":"229ed636.c3ff2a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":530,"y":260,"wires":[]},{"id":"ea8a0d53.8140b","type":"mysencode","z":"229ed636.c3ff2a","name":"","mqtt":false,"mqtttopic":"","x":870,"y":420,"wires":[["2036eda1.dd8bf2","ad5ca8e4.1c4f68"]]},{"id":"2036eda1.dd8bf2","type":"debug","z":"229ed636.c3ff2a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1030,"y":460,"wires":[]},{"id":"ad5ca8e4.1c4f68","type":"globalGetSet","z":"229ed636.c3ff2a","name":"Load Session","topic":"","context":"global","variable":"_session","outContext":"msg","outVar":"_session","x":1060,"y":420,"wires":[["cb6d084b.432238","f99fd97d.5f73c8"]]},{"id":"cb6d084b.432238","type":"tcp out","z":"229ed636.c3ff2a","host":"localhost","port":"5003","beserver":"reply","base64":true,"end":false,"name":"","x":1250,"y":420,"wires":[]},{"id":"f99fd97d.5f73c8","type":"debug","z":"229ed636.c3ff2a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1240,"y":480,"wires":[]},{"id":"5fdbb924.88fb48","type":"mysensorsdb","z":"","name":"Device DB","file":"sqlite"},{"id":"1920bc44.5c3304","type":"mqtt-broker","z":"","name":"LocalNew","broker":"localhost","port":"8883","tls":"","clientid":"Node-RedHome","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""}]```
      posted in Node-RED
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      Disconnecting the load eliminates the issue flat out.

      I think your previous question just triggered a lightbulb. While the module does have optocouplers in place, I have the VCC bridging jumper in place. So essentially Arduino is still sharing the power with relay coils. I'll install a step-down to get a 5V line from the pump power supply and use that to drive the relays. I believe that should eliminate my reboot issues.

      posted in My Project
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      Yes, the relay module has optocouplers separating data lines from the relays.

      posted in My Project
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      A long overdue update.

      In the end I basically ended up using a GSM gateway with a LCD and couple sensors (air temperature and air humidity) and two relays. The relays control my Dutch bucket system pump and ventilation fans.

      As a separate sensor I'm using a Z-Wave multisensor to keep track of nursery temperatures and lux levels.

      The pH meter module did arrive but I do not feel comfortable keeping it submerged in the nutrient solution at all times so I've been just taking a sample of the nutrient solution from the tank after mixing a new batch, and testing it indoors, at the computer.

      As for the EC meter, I failed to get any of the "arduino only" examples to produce reliable readings. So I've ordered 5 PCB's for this thing: https://www.sparkyswidgets.com/portfolio-item/miniec-i2c-ec-interface/
      Once they arrive, I'll see if I can get more reliable results with a separate module.

      So far the whole thing has been running almost perfectly. The only drawback is an occasional reboot of the gateway when switching off the Dutch bucket system pump. I'm using two separate power sources for Arduino and the pump, Added a 1000uF cap to the Arduino power rail and a flyback diode across the pumps power lines. Still getting that reboot about 50% of the time.

      Some pics to wrap up my rant.
      PS. Yes, that's a webcam in my greenhouse. It's taking hourly snapshots for a timelapse 🙂

      0_1526815202323_P5201185_v1.JPG
      My NFT rails for herbs. A good eye can spot some dill, basil and cilantro plants in there.
      0_1526815222254_P5201186_v1.JPG
      That's my "Nursery" - an old fish tank I can cover with a piece of glass when night temps dip below 10C
      0_1526815238126_P5201187_v1.JPG
      That's my Fibaro Motion sensor. An easy way to get some essential readings. Like the length of day, hours of sunlight, temperature.
      0_1526815313192_P5201191_v1.JPG
      This is my ratsnest. I should have moved the relays to a separate enclosure further away. Right now I think the arc when breaking contact is what's causing an EMP pulse and rebooting my Mega.
      0_1526815355995_P5201190_v1.JPG
      Ventilation fans. The temps soared to high 40's and low 50's with door and both ceiling hatches wide open. The fans kick in when air temp reaches 25C
      0_1526815372094_P5201193_v1.JPG

      posted in My Project
      Thucar
      Thucar
    • RE: MySensors Hydroponics Greenhouse project

      Got some work done on the hardware side of things. Drainage is done, next up is feed part.

      0_1523760716315_P4141131_v1.JPG
      0_1523760999160_P4141137_v1.JPG 0_1523761006369_P4141139_v1.JPG
      0_1523760989088_P4141136_v1.JPG 0_1523760724731_P4141133_v1.JPG 0_1523760736892_P4141140_v1.JPG 0_1523760744189_P4141141_v1.JPG
      0_1523760676911_P4141144_v1.JPG

      posted in My Project
      Thucar
      Thucar
    • RE: What did you build today (Pictures) ?

      Built half of my dutch bucket system. Namely the drain part. Irrigation to follow.

      0_1523760716315_P4141131_v1.JPG 0_1523760724731_P4141133_v1.JPG 0_1523760736892_P4141140_v1.JPG 0_1523760744189_P4141141_v1.JPG
      0_1523760676911_P4141144_v1.JPG

      posted in General Discussion
      Thucar
      Thucar