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.
Posts made by Thucar
-
RE: project for some farming
-
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.
-
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 VPSThat way you will only need to supply power to the Raspi and you're done.
-
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.
-
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":""}]```
-
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.
-
RE: MySensors Hydroponics Greenhouse project
Yes, the relay module has optocouplers separating data lines from the relays.
-
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
My NFT rails for herbs. A good eye can spot some dill, basil and cilantro plants in there.
That's my "Nursery" - an old fish tank I can cover with a piece of glass when night temps dip below 10C
That's my Fibaro Motion sensor. An easy way to get some essential readings. Like the length of day, hours of sunlight, temperature.
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.
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
-
RE: MySensors Hydroponics Greenhouse project
Got some work done on the hardware side of things. Drainage is done, next up is feed part.
-
RE: What did you build today (Pictures) ?
Built half of my dutch bucket system. Namely the drain part. Irrigation to follow.
-
RE: MQTT Gateway Network On Demand
According to thethingsnetwork.org map, the closest lora gateway is about 120km from me
-
RE: 💬 Soil Moisture Sensor Pro Mini
@UL7AAjr do you feel like sharing some information on that sweet looking sensor of yours? I'm doing my research on different styles of capacitive soil moisture sensors right now and would love to hear about your solution and the reasoning behind the choices you made
-
RE: Looking for Sensor
And what are the benefits/drawbacks of the sensor in regards of your project? So we could get a better picture of what kind of limits your project puts on the selection.
For instance, does it not do what you need, is it not precise enough, is it too expensive? -
RE: Looking for Sensor
Do you have any sensor names you have looked at? So we could take a look at them and offer our advice?
-
RE: Looking for Sensor
Hello and welcome to the forum @777upender
Could you tell us what's your research on the topic so far? Which sensors have caught your eye and what strengths drawbacks they have in regard of your project? I'd be happy to offer my 2 cents worth in helping you narrow down the choice or add recommendations of my own to that list.
-
RE: Ventillation unit via phone cable
@sola I know for a fact that I have used ModBus with Systemair ventilation units in three different occasions. I just can not remember the exact models. They all used the above linked documentation though, so that leads me to believe they are using either the same full controller on all their residential models, or at least the ModBus firmware is the same.
-
RE: Ventillation unit via phone cable
@sola check this out: https://planetaklimata.com.ua/instr/Systemair/Systemair_Modbus_for_Residential_units_User_Manual_Eng.pdf
If my memory serves me, I have done Villavent 400 unit integrations with ModBus. They have a decent ModBus support with a good range of functions available. Keep in mind that it's ModBus RTU, not TCP so you'll need to connect it via RS485. By far the easiest method is to use a usb-to-RS485 dongle.
If your ventilation unit is located far from your home controller and it's not easy to set up direct wiring, look into a serial-to-ethernet converter
I would not use serial-to-wifi models, as they have proven to be way less reliable.
So the bottom line is: if your unit indeed supports ModBus, you do not need an Arduino to do the talking. Just connect the unit to your controller and use a ModBus plugin for OpenHAB
-
RE: MySensors Hydroponics Greenhouse project
Now that the GSM Gateway is done, I can start focusing more on the Greenhouse controller. I’m still waiting for the two most important components though - the pH sensor module and the stainless steel EC sensor probe. I’ve stumbled on another very good post on the EC topic which I’ll have to work through: https://thecavepearlproject.org/2017/08/12/measuring-electrical-conductivity-with-an-arduino-part1-overview/
-
RE: MQTT Gateway Network On Demand
It's not going to be a WiFi gateway. It will be a GSM Gateway. I used the ESP8266 example as that's familiar to everyone whereas the GSM Gateway might raise more questions.
As it is now, I'm thinking a gateway that is semi-responsive. Meaning either when it has data to publish, or if a certain time interval has passed, brings up its network connection, connects to the broker, publishes the data it has and reads the messages it has received while the connection was down. If any messages required an ACK, it would get sent at this point.
-
RE: MySensors Hydroponics Greenhouse project
@elcaron said in MySensors Hydroponics Greenhouse project:
HASL
The pitchfork i'm currently using has solid copper traces on the forks. For more long term use I'm planning on switching to capacitive soil moisture sensors. Those can be additionally coated with epoxy resin for example for added longevity.
-
RE: MQTT Gateway Network On Demand
@neverdie because beeyards are often located nowhere near your own property. You usually negotiate with a land owner if its ok to have your bees on some corner of his land, or in a forest he owns. The actual location of the yard could be as far as 200-300km from your own house. Of course, an option would be to convince the land owner to house your gateway as well, but that adds unnecessary complications to the delicate process of negotiation
-
RE: MQTT Gateway Network On Demand
That is the second part of the idea To make this also work with my other work-in-progress the GSM Gateway. I was just trying to see if there was any valid reason from MySensors side why I should not be toggling the network connection on and off.
-
RE: MQTT Gateway Network On Demand
I'm thinking of a remote beeyard setup. No mains power for couple miles in any direction. I can run individual Arduino Pro mini nodes off solar power + single 18650 cells indefinitely without much issue, I've been doing that for over half a year on a test setup.
However, now I need to get the Gateway to run on Solar and the individual nodes on batteries only. So far, after trying to run the ESP8266 on a single 2300mAh 18650, it would seem the cell would not last more than couple days at best.
So it's either cut down the power consumption, or upgrade the battery pack to some 4-6 cells, which in turn means upgrading my small 6W solar panel.
-
MQTT Gateway Network On Demand
I'm looking into solar powering the ESP8266 MQTT gateway. The whole network will consist of sensors only, so no data needs to be sent back to the nodes. To reduce the power consumption of the GW, I'm thinking it might be a good idea to keep the WiFi radio off whenever it is not being used. Could only power it up when we actually need to publish to the broker.
Does that sound feasible or is there any reason this would not work or would not be a good idea?
-
RE: arduino wifi gateway/nrf24 and esp-01
Indeed, that thingy does exactly what you are asking for
https://www.openhardware.io/view/567/MySensors-GSM-Gateway -
RE: Have anyone experienced MySensors gateway with GPRS(MQTT)?
@jkandasa I just finished a Gateway build with TinyGSM. You can find it here: https://www.openhardware.io/view/567/MySensors-GSM-Gateway
-
RE: MY_GATEWAY_TINYGSM
@gohan said in MY_GATEWAY_TINYGSM:
@thucar said in MY_GATEWAY_TINYGSM:
GSM modems and ESP8266 as a modem
Did you mean esp8266 as gateway or...? BTW great job
Nope, ESP8266 is a modem in this scenario. So in my case I'm using an Arduino Mega 2560 with loads of IOs as the gateway and the ESP8266 as a Wifi modem for connectivity. No sketch is uploaded on the ESP and the only connections used (in addition to power and ground of course) are TX/RX from ESP to the Arduino.
-
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
-
RE: Pro Mini issues
@bgunnarb said in Pro Mini issues:
@dbemowsk Strange! I have never made a manual reset when programming my Pro Minis.
I need to manually reset all my chinese Arduino clones as well. I either press the reset button right after the IDE finishes compiling the sketch and shows “uploading” or if I miss that mment, I’ll have to reset the *duino couple times while the IDE retries uploading.
-
RE: What did you build today (Pictures) ?
@dirkc the display is a JLX12864-378 off a chinese “component tester” kit I had available. Using the u8g2 library to run it.
-
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 arrivesSome eye candy:
-
RE: MY_GATEWAY_TINYGSM
/** * 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-2015 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. * ******************************* * * REVISION HISTORY * Version 1.0 - Rait Lotamõis * * * DESCRIPTION * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //Running on Mega #define MY_RF24_CE_PIN 49 #define MY_RF24_CS_PIN 53 // Enable gateway ethernet module type #define MY_GATEWAY_TINYGSM // Define the GSM modem #define TINY_GSM_MODEM_A6 #define MY_GSM_APN "internet" //#define MY_GSM_USR "" //#define MY_GSM_PSW "" //#define MY_GSM_PIN "0000" // Use Hardware Serial on Mega, Leonardo, Micro #define SerialAT Serial3 // or Software Serial on Uno, Nano //#define MY_GSM_RX 4 //#define MY_GSM_TX 5 // Set your modem baud rate or comment it out for auto detection //#define MY_GSM_BAUDRATE 115200 // The port to keep open on node server mode / or port to contact in client mode #define MY_PORT 5003 // Controller ip address. Enables client mode (default is "server" mode). // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254 #define MY_CONTROLLER_URL_ADDRESS "xxx.yyyyyyy.com" // The MAC address can be anything you want but should be unique on your network. // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use. // Note that most of the Ardunio examples use "DEAD BEEF FEED" for the MAC address. #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED // Enable inclusion mode //#define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Set inclusion mode duration (in seconds) //#define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 // Set blinking period //#define MY_DEFAULT_LED_BLINK_PERIOD 300 // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 9 // Transmit led pin #if defined(MY_USE_UDP) #include <EthernetUdp.h> #endif #include <Ethernet.h> #include <MySensors.h> void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attached sensors data here }```
-
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
-
RE: MySensors Hydroponics Greenhouse project
To quote the classics - “Well, that escalated quickly.”
While waiting for the sensors to arrive, I started mulling over the entire project in my head. And I started thinking about scaling. My greenhouse is only 3 meters long but my parents greenhouse is almost 30 meters. Routing wires for soil sensors around the place is no fun.
So that got me thinking - does it need to be one node? And that in turn got me thinking - does it even have to be a node? Maybe a gateway would be the way to go?
So this is my current plan - a GSM/Wifi gateway with the general and more power hungry components( pH, EC, relative air humidity and ambient temp, relays). The gateway would be located near the pumps, sumps and other tech in the greenhouse.
Then the rest of the greenhouse can be filled with any number of sensors to monitor soil moisture, temperature and light levels at different places.
GSM gateway is almost finished, hopefully I can wrap it up tomorrow.
And as a final touch, I realized a controller of that kind of functionality could use a local user input. So it’s going to have a LCD and some buttons for set-up and things like starting/stopping pumps for maintenance.
-
RE: Will a NRF24L01+PA+LNA help with my signal problems
@Greymarvel for me that 47uF cap is essential whenever I'm not using the full adapter I suggested for your gateway.
I'm getting over 30 meters through two 35cm concrete walls and some trees with the following setup: Gateway with a shielded nRF24L01-PA-LNA (not DIY foil shielded, but proper shielded one) and the forementioned adapter.
Solar + battery powered sensor with the basic nRF24L01 (PCB antenna) the only booster is that 47uF cap on the radio power pins.
-
RE: Garage Door + Other Sensors
So you did I somehow managed to miss that part.
-
RE: Garage Door + Other Sensors
I would suggest using interrupts for the motion sensors. This way you only need to actively monitor light sensor. Everything else will only happen and take up processing power when it is actually needed.
-
RE: Will a NRF24L01+PA+LNA help with my signal problems
I has an onboard voltage reg as well as caps. So you do not need to use any additional hardware.
-
RE: Will a NRF24L01+PA+LNA help with my signal problems
@Greymarvel for a gateway I would suggest using a shielded version of the NRF24L01+PA+LNA as well as this supply adapter
I was having world of issues with my setup until I did that.
-
RE: Checking for current gateway connection state on Node?
Maybe look into the possibility f setting up a low frequency PWM to drive that led. You can get it running at boot and then just change the duty cycle to manipulate th b havior.
-
RE: MySensors Hydroponics Greenhouse project
First of all let me emphasis that this is going to be my first hydroponic setup. So I have no experience to draw on. That being said, I am seeing a lot of information on outdoor hydroponic setups. Rain water getting into your solution is to be prevented as much as possible, but it’s no disaster if some does end up in your tank.
For tomatoes, peppers, cucumbers and other tall plants, people seem to prefer something like the Dutch bucket system. If you get buckets with lids, you can just drill a 2 inch hole for the plant to poke through and keep most of the rain out.
For smaller plants like leafy greens, herbs and such, the PVC pipe system seems great. You could set it up either as a NFT or a Flood&Drain system. The benefit again is that the rain water will not have a way into your nutrient solution.
-
RE: MySensors Hydroponics Greenhouse project
Got carried away. Added thermistor temperature readings and EC measurement. I have no idea if EC is working correctly at this point, without having the probe yet. I referenced the code by Michael Ratcliffe who did amazing job on utilizing an US power plug as a probe.
Another addition was to make all values poll-able. So you can get a fresh reading when needed without having to wait for the report time to tick over./** * 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-2015 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. * ******************************* * * REVISION HISTORY * Version 1.0 - Rait Lotamõis * * DESCRIPTION * First iteration of a Hydroponic greenhouse controller sketch. * Supports: * 2 relays with individual push buttons * BH1750 Light sensor * Moisture sensor * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #include <MySensors.h> #include <Vcc.h> #include <ResponsiveAnalogRead.h> #include <SPI.h> #include <BH1750.h> #include <Wire.h> #include <TimerOne.h> #include <SmoothThermistor.h> // Measurement and reporting settings #define REPORT_INTERVAL 600 // define report interval in seconds for all sensors. This is when a full report is sent, no matter what #define MOI_MEASUREMENT_INTERVAL 10 // Time in seconds, between consecutive measurements #define MOI_REPORT_THRESHOLD 5 // The difference in % between two consecutive readings to send an immediate report #define LUX_MEASUREMENT_INTERVAL 15 // Time in seconds, between consecutive measurements #define LUX_REPORT_THRESHOLD 100 // The difference in Lux between two consecutive readings to send an immediate report #define TMP_MEASUREMENT_INTERVAL 15 // Time in seconds, between consecutive measurements #define TMP_REPORT_THRESHOLD 1 // The difference in degrees between two consecutive readings to send an immediate report #define PPM_MEASUREMENT_INTERVAL 10 // Time in seconds, between consecutive measurements #define PPM_REPORT_THRESHOLD 50 // The difference in ppm between two consecutive readings to send an immediate report // Relay settings. TODO: Make it easy to use more than two relays #define RLY_PIN_1 4 #define RLY_PIN_2 5 #define RLY_BTN_1 2 // Pin to use for a pushbutton switch. NB! Needs an interrupt pin #define RLY_BTN_2 3 // Pin to use for a pushbutton switch. NB! Needs an interrupt pin #define RLY_ON 0 // GPIO value to write to turn on attached relay #define RLY_OFF 1 // GPIO value to write to turn off attached relay #define RLY_ID_1 1 // MySensors Child ID #define RLY_ID_2 2 // MySensors Child ID // Soil Moisture settings #define MOI_SENSE_PIN A0 // Analog pin connecting to the probe #define MOI_POWER_PIN 6 // Pin for powering the humidity sensor #define MOI_0_PERCENT 0 // Probe output voltage at 0% moisture #define MOI_100_PERCENT 2.5 // Probe output voltage in a glass of water #define MOI_ID 3 // MySensors Child ID // Lux sensor settings #define LUX_ID 0 // MySensors Child ID // Temperature sensor settings (NTC Thermistors) #define TMP_SENSE_PIN 1 // Analog pin the first thermistor connects to NB! Use numeric values only. so instead of A0, A1, etc just use 0,1 #define TMP_MAX_SENSORS 1 // Number of thermistors connected. They need to be attached to sequential pins #define TMP_USE_AREF false // If your Arduino has the ARef pin available, you should use it #define TMP_NOMINAL_RES 10000 // Nominal resistance of thermistors being used #define TMP_SERIES_RES 12000 // Value of the voltage divider resistor #define TMP_BETA 3950 // You will get the Beta coeficent from your thermistors datasheet #define TMP_NOMINAL_T 25 // Nominal temperature for the thermistor #define TMP_SAMPLES 10 // Number of samples to take #define TMP_ID 10 //Mysensors Child ID // PPM sensor settings #define PPM_SENSE_PIN A7 // Analog pin used for the probe #define PPM_POWER_PIN 7 // Digital pin used to supply power to the probe #define PPM_RESISTOR 560 // No less than 300 and no more than 1K resistor should be used. Around 500 gives the best resolution #define PPM_CALIBRATION 1.38 // EC value of Calibration solution in s/cm #define PPM_TEMP_COEF 0.019 // 0.019 is generaly considered the standard for plant nutrients [google "Temperature compensation EC" for more info] #define PPM_TEMP_SENSOR 10 // Temperature sensor ID that is measuring your solution temperature #define PPM_ID 4 // MySensors Child ID // General settings #define VCC_VOLTAGE_READ 5.0 // Actual supply voltage going to the VCC. Use a multimeter to check #define VCC_VOLTAGE_REPORTED 4.97 // Set this to the same as above for your first boot. Then insert the value reported in the Serial window during boot #define ONE_SECOND_IN_MICROS 500000 // Depends on your crystal. 8MHz crystal:500000, 16MHz crystal:1000000, etc. If your time intervals are off, this is the reason // PPM variables int ppmR1 = PPM_RESISTOR; int ppmRa = 25; float ppmTempFinish = 0; float ppmTempStart = 0; float lastEC = 0; int lastPPM = 0; ResponsiveAnalogRead analogPpm(PPM_SENSE_PIN, false); MyMessage msgPpm(0,V_EC); // Soil Moisture variables float cal0 = MOI_0_PERCENT; float cal100 = MOI_100_PERCENT; ResponsiveAnalogRead analogMoi(MOI_SENSE_PIN, false); MyMessage msgMoi(0,V_LEVEL); float lastMoisture = 0; // Relay variables MyMessage msgRly(0,V_STATUS); bool rlyState1 = false; bool rlyState2 = false; // Lux sensor variables BH1750 luxSensor; MyMessage msgLux(0, V_LIGHT_LEVEL); uint16_t lastLux = 0; // Temperature sensor variables float lastTemperatures[TMP_MAX_SENSORS]; MyMessage msgTmp(0,V_TEMP); // VCC Monitoring for calculations const float VccCorrection = VCC_VOLTAGE_READ/VCC_VOLTAGE_REPORTED; Vcc vcc(VccCorrection); // General variables bool receivedConfig = false; bool metric = true; long reportTimer = REPORT_INTERVAL; long moiTimer = MOI_MEASUREMENT_INTERVAL; long luxTimer = LUX_MEASUREMENT_INTERVAL; long tmpTimer = TMP_MEASUREMENT_INTERVAL; long ppmTimer = PPM_MEASUREMENT_INTERVAL; const unsigned long debounceTime = 50; void before() { } void setup() { // Initialize the timer interrupt for sending sensor reports Timer1.initialize(ONE_SECOND_IN_MICROS); Timer1.attachInterrupt(countDownOneSecond); // Initialize and set relays to last known states (using eeprom storage) pinMode(RLY_PIN_1, OUTPUT); pinMode(RLY_PIN_2, OUTPUT); rlyState1 = loadState(RLY_ID_1); rlyState2 = loadState(RLY_ID_2); digitalWrite(RLY_PIN_1, rlyState1?RLY_ON:RLY_OFF); digitalWrite(RLY_PIN_2, rlyState2?RLY_ON:RLY_OFF); // Set the interrupts for relay buttons pinMode(RLY_BTN_1, INPUT_PULLUP); pinMode(RLY_BTN_2, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(RLY_BTN_1), toggleRly1, FALLING); attachInterrupt(digitalPinToInterrupt(RLY_BTN_2), toggleRly2, FALLING); // Initialize Soil Moisture power pin pinMode(MOI_POWER_PIN, OUTPUT); digitalWrite(MOI_POWER_PIN, LOW); // Initialize the Lux sensor luxSensor.begin(); // Initialize the PPM sensor pinMode(PPM_POWER_PIN , OUTPUT ); digitalWrite(PPM_POWER_PIN , LOW ); pinMode(PPM_SENSE_PIN,INPUT); ppmR1=(ppmR1+ppmRa); // Take and report voltage readings #ifdef MY_DEBUG Serial.print("Measuring VCC voltage as: "); Serial.print(vcc.Read_Volts()); Serial.println("V"); #endif } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Greenhouse Node", "0.3"); // Register Relays present(RLY_ID_1, S_BINARY); present(RLY_ID_2, S_BINARY); // Register Soil Moisture sensor present(MOI_ID, S_MOISTURE); // Register Lux sensor present(LUX_ID, S_LIGHT_LEVEL); // Register PPM sensor present(PPM_ID, S_WATER_QUALITY); // Register temperature sensors for (int i=0; i<TMP_MAX_SENSORS; i++) { present(TMP_ID+i, S_TEMP); } } void loop() { // Update the relay outputs updateRelays(); // Get Soil Moisture levels if it is time if (moiTimer == 0){ #ifdef MY_DEBUG Serial.print("Taking Moisture measurements: "); #endif readMoisture(); #ifdef MY_DEBUG Serial.print(lastMoisture); Serial.println("%"); #endif moiTimer = MOI_MEASUREMENT_INTERVAL; } // Get Lux level if it is time if (luxTimer == 0){ #ifdef MY_DEBUG Serial.print("Taking Lux measurements: "); #endif readLux(); #ifdef MY_DEBUG Serial.print(lastLux); Serial.println("lux"); #endif luxTimer = LUX_MEASUREMENT_INTERVAL; } // Get PPM level if it is time if (ppmTimer == 0){ #ifdef MY_DEBUG Serial.println("Taking PPM measurements: "); #endif readPPM(); #ifdef MY_DEBUG Serial.print(lastPPM); Serial.println("ppm"); Serial.print(lastEC); Serial.println("s/cm"); #endif ppmTimer = PPM_MEASUREMENT_INTERVAL; } // Get Temperatures if it is time if (tmpTimer == 0){ #ifdef MY_DEBUG Serial.println("Taking Temperature measurements: "); #endif readTemperatures(); #ifdef MY_DEBUG for (int i=0; i<TMP_MAX_SENSORS;i++){ Serial.print(TMP_ID+i); Serial.print(": "); Serial.print(lastTemperatures[i]); Serial.println("C"); } #endif tmpTimer = TMP_MEASUREMENT_INTERVAL; } // Send reports it if is time if (reportTimer == 0){ #ifdef MY_DEBUG Serial.println("Sending reports."); #endif sendReports(); reportTimer = REPORT_INTERVAL; } } void receive(const MyMessage &message) { if (message.isAck()) { #ifdef MY_DEBUG Serial.println("This is an ack from gateway"); #endif return; } if (message.type==V_STATUS) { // Change relay state int outputPin = (message.sensor == RLY_ID_1)?RLY_PIN_1:RLY_PIN_2; digitalWrite(outputPin, message.getBool()?RLY_ON:RLY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); #ifdef MY_DEBUG // Write some debug info Serial.print("Incoming change for relay:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); #endif // Update the state variables rlyState1 = loadState(RLY_ID_1); rlyState2 = loadState(RLY_ID_2); } else if (message.type==V_TEMP){ // Return temperature readings when queried readTemperatures(); send(msgTmp.setSensor(message.sensor).set(lastTemperatures[message.sensor-TMP_ID],1)); } else if (message.type==V_LEVEL && message.sensor == MOI_ID){ // Return moisture readings when queried readMoisture(); send(msgMoi.set(lastMoisture,1)); } else if (message.type==V_LEVEL && message.sensor == LUX_ID){ // Return Light level readings when queried readLux(); send(msgLux.set(lastLux)); } else if (message.type==V_EC){ readPPM(); send(msgPpm.set(lastPPM)); } } // Check if a button has been pressed, meaning we should flip the relay void updateRelays(){ bool oldState1 = loadState(RLY_ID_1); bool oldState2 = loadState(RLY_ID_2); if (oldState1 != rlyState1){ digitalWrite(RLY_PIN_1, rlyState1?RLY_ON:RLY_OFF); saveState(RLY_ID_1, rlyState1?true:false); send(msgRly.setSensor(RLY_ID_1).set(rlyState1?true:false), false); } if (oldState2 != rlyState2){ digitalWrite(RLY_PIN_2, rlyState2?RLY_ON:RLY_OFF); saveState(RLY_ID_2, rlyState2?true:false); send(msgRly.setSensor(RLY_ID_2).set(rlyState2?true:false), false); } } // Send all reports using last known values void sendReports(){ // Send Lux send(msgLux.set(lastLux)); // Send Moisture send(msgMoi.set(lastMoisture,1)); // Send PPM send(msgPpm.set(lastPPM)); // Send Temperatures for (int i=0; i< TMP_MAX_SENSORS;i++){ send(msgTmp.setSensor(TMP_ID+i).set(lastTemperatures[i],1)); } } // Get the PPM levels void readPPM(){ float EC = 0; float EC25 = 0; long PPM = 0; float raw = 0; float Vin = vcc.Read_Volts(); float Vdrop = 0; float Rc = 0; float val = 0; digitalWrite(PPM_POWER_PIN, HIGH); wait(10); analogPpm.update(); raw = analogPpm.getValue(); digitalWrite(MOI_POWER_PIN, LOW); Vdrop = ((Vin * raw) / 1024.0); Rc =(Vdrop*ppmR1)/(Vin-Vdrop); Rc = Rc-ppmRa; EC = 1000/(Rc*PPM_CALIBRATION); EC25 = EC / (1 + (PPM_TEMP_COEF * (lastTemperatures[PPM_TEMP_SENSOR - TMP_ID] - 25.0))); PPM = EC25 * 1000 / 2; if (abs(lastPPM - PPM) > PPM_REPORT_THRESHOLD && reportTimer > 0){ send(msgPpm.set(PPM)); } lastPPM = PPM; lastEC = EC25; } // Get the light level values void readLux(){ uint16_t lux = luxSensor.readLightLevel(); // Check if the difference between previous reading and this one is enough to warrant an immediate report if ((abs(lux-lastLux) > LUX_REPORT_THRESHOLD) && reportTimer > 0){ send(msgLux.set(lux)); } lastLux = lux; } // Get the temperature values void readTemperatures(){ int i; bool sendReport = false; #ifdef MY_DEBUG Serial.println("Temperatures:"); #endif for (i=0;i<TMP_MAX_SENSORS;i++){ SmoothThermistor smoothThermistor(TMP_SENSE_PIN+i, // the analog pin to read from ADC_SIZE_10_BIT, // the ADC size TMP_NOMINAL_RES, // the nominal resistance TMP_SERIES_RES, // the series resistance TMP_BETA, // the beta coefficient of the thermistor TMP_NOMINAL_T, // the temperature for nominal resistance TMP_SAMPLES); // the number of samples to take for each measurement smoothThermistor.useAREF(TMP_USE_AREF); float temp = smoothThermistor.temperature(); // Send in the new temperature if ((abs(temp-lastTemperatures[i]) > TMP_REPORT_THRESHOLD) && reportTimer > 0){ send(msgTmp.setSensor(TMP_ID+i).set(temp,1)); } // Save new temperatures for next compare lastTemperatures[i] = temp; } } // get the soil moisture values void readMoisture(){ float v = vcc.Read_Volts(); int aRead = readSoil(); float voltage = (aRead * v / 1024.0); float moisture = voltage * 100/cal100; // Check if the difference between previous reading and this one is enough to warrant an immediate report if ((abs(moisture-lastMoisture) > MOI_REPORT_THRESHOLD) && reportTimer > 0){ send(msgMoi.set(moisture,1)); } lastMoisture = moisture; } // Perform the actual powering up and measurement process for Soil moisture sensor. TODO: Does it really need a separate function? int readSoil() { int val; digitalWrite(MOI_POWER_PIN, HIGH); delay(10);//wait 10 milliseconds analogMoi.update(); val = analogMoi.getValue(); digitalWrite(MOI_POWER_PIN, LOW); return val; } // Interrupt Service Routines // TODO: Would love to use the same ISR for both (all?) relays void toggleRly1(){ static unsigned long previousStateChangeMillis = 0; bool pinState = digitalRead(RLY_BTN_1); if (pinState == LOW) { // only falling events if ((millis() - previousStateChangeMillis) > debounceTime) { // debounce rlyState1 = !rlyState1; } } previousStateChangeMillis = millis(); } void toggleRly2(){ static unsigned long previousStateChangeMillis = 0; bool pinState = digitalRead(RLY_BTN_2); if (pinState == LOW) { // only falling events if ((millis() - previousStateChangeMillis) > debounceTime) { // debounce rlyState2 = !rlyState2; } } previousStateChangeMillis = millis(); } void countDownOneSecond(void) { if (ppmTimer > 0){ ppmTimer--; } if (moiTimer > 0){ moiTimer--; } if (tmpTimer > 0){ tmpTimer--; } if (luxTimer > 0){ luxTimer--; } if (reportTimer > 0) { reportTimer--; } }
-
RE: MySensors Hydroponics Greenhouse project
This is where I'm at right now. Support for 2 relays with push buttons, light level and soil moisture measurements. Customizable measurement interval for entire device and each sensor individually. Also a change threshold (a change greater than given threshold in two consecutive readings triggers an immediate report).
Everything is running off interrupts to ensure smooth operation.
NB! I have not yet managed to do live tests with the BH1750 as it has not yet arrived.Next up are the temperature sensors and EC meter. Or whatever sensor will be the next to arrive.
/** * 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-2015 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. * ******************************* * * REVISION HISTORY * Version 1.0 - Rait Lotamõis * * DESCRIPTION * First iteration of a Hydroponic greenhouse controller sketch. * Supports: * 2 relays with individual push buttons * BH1750 Light sensor * Moisture sensor * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #include <MySensors.h> #include <Vcc.h> #include <ResponsiveAnalogRead.h> #include <SPI.h> #include <BH1750.h> #include <Wire.h> #include <TimerOne.h> // Measurement and reporting settings #define REPORT_INTERVAL 600 // define report interval in seconds for all sensors. This is when a full report is sent, no matter what #define MOI_MEASUREMENT_INTERVAL 10 // Time in seconds, between consecutive measurements #define MOI_REPORT_THRESHOLD 5 // The difference in % between two consecutive readings to send an immediate report #define LUX_MEASUREMENT_INTERVAL 15 // Time in seconds, between consecutive measurements #define LUX_REPORT_THRESHOLD 100 // The difference in Lux between two consecutive readings to send an immediate report // Relay settings. TODO: Make it easy to use more than two relays #define RLY_PIN_1 4 #define RLY_PIN_2 5 #define RLY_BTN_1 2 // Pin to use for a pushbutton switch. NB! Needs an interrupt pin #define RLY_BTN_2 3 // Pin to use for a pushbutton switch. NB! Needs an interrupt pin #define RLY_ON 0 // GPIO value to write to turn on attached relay #define RLY_OFF 1 // GPIO value to write to turn off attached relay #define RLY_ID_1 1 // MySensors Child ID #define RLY_ID_2 2 // MySensors Child ID // Soil Moisture settings #define MOI_SENSE_PIN A0 // Analog pin connecting to the probe #define MOI_POWER_PIN 6 // Pin for powering the humidity sensor #define MOI_0_PERCENT 0 // Probe output voltage at 0% moisture #define MOI_100_PERCENT 2.5 // Probe output voltage in a glass of water #define MOI_ID 3 // MySensors Child ID // Lux sensor settings #define LUX_ID 0 // MySensors Child ID // General settings #define VCC_VOLTAGE_READ 5.0 // Actual supply voltage going to the VCC. Use a multimeter to check #define VCC_VOLTAGE_REPORTED 4.97 // Set this to the same as above for your first boot. Then insert the value reported in the Serial window during boot #define ONE_SECOND_IN_MICROS 500000 // Depends on your crystal. 8MHz crystal:500000, 16MHz crystal:1000000, etc. If your time intervals are off, this is the reason // Soil Moisture variables float cal0 = MOI_0_PERCENT; float cal100 = MOI_100_PERCENT; ResponsiveAnalogRead analogMoi(MOI_SENSE_PIN, false); MyMessage msgMoi(0,V_LEVEL); float lastMoisture = 0; // Relay variables MyMessage msgRly(0,V_STATUS); bool rlyState1 = false; bool rlyState2 = false; // Lux sensor variables BH1750 luxSensor; MyMessage msgLux(0, V_LIGHT_LEVEL); uint16_t lastLux = 0; // VCC Monitoring for calculations const float VccCorrection = VCC_VOLTAGE_READ/VCC_VOLTAGE_REPORTED; Vcc vcc(VccCorrection); // General variables bool receivedConfig = false; bool metric = true; long reportTimer = REPORT_INTERVAL; long moiTimer = MOI_MEASUREMENT_INTERVAL; long luxTimer = LUX_MEASUREMENT_INTERVAL; const unsigned long debounceTime = 50; void before() { } void setup() { // Initialize the timer interrupt for sending sensor reports Timer1.initialize(ONE_SECOND_IN_MICROS); Timer1.attachInterrupt(countDownOneSecond); // Initialize and set relays to last known states (using eeprom storage) pinMode(RLY_PIN_1, OUTPUT); pinMode(RLY_PIN_2, OUTPUT); rlyState1 = loadState(RLY_ID_1); rlyState2 = loadState(RLY_ID_2); digitalWrite(RLY_PIN_1, rlyState1?RLY_ON:RLY_OFF); digitalWrite(RLY_PIN_2, rlyState2?RLY_ON:RLY_OFF); // Set the interrupts for relay buttons pinMode(RLY_BTN_1, INPUT_PULLUP); pinMode(RLY_BTN_2, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(RLY_BTN_1), toggleRly1, FALLING); attachInterrupt(digitalPinToInterrupt(RLY_BTN_2), toggleRly2, FALLING); // Initialize Soil Moisture power pin pinMode(MOI_POWER_PIN, OUTPUT); digitalWrite(MOI_POWER_PIN, LOW); // Initialize the Lux sensor luxSensor.begin(); // Take and report voltage readings #ifdef MY_DEBUG Serial.print("Measuring VCC voltage as: "); Serial.print(vcc.Read_Volts()); Serial.println("V"); #endif } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Greenhouse Node", "0.3"); // Register Relays present(RLY_ID_1, S_BINARY); present(RLY_ID_2, S_BINARY); // Register Soil Moisture sensor present(MOI_ID, S_MOISTURE); // Register Lux sensor present(LUX_ID, S_LIGHT_LEVEL); } void loop() { // Update the relay outputs updateRelays(); // Get Soil Moisture levels if it is time if (moiTimer == 0){ #ifdef MY_DEBUG Serial.print("Taking Moisture measurements: "); #endif readMoisture(); #ifdef MY_DEBUG Serial.print(lastMoisture); Serial.println("%"); #endif moiTimer = MOI_MEASUREMENT_INTERVAL; } // Get Lux level if it is time if (luxTimer == 0){ #ifdef MY_DEBUG Serial.print("Taking Lux measurements: "); #endif readLux(); #ifdef MY_DEBUG Serial.print(lastLux); Serial.println("lux"); #endif luxTimer = LUX_MEASUREMENT_INTERVAL; } // Send reports it if is time if (reportTimer == 0){ #ifdef MY_DEBUG Serial.println("Sending reports."); #endif sendReports(); reportTimer = REPORT_INTERVAL; } } void receive(const MyMessage &message) { if (message.isAck()) { #ifdef MY_DEBUG Serial.println("This is an ack from gateway"); #endif return; } // We only expect one type of message from controller. But we better check anyway. if (message.type==V_STATUS) { // Change relay state int outputPin = (message.sensor == RLY_ID_1)?RLY_PIN_1:RLY_PIN_2; digitalWrite(outputPin, message.getBool()?RLY_ON:RLY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); #ifdef MY_DEBUG // Write some debug info Serial.print("Incoming change for relay:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); #endif // Update the state variables rlyState1 = loadState(RLY_ID_1); rlyState2 = loadState(RLY_ID_2); } } // Check if a button has been pressed, meaning we should flip the relay void updateRelays(){ bool oldState1 = loadState(RLY_ID_1); bool oldState2 = loadState(RLY_ID_2); if (oldState1 != rlyState1){ digitalWrite(RLY_PIN_1, rlyState1?RLY_ON:RLY_OFF); saveState(RLY_ID_1, rlyState1?true:false); send(msgRly.setSensor(RLY_ID_1).set(rlyState1?true:false), false); } if (oldState2 != rlyState2){ digitalWrite(RLY_PIN_2, rlyState2?RLY_ON:RLY_OFF); saveState(RLY_ID_2, rlyState2?true:false); send(msgRly.setSensor(RLY_ID_2).set(rlyState2?true:false), false); } } // Send all reports using last known values void sendReports(){ // Send Lux send(msgLux.set(lastLux)); // Send Moisture send(msgMoi.set(lastMoisture,1)); } // Get the light level values void readLux(){ uint16_t lux = luxSensor.readLightLevel(); // Check if the difference between previous reading and this one is enough to warrant an immediate report if ((abs(lux-lastLux) > LUX_REPORT_THRESHOLD) && reportTimer > 0){ send(msgLux.set(lux)); } lastLux = lux; } // get the soil moisture values void readMoisture(){ float v = vcc.Read_Volts(); int aRead = readSoil(); float voltage = (aRead * v / 1024.0); float moisture = voltage * 100/cal100; // Check if the difference between previous reading and this one is enough to warrant an immediate report if ((abs(moisture-lastMoisture) > MOI_REPORT_THRESHOLD) && reportTimer > 0){ send(msgMoi.set(moisture,1)); } lastMoisture = moisture; } // Perform the actual powering up and measurement process for Soil moisture sensor. TODO: Does it really need a separate function? int readSoil() { int val; digitalWrite(MOI_POWER_PIN, HIGH); delay(10);//wait 10 milliseconds analogMoi.update(); val = analogMoi.getValue(); digitalWrite(MOI_POWER_PIN, LOW); return val; } // Interrupt Service Routines // TODO: Would love to use the same ISR for both (all?) relays void toggleRly1(){ static unsigned long previousStateChangeMillis = 0; bool pinState = digitalRead(RLY_BTN_1); if (pinState == LOW) { // only falling events if ((millis() - previousStateChangeMillis) > debounceTime) { // debounce rlyState1 = !rlyState1; } } previousStateChangeMillis = millis(); } void toggleRly2(){ static unsigned long previousStateChangeMillis = 0; bool pinState = digitalRead(RLY_BTN_2); if (pinState == LOW) { // only falling events if ((millis() - previousStateChangeMillis) > debounceTime) { // debounce rlyState2 = !rlyState2; } } previousStateChangeMillis = millis(); } void countDownOneSecond(void) { if (moiTimer > 0){ moiTimer--; } if (luxTimer > 0){ luxTimer--; } if (reportTimer > 0) { reportTimer--; } }
-
RE: MySensors Hydroponics Greenhouse project
So, a quick update. First of all, I’m considering falling back to the tried and true Dallas temperature sensors instead of the thermistors. At first I figured the thermistors would be an interesting alternative to familiarize myself with but as they require extra components, I’m gonna take the shortcut.
The same goes for the ultrasonic sensor. I’m going to try and find an affordable waterproof distance sensor to use instead.So far I have the relay, light level sensor, soil humidity sensor and the temp sensors hooked up and working. Working on getting the EC sensing part set up. Still waiting for the actual probe, but I should be able to get the firmware done using any random stainless steel rods. It should boil down to calibration in the end.
I currently have 4 digital pins left- hopefully it will be enough.
-
RE: MySensors Hydroponics Greenhouse project
I just realized there is no MysBootloader for the Arduino Mega 2560. Which means I'm going to try and use the trusty Pro Mini with ATmega328p instead. (I have a version with all analog pins available for use) If I run out of pins or features, I'll switch to the 2560.
So while I'm waiting for the bulk of the sensors to arrive, I'm just creating the general sketch structure.
-
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.
-
RE: GPS and GSM
@fhenryco for me, the benefit of the A6 is that I have one on my desk
@gohan I'm not fixed on using a MQTT gateway. Not after learning that a regular Ethernet Gateway can be used as a Client. Actually I would very much prefer using it as an Ethernet Gateway if I can.
So far I have not managed to get MySensors to play ball. Even though I have an internet connection up and running and a port to connect to, I'm not seeing any incoming connections. Must dig deeper.
-
RE: GPS and GSM
I'm not looking to hack it. I think I pretty much did that part. I'm looking for information on how to use or more specifically test a regular Ethernet Gateway in Client mode. The Client mode seems to be an official feature of the Ethernet Gateway judging by the comments in the example file.
-
RE: GPS and GSM
Looks like I have it working. At least it compiles nicely and connects to the Internet via GPRS. The problem is, I can't use it as an Ethernet server gateway when on GPRS. It has to be in Client configuration. I've been using MySController so far but does not look like it supports gateways as Clients. What would you say is the simplest way to test the Ethernet Client configuration?
-
RE: GPS and GSM
I was thinking more in the lines of a standalone Mysensors network. So I would place this GSM gateway in my beeyard, add nodes to each individual hive and have the gateway forward all gathered information to my MQTT broker. At the same time I could use the gateway to read incoming messages from the broker and forward them to the nodes.
An alternative would be to not configure it as a MQTT gateway but as an Ethernet Client gateway that connects directly to my PC.
-
RE: GPS and GSM
How come? Using a TinyGSM example sketch I can connect to the internet, get an IP address, connect to my MQTT broker and push/read messages. So I was thinking all I need to do is use the TinyGSM library to set up an Internet connection. Then use the GatewayXXXXMQTTClient sketch to handle everything else. Pretty much like with Ethernet or ESP8266 versions of the gateway.
-
RE: GPS and GSM
I'm actually looking into this very thing myself. Not from the GPS aspect but the GSM/GPRS point of view. The goal here is to create a remote battery/solar powered MQTT gateway that can have a network of nodes of its own.
I'm testing things with the A6 GSM/GPRS module from AI Thinker. Right now I'm trying to chew through the MyGatewayTransportMQTTClient.cpp file and figure out how to convinve MySensors to play nice with the thing.
As the A6 library I'm using TinyGSM. Using one of the TinyGSM examples I got the GPRS connection up and running in no time.
-
RE: Secondary ESP8266 gateway
Which shielded ones do you mean? I went and got all the radio gear from the MySensors Store page. Was looking for the best possible radios to use for the gateway and couple of my far-away sensors. The PA/LNA modules looked like the cream of the crop.
-
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.
-
RE: Secondary ESP8266 gateway
I'll see if wrapping them in tin foil helps any.
-
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.
-
RE: Secondary ESP8266 gateway
That's worth a shot. Tricky to get power out there but definitely worth trying.
-
RE: Secondary ESP8266 gateway
I'm finding it odd as well that PA LNA also fails to connect from that distance. I only had these two - one on the gateway and the other now on the hive sensor. The rest are all regular pcb antenna versions. I've ordered 5 more PA LNA versions just to be sure it's not a faulty radio.
That means another month of waiting for them to arrive though...
-
RE: Sensor causing a gateway reboot
Ok, so I replaced the 3.3V 8MHz Pro Mini with a 5V 16MHz one. Still running it from that same power source, so currently supplying 4.1V to the VCC. And no more gateway reboots.
Both Pro Minis have the MysBootloader on them, no other component or code changes. So I guess the next thing is to wire up another 3.3V Mini, flash the bootloader on it and see how it goes.
-
RE: Sensor causing a gateway reboot
The gateway code is unmodified Serial Gateway example. No inclusion mode and no traffic lights. As simple as it gets.
/** * 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-2015 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. * ******************************* * * DESCRIPTION * The ArduinoGateway prints data received from sensors on the serial link. * The gateway accepts input on seral which will be sent out on radio network. * * The GW code is designed for Arduino Nano 328p / 16MHz * * Wire connections (OPTIONAL): * - Inclusion button should be connected between digital pin 3 and GND * - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series * * LEDs (OPTIONAL): * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly * - ERR (red) - fast blink on error during transmission error or recieve crc error * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Set LOW transmit power level as default, if you have an amplified NRF-module and // power your radio separately with a good regulator you can turn up PA level. #define MY_RF24_PA_LEVEL RF24_PA_LOW // Enable serial gateway #define MY_GATEWAY_SERIAL // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender) #if F_CPU == 8000000L #define MY_BAUD_RATE 38400 #endif // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // Inverses behavior of inclusion button (if using external pullup) //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Inverses the behavior of leds //#define MY_WITH_LEDS_BLINKING_INVERSE // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED #include <MySensors.h> void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors } void loop() { // Send locally attached sensor data here }```
-
Secondary ESP8266 gateway
I'm working on a beehive sensor set and I've ran into some serious range issues. The hive is not too far - maybe 30m from the house, but the signal has to go through the house diagonally, cutting across 2 thick concrete walls. I've been unable to get either the regular nrf24l01+ or the nrf24l01+ PA LNA versions to work. Tried the nrf24l01+ dipole antenna mod as well as an external 6DBi antenna on the PA LNA version.
On a whim I decided to test ESP8266 wifi reception at the beehive - and lo and behold it works perfectly fine. I guess the wifi router is just that much more powerful.
So I replaced the Pro mini and nrf24l01+ combo with a single ESP8266 and got a solid connection. However now I'm facing two problems/questions.
-
- I now have two gateways instead of one. While it's not really a big deal I was wondering if there was any way to combine the two? My primary gateway is a serialGW managed by MYSController
-
- The beehive sensor is a solar powered one. So I really do not like it being always active and connected to the wifi. I'm seeing UDP slave options in the settings but have yet to be able to make it work. However if a connection to MYSController is dropped, it will not be picked up again when the gateway comes back online.
I guess what most suite my needs here would be a MQTT broker I could connect to and push the sensor updates, but unfortunately my controller does not do MQTT and I'm in no hurry trying to build a connector for that.
Any ideas/suggestions welcome. Is there an aspect of MySensors I'm overlooking or not considering?
-
-
RE: Sensor causing a gateway reboot
Oh, forgot. The Gateway is simple serial gateway running on Nano.
-
Sensor causing a gateway reboot
I'm building a sensor for my honeybee hive. For some reason quite often when I reboot the sensor, the gateway gets stuck in a reboot loop. When I cut the power from the sensor, then the gateway boots up without issues. I have 8 other misc sensors working fine with that gateway.
Some other information that might be useful:
Using MysBootloader for OTA (Pro Mini 8MHz 3.3v)
The sensor is temperature/humidity sensor. Using 5x DS18B20 and 1x DHT22Powering the Pro mini directly via the VCC pin from a 18650 battery. (4.2v - 3.6v)
Gateway logAm I missing something or doing something no-no in the code?