I ran out of I/O pins on a ESP8266 for a project I'm working on. Can I use this MakerFocus ESP32 Development Board Upgraded Version 8MB Flash, ESP32 WiFi Bluetooth, ESP32 OLED 0.96 Inch OLED Display CP2102 Internet for Arduino ESP8266 NodeMCU to control sensors? I went down this path before buying a Arduino Due only to find out it wasn't supported and didn't want to make the same mistake again. Thanks for the help.
Posts made by RWoerz
-
ESP32 as a sensor controller
-
RE: How to workaround a dead Gateway.
Thanks for the quick reply. I'll have a look.
-
How to workaround a dead Gateway.
I've be working on a my DIY HVAC system for my shop for a couple of years and I'm currently using a ESP8266 for my GW with great success for over a year. Because the heater in the system is a water based solar panel if the sun is out and the water pump doesn't come on I can see temps in the solar panel raise to well over 160° F in no time. This is a real problem!
The other day the GW went on a walkabout to never never land and the Arduino Mega running the solar heater rebooted. The issue is the Mega just sat there waiting for the GW to come back online before it would go about doing it's real job of controlling the solar water heater.
Is there a way that if the GW is offline the sensors will continue to boot/work and from time to time check back in to see if the GW has returned from where every it wandered off to?
-
RE: Solenoid water valve
I've been look at this to do what you're asking.
https://www.amazon.com/gp/product/B06XX2PPGZ/ref=ox_sc_saved_title_2?smid=A20QEF2LEKCK8G&psc=1 -
RE: Any good home automation controllers?
Vera seemed like it would work and did for the one camera I bought that they sell. I couldn't get it to reliably work with MySensors. Could be me but NodeRed works for me.
-
RE: Looking for waterproof connectors
@raptorjr
Electricians use an anti-corrosive grease like stuff in areas of high humidity. You might try smearing the connector inside and out with that and then heat shrink the whole thing. Clean up the outside with alcohol and finish up with electrical tape.Plain old heavy axle grease may also do the trick. Just don't leave any voids, pack it solid.
-
RE: Water pressure sensors?
@gohan
gohan great solution wish I had thought of that! Not sure where I got the info that it wouldn't work. They didn't say how long it would take to get bad readings.
Because the pressure transducer I used is sealed you wouldn't have the same problem. As long as the connection were made watertight the sensor could just be installed at any level and it should work without the extra pump. Assuming you don't install it with the open end pointing down trapping a tiny bit of air in the opening. Not sure that would affect the readings but why take the chance. -
RE: Water pressure sensors?
@rwoerz
Sorry to say you can't use a tube submerged in the water. That will only work for a very short time. I was going to use that method to take a pressure reading to see how much head (water depth) was in my water well. The problem as I was told is the air in the tube is eventually absorbed by the water ending with a pressure of zero. If you had a way of blowing the tube clear of water just before you took each reading that would work. -
RE: Water pressure sensors?
I use a pressure sensor on the output of the pump that feeds my solar hot water panel. I think I got mine on Amazon. They use a lot of them in automotive applications. They come in lots of different pressure ranges. On mine I think I first had to figure out how to convert the analog input port reading from a number to a raw voltage. Most important you will first need to take a reading of your sensor in open air. FYI most of these sensors will run with any gas or liquid i.e. air, oil, water, etc.
The math for the sensors looks something like this:
PSI=(Sensor Voltage - open air voltage)/7This is why we need the open air reading. If your current voltage reading and your open air voltage are the same that means you current pressure would be 0 zero, right?
The next part the 7 is a little more complicated but remember it's just a number and I think I got mine right off the spec sheet for the sensor. If you plotted a graph for every reading from 0 psi to the sensors max pressure the slope of that line is where the number 7 comes from. Technically it's the slope of the linear regression. But we don't care how we got it because someone even nerdier than than me did the math and it's on the spec sheet. That's why we buy a new one instead of taking one off an old motor at the junkyard.
With that info I first had to determine the raw sensor voltage. The Arduino returns a value of 0 - 1023 for a voltage of 0 - 5 volts (I mostly use 5V Arduino's) so to find the voltage I use the following line in my code.
First get the raw sensor value.
float rawSensorValue = analogRead(tankPumpPressurePin); // Read Pin A15 Value range 0-1023Then convert that value into a voltage.
float voltage = rawSensorValue * (5.0 / 1023.0);Then to get the actual pressure I had to do a little more math with the following line. On my sensor the open air reading was 109.
tankPumpPressure = ((rawSensorValue - 109) / 7);
The whole thing looks like this.
void readTankPumpPressure()
{
// Read Pin A15 Value range 0-1023
float rawSensorValue = analogRead(tankPumpPressurePin);
float voltage = rawSensorValue * (5.0 / 1023.0);
tankPumpPressure = ((rawSensorValue - 109) / 7); // Should be in PSI.
currentTankPumpPressure = tankPumpPressure; send(msg_tank_pump_pressure.setDestination(GW_ID).setSensor(Tank_Pump_Pressure_ID).set(currentTankPumpPressure, 1));
}I hope this helped I also take flow reading.
-
Vera Inclusion Issue
Inclusion not working. This seems to happen every time something changes i.e. MySensors version change, my ip scheme changes, phase of the moon, my brain farts etc. I'm guessing this is more a Vera/MySensors plugin issue than a GW problem but I've be wrong at least once in my life. Well maybe a few more times than one, maybe.
The GW and the Vera both responed to a pings.
I started by cleaing the GW's flash. I'm on MySensors 2.2.0 and Vera 1.7.3500. I using an Arduino Genuino Uno as a Eithernet 5100 GW with all the latest Arduino software and I downloaded the latest Arduino/Vera plugin's Ver. 1.5. This has worked in the passed. Normally in the Vera inclusion area the "Stop" button will be lit and when you press the "Start" button it will stay lit for the inclusion time of 60 sec. Right now neither one is lit and neither one will stay lit. They do light up if you hover over one of them. The 5100 is a Shield. The same Setting tab show the following
Connected to: 10.0.0.200:5003
Plugin Version: 1.5
Lib Version:
Unit:At startup Serial Debug shows the following on the GW. As you can see the radio works just fine.
0 MCO:BGN:INIT GW,CP=RNNGA---,VER=2.2.0
3 TSM:INIT
4 TSF:WUR:MS=0
11 TSM:INIT:TSP OK
12 TSM:INIT:GW MODE
14 TSM:READY:ID=0,PAR=0,DIS=0
17 MCO:REG:NOT NEEDED
320 GWT:TIN:IP=10.0.0.200
1323 MCO:BGN:STP
My Vera Gateway V2.1, 4/27/18
1324 MCO:BGN:INIT OK,TSP=1
1329 TSF:MSG:READ,6-6-0,s=0,c=1,t=0,pt=7,l=5,sg=0:33.0
1941 TSF:MSG:READ,25-25-0,s=0,c=1,t=0,pt=7,l=5,sg=0:77.0
1947 TSF:MSG:READ,25-25-0,s=4,c=1,t=0,pt=7,l=5,sg=0:66.2When I start up my Scene controller I see the following in Debug on the GW which is what Vera should need when adding this device.
1104624 TSF:MSG:READ,27-27-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
1104629 TSF:MSG:PINGED,ID=27,HP=1
1104634 TSF:MSG:SEND,0-0-27-27,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
1104648 TSF:MSG:READ,27-27-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
1104690 !TSF:MSG:SEND,0-0-27-27,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
1106678 TSF:MSG:READ,27-27-0,s=255,c=0,t=18,pt=0,l=5,sg=0:2.2.0
1106691 TSF:MSG:READ,27-27-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
1108691 TSF:MSG:READ,27-27-0,s=255,c=3,t=11,pt=0,l=14,sg=0:SceneCNTL V2.6
1108702 TSF:MSG:READ,27-27-0,s=255,c=3,t=12,pt=0,l=7,sg=0:4/26/18
1108812 TSF:MSG:READ,27-27-0,s=1,c=0,t=6,pt=0,l=9,sg=0:Shop Temp
1108920 TSF:MSG:READ,27-27-0,s=32,c=0,t=14,pt=0,l=12,sg=0:TempSetPoint
1109028 TSF:MSG:READ,27-27-0,s=50,c=0,t=47,pt=0,l=4,sg=0:Hour
1109136 TSF:MSG:READ,27-27-0,s=51,c=0,t=47,pt=0,l=3,sg=0:Min
1109379 TSF:MSG:READ,27-27-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
1109386 TSF:MSG:SEND,0-0-27-27,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1Here is my GW sketch.
//
// My Vera 5100 GateWay V2.0 3/30/18
// Must have Soft SPI Enabled and the Rasio pins moved
// Also must have UDP Enabled
//
// * The GW code is designed for Arduino 328p / 16MHz. ATmega168 does not have enough memory to run this program.
// *
// * LED purposes:
// * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
// * - 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
// *
// * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
// *#define sketchInfo "My Vera Gateway V2.1"
#define sketchDate ", 4/27/18"// Enable debug prints to serial monitor
#define MY_DEBUG// Enable and select radio type attached
#define MY_RADIO_NRF24// Enable gateway ethernet module type
#define MY_GATEWAY_W5100// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
#define MY_W5100_SPI_EN 4// Enable Soft SPI for NRF radio (note different radio wiring is required)
// The W5100 ethernet module seems to have a hard time co-operate with
// radio on the same spi bus.
//#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
#define MY_SOFTSPI
#define MY_SOFT_SPI_SCK_PIN 14
#define MY_SOFT_SPI_MISO_PIN 16
#define MY_SOFT_SPI_MOSI_PIN 15
//#endif// When W5100 is connected we have to move CE/CSN pins for NRF radio
#ifndef MY_RF24_CE_PIN
#define MY_RF24_CE_PIN 5
#endif
#ifndef MY_RF24_CS_PIN
#define MY_RF24_CS_PIN 6
#endif// Enable to UDP
#define MY_USE_UDP#define MY_IP_ADDRESS 10,0,0,200 // If this is disabled, DHCP is used to retrieve address
// Renewal period if using DHCP
//#define MY_IP_RENEWAL_INTERVAL 60000
// 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 10,0,0,7// 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, 0x01// 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#if defined(MY_USE_UDP)
#include <EthernetUdp.h>
#endif
#include <Ethernet.h>
#include <MySensors.h>void setup()
{Serial.print(sketchInfo);
Serial.println(sketchDate);
}void loop() {
}The Vera Advanced Params Tab looks like this.
name MySensors Plugin
device_type urn:schemas-arduino-cc:device:arduino:1
altid
ip 10.0.0.200:5003
mac
manufacturer
model
id_parent 0
nobulk
embedded
disabled
restricted
device_file D_Arduino1.xml
id 246
room 2
impl_file
time_created 1524843290
device_json D_Arduino1.json
local_udn uuid:4d494342-5342-5645-00f6-000002aece62
commUse rs232
category_num 666And the Variables Tab looks like this.
PluginVersion 1.5
GWAddress 10.0.0.200:5003
Unit I -
RE: The Magic "void receive(const MyMessage & message)"
Gohan thanks for the link https://www.mysensors.org/download/sensor_api_20. I’ve been on that page many times so not sure how I missed it. That said and the fact I'm not a programmer some working examples for each would be most useful. I wrote tons of 8080 assembly code back in the day but my only official programming class was Fortran (you know the before time). C++ has not been an easy language to learn.
I’ve been looking for a replacement to the Arduino IDE for the past year. Every time I install one the steep learning curve keeps me from getting work done so I end up back where I started. I had much better tools back in the 70's working in assembly. At well over 1000 line of code and 21 tabs in just my Mega sketch I can use all the help I can get.
To be honest I’m about to give up on the whole Arduino thing so this project may be my last using this old 8 bit technology. Will Visual Studio Community Edition work with the newer micro controllers and maybe Python? Only my 5th or 6th programing language I'll have to learn.
Thanks again for the help. I’ll try and figure out why the getInt() isn’t working for me.
-
The Magic "void receive(const MyMessage & message)"
Let me start by saying I'm NOT a programmer so if you find something wrong here please let me know. I'm just the hardware guy which in the before time was magnitudes harder than it is today. I'm not dead yet but I'm also not young. So if I missed this information somewher, sorry.
I think it's Magic BUT but I'll talk about that later. There seems to be a lot of outdate information about node to node data transfer. I'll share what I know and then ask some questions. A lot about how this works has changed with newer versions of the MySensors software which makes most of the examples I found most confusing and time consuming.
I would like to thank the person that had this at the bottom of one of their sketchs as it answered a multitude of questions (but not all). I also found it invaluable for trouble shooting. I just need a longer list.
On the receiving end somewhere after void loop.
void receive(const MyMessage & message)
{
Serial.println("received something: ");
Serial.print("message.sender= "); // Node ID of the Sender
Serial.println(message.sender);
Serial.print("message.type= "); //Message type, the number assigned
Serial.println(message.type); // V_TEMP is 0 zero. etc.
Serial.print("message.sensor= "); // Child ID of the Sensor/Device
Serial.println(message.sensor);
Serial.print("message.payload= "); // This is where the wheels fall off
Serial.println(message.getFloat()); // This works great!
Serial.print("message.getBool()= ");
Serial.println(message.getBool()); // I think this does too
}
For me it showed the variable names used to dissect the serial protocal, the orignal was a little differant but I think it was a bit outdated. The big differance was how to read float values that are in the payload, I got the "get.float()" somewhere else. It works perfect if you want to read stuff like temps and humidities but not so great for intergers and strings so far. But being able to take the whole packet apart would be good to. I'm sure there's more. The "command" would also help.So my question is, where is the definitive list of these vairable names. I'm currently trying to send integers, I tried message.getInt() without any luck. The compiler didn't complain but it also didn't work. I think I saw somewhere how to read the "ACK" but that will have to wait for another day.
After a lot of reading and trial and error it turns out to be pretty easy to send data from one node to another and I don't think you even need a gateway? You need three things when you want to send something from one Node another Node. Important Safety Note: I'm pretty sure at least on your recieving Node the repeater feature has to be enabled, NO going to sleep!
Second on your transmitting end you'll need to add the destination Node ID as the second vairable in your send command.
send(msg.setDestination(recieving node ID).set(sensor ID).set(vairable))
This could just be me but a strange thing happened after sending the first message with the new destination, the system set that as its default. So if you wanted it to also go to the the GW you'll have to add a
setDestination( GW_Node_ID) or "0" zero to all of your "normal" send commands.And third on your receiving end you'll need the function: void receive(const MyMessage & message) line followed commands with what you want to do with the data and I've seen some complex ones.
The reason I called it Magic was because I have no clue how it works. As soon as you have the "void receive funtion" added to your scketch the data comes flooding in. If you have debug enabled you'll see packets coming in as soon as #include <MySensors.h> gets executed, it's totaly asynchronous. I've not run into it yet but be careful not to overrun your recieving end.
So if someone can fill in the list for us we would all be a little smarter.
I hope this was helpful to some, I wish I'd read it months ago writen by some one else. Maybe then my family wouldn't have threatened to put me on the cart. Sorry old movie reference for those that have never seen the funnist movie ever made.If you get this far thanks for reading my rantings.
-
RE: atmega328p small (SMD) alternative with more memory?
@tochinet
If you don't need a lot of them use a Mega it has lots more memory. They're much cheaper than they used to be. Of course an ESP8266 will also work if you don't need all the pins. -
RE: 💬 Building a WiFi Gateway using ESP8266
Sorry about the typing. I also have a question about radio pins. The ESP8266 sketch shows different pins for the radio then "Connecting the Radio". I don't see the pins defined in the sketch so where do I go to change them?
-
RE: 💬 Building a WiFi Gateway using ESP8266
One for thing will this work with a ESP32?
-
RE: 💬 Building a WiFi Gateway using ESP8266
Sorry but can someone explain the differance between "Server" and "Client" modes. I got my ESP8266 working with my Vera but then I install a RPi 3 I'm using for MQTT. Do I need 2 gateways, one for the Vera and another for MQTT? Even though I'm moving away from the Vera it's still usfull. Thanks for the help.
-
RE: 💬 Sensebender Micro
Can somebody please post what this boards current draw is at 8Mz w/wo a radio. Because it will live in a crawl space It's going to be plugged in. I've also added a very simple water detector.
-
RE: [SOLVED] Sensebender Micro Baud Rate Issue.
Thanks for the explanation. Makes perfect sense. In the past if there was a processor mismatch the programs would not download.
-
RE: [SOLVED] Sensebender Micro Baud Rate Issue.
My grandfather told me not to get old you forget stuff. Sorry to say I lead you on a wild goose chase. Thanks for the help ends up I had an Arduino Micro hooked up on my bench I'd forgotten about. Looks like if you define it as a Sensebender Micro it will only talk to you at 230400, go figure.
Thanks again. I know this will cost me some cred points but I hope I won't lose my secret handshake.
Thanks again guys.
-
RE: [SOLVED] Sensebender Micro Baud Rate Issue.
Yes I have several other sensors working. My solar heating and 2 stage evaporative cooling system has 20 sensors on one Mega and it works fine. I just wished my Vera worked as well as my sensors. It goes down one or more times a day and sometimes it doesn't come back. I've had it replaced so who knows.
Yes it worked without the serial.begin(). The board I pick in the Arduino IDE was a Sensebender Micro with the Atmega328 8MHz. There's no baud rate to chose from. Sometimes I get the last three line and sometimes I get junk. Might be because on the lack of the crystal on the CPU. Should I be looking into the bootloader (BIOS for us old folks) to try and change the baud rate?
It doesn't appear to get as far as the setup routine and because I haven't figured out how to do a Serial.println before that it's hard to figure out where it gets lost. I'm used to having breakpoints and other tools to watch programs run. If I should be using something other than the Arduino IDE (that's free) please let me know. Back in another life I wrote a lot of drivers in assemble to go with I/O cards I was designing.
BTW thanks for the help!!! I get tired of only talking to that other guy in my head.
-
RE: [SOLVED] Sensebender Micro Baud Rate Issue.
So lets forget about the baud rate issue for now. At this point it looks like the program stops before it gets to the Setup routine. How about a little help please.
-
RE: [SOLVED] ESP8266 Inclusion Issue
Let me start by saying I made some incorrect assumptions. If you look I assigned an IP address to the device and to the MY_CONTROLLER_IP_ADDRESS which I thought was necessary so it could find my Vera. It talks about the fact that by assigning an IP address to it it changed it from Server to Client mode which I couldn't find much info on. You have to know I'm a hardware guy. I know just enough software to be dangerous. I think it was this change that kept it from working.
The way I had it configured wireshark showed the ESP8266 only sent out one packet after being powered up, after that nothing. I was able to telnet to it on port 5003 but basically got nothing. After commenting out the MY_CONTOLLER_IP_ADDRESS when I telneted to it I saw a stream of sensor data. It seems a bit counterintuitive but in this mode it looks like my Vera was connecting to the GW and watching the data stream. That's a WAG on my part but it seems logical at this point.
Now I hope someone can give me some help on my Senesebender Micro issue.
-
RE: [SOLVED] Sensebender Micro Baud Rate Issue.
No matter what I do I can't change the baud rate it must be set in the bootloader. Not sure why but now I'm getting 3 extra lines on bootup and not the trash at the end of the pag but so far I can't get beyond the startup page.
Final 3 lines.
4392 MCO:BGN:STP
Sensebender Micro FW 1.4 - Online!
isMetric: 0 -
RE: [SOLVED] Sensebender Micro Baud Rate Issue.
Sorry just found the Serial.begin(230400); in the setup code. I'll start by changing it to 112500.
-
[SOLVED] Sensebender Micro Baud Rate Issue.
I just brought up two Sensebender Micros. I was able to download the temp/Humidity sketch in both unites. In both cases when I opened the Serial Monitor the only baud rate that works is 230400 despite trying to set it in the Sketch and in Myconfig.h to 112500. When I open the Serial Monitor it appears to run through its startup just fine but then it looks like its baud rate get changed. After that it's never heard from again. I've gone through all the baud rates but nothing seem to match up. Anybody got any ideas? I've included the Serial Monitor output along with the Sketch.
0 MCO:BGN:INIT NODE,CP=RNONA--,VER=2.1.1 4 TSM:INIT 4 TSF:WUR:MS=0 12 TSM:INIT:TSP OK 14 TSM:INIT:STATID=44 22 TSF:SID:OK,ID=44 24 TSM:FPAR 96 TSF:MSG:SEND,44-44-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 1476 TSF:MSG:READ,25-25-44,s=255,c=3,t=8,pt=1,l=1,sg=0:1 1482 TSF:MSG:FPAR OK,ID=25,D=2 2105 TSM:FPAR:OK 2105 TSM:ID 2107 TSM:ID:OK 2109 TSM:UPL 2113 TSF:MSG:SEND,44-44-25-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 2189 TSF:MSG:READ,0-25-44,s=255,c=3,t=25,pt=1,l=1,sg=0:2 2195 TSF:MSG:PONG RECV,HP=2 2199 TSM:UPL:OK 2199 TSM:READY:ID=44,PAR=25,DIS=2 2207 TSF:MSG:SEND,44-44-25-0,s=255,c=4,t=0,pt=6,l=10,sg=0,ft=0,st=OK:FFFFFFFFFFFFFFFF0300 2220 TSF:MSG:SEND,44-44-25-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 2324 TSF:MSG:READ,0-25-44,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 2334 TSF:MSG:SEND,44-44-25-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1 2344 TSF:MSG:SEND,44-44-25-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:25 4358 TSF:MSG:SEND,44-44-25-0,s=255,c=3,t=11,pt=0,l=25,sg=0,ft=0,st=OK:Sensebender Micro #1 V1.0 4372 TSF:MSG:SEND,44-44-25-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.4 4450 !TSF:MSG:SEND,44-44-25-0,s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=NACK: 4460 TSF:MSG:SEND,44-44-25-0,s=2,c=0,t=7,pt=0,l=0,sg=0,ft=1,st=OK: 4470 TSF:MSG:SEND,44-44-25-0,s=199,c=0,t=13,pt=0,l=0,sg=0,ft=0,st=OK: 4478 MCO:REG:REQ 4550 !TSF:MSG:SEND,44-44-25-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=NACK:2 6561 TSF:MSG:SEND,44-44-25-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2 6621 TSF:MSG:READ,0-25-44,s=255,c=3,t=27,pt=1,l=1,sg=0:1 6627 MCO:PIM:NODE REG=1 6629 MCO:BGN:STP hmp~Š5®l‹M8ñ@ð`Vedé“.ˆì
/** * 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 - Thomas Bowman Mørch * * DESCRIPTION * Default sensor sketch for Sensebender Micro module * Act as a temperature / humidity sensor by default. * * If A0 is held low while powering on, it will enter testmode, which verifies all on-board peripherals * * Battery voltage is as battery percentage (Internal message), and optionally as a sensor value (See defines below) * * * Version 1.3 - Thomas Bowman Mørch * Improved transmission logic, eliminating spurious transmissions (when temperatuere / humidity fluctuates 1 up and down between measurements) * Added OTA boot mode, need to hold A1 low while applying power. (uses slightly more power as it's waiting for bootloader messages) * * Version 1.4 - Thomas Bowman Mørch * * Corrected division in the code deciding whether to transmit or not, that resulted in generating an integer. Now it's generating floats as expected. * Simplified detection for OTA bootloader, now detecting if MY_OTA_FIRMWARE_FEATURE is defined. If this is defined sensebender automaticly waits 300mS after each transmission * Moved Battery status messages, so they are transmitted together with normal sensor updates (but only every 60th minute) * */ // Enable debug prints to serial monitor #define MY_DEBUG // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h // #define MY_BAUD_RATE 115200 // Define a static node address, remove if you want auto address assignment #define MY_NODE_ID 44 // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable to support OTA for this node (needs DualOptiBoot boot-loader to fully work) #define MY_OTA_FIRMWARE_FEATURE // Enabled repeater feature for this node // #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> #include <Wire.h> #include <SI7021.h> #ifndef MY_OTA_FIRMWARE_FEATURE #include "drivers/SPIFlash/SPIFlash.cpp" #endif #include <EEPROM.h> #include <sha204_lib_return_codes.h> #include <sha204_library.h> #include <RunningAverage.h> //#include <avr/power.h> // Uncomment the line below, to transmit battery voltage as a normal sensor value #define BATT_SENSOR 199 #define RELEASE "1.4" #define AVERAGES 2 // Child sensor ID's #define CHILD_ID_TEMP 1 #define CHILD_ID_HUM 2 // How many milli seconds between each measurement #define MEASURE_INTERVAL 60000 // How many milli seconds should we wait for OTA? #define OTA_WAIT_PERIOD 300 // FORCE_TRANSMIT_INTERVAL, this number of times of wakeup, the sensor is forced to report all values to the controller #define FORCE_TRANSMIT_INTERVAL 30 // When MEASURE_INTERVAL is 60000 and FORCE_TRANSMIT_INTERVAL is 30, we force a transmission every 30 minutes. // Between the forced transmissions a tranmission will only occur if the measured value differs from the previous measurement // HUMI_TRANSMIT_THRESHOLD tells how much the humidity should have changed since last time it was transmitted. Likewise with // TEMP_TRANSMIT_THRESHOLD for temperature threshold. #define HUMI_TRANSMIT_THRESHOLD 0.5 #define TEMP_TRANSMIT_THRESHOLD 0.5 // Pin definitions #define TEST_PIN A0 #define LED_PIN A2 #define ATSHA204_PIN 17 // A3 const int sha204Pin = ATSHA204_PIN; atsha204Class sha204(sha204Pin); SI7021 humiditySensor; SPIFlash flash(8, 0x1F65); // Sensor messages MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); #ifdef BATT_SENSOR MyMessage msgBatt(BATT_SENSOR, V_VOLTAGE); #endif // Global settings int measureCount = 0; int sendBattery = 0; boolean isMetric = true; boolean highfreq = true; boolean transmission_occured = false; // Storage of old measurements float lastTemperature = -100; int lastHumidity = -100; long lastBattery = -100; RunningAverage raHum(AVERAGES); /**************************************************** * * Setup code * ****************************************************/ void setup() { pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, LOW); Serial.begin(230400); Serial.println("SensebenderMicro #2 V1.0.1"); Serial.print(F("Sensebender Micro FW ")); Serial.print(RELEASE); Serial.flush(); // First check if we should boot into test mode pinMode(TEST_PIN,INPUT); digitalWrite(TEST_PIN, HIGH); // Enable pullup if (!digitalRead(TEST_PIN)) testMode(); // Make sure that ATSHA204 is not floating pinMode(ATSHA204_PIN, INPUT); digitalWrite(ATSHA204_PIN, HIGH); digitalWrite(TEST_PIN,LOW); digitalWrite(LED_PIN, HIGH); humiditySensor.begin(); digitalWrite(LED_PIN, LOW); Serial.flush(); Serial.println(F(" - Online!")); isMetric = getControllerConfig().isMetric; Serial.print(F("isMetric: ")); Serial.println(isMetric); raHum.clear(); sendTempHumidityMeasurements(false); sendBattLevel(false); #ifdef MY_OTA_FIRMWARE_FEATURE Serial.println("OTA FW update enabled"); #endif } void presentation() { sendSketchInfo("Sensebender Micro #1 V1.0.1", RELEASE); present(CHILD_ID_TEMP,S_TEMP); present(CHILD_ID_HUM,S_HUM); #ifdef BATT_SENSOR present(BATT_SENSOR, S_POWER); #endif } /*********************************************** * * Main loop function * ***********************************************/ void loop() { measureCount ++; sendBattery ++; bool forceTransmit = false; transmission_occured = false; if (measureCount >= FORCE_TRANSMIT_INTERVAL) { // force a transmission forceTransmit = true; measureCount = 0; } sendTempHumidityMeasurements(forceTransmit); /* if (sendBattery > 60) { sendBattLevel(forceTransmit); // Not needed to send battery info that often sendBattery = 0; }*/ #ifdef MY_OTA_FIRMWARE_FEATURE if (transmission_occured) { wait(OTA_WAIT_PERIOD); } #endif sleep(MEASURE_INTERVAL); } /********************************************* * * Sends temperature and humidity from Si7021 sensor * * Parameters * - force : Forces transmission of a value (even if it's the same as previous measurement) * *********************************************/ void sendTempHumidityMeasurements(bool force) { bool tx = force; si7021_env data = humiditySensor.getHumidityAndTemperature(); raHum.addValue(data.humidityPercent); float diffTemp = abs(lastTemperature - (isMetric ? data.celsiusHundredths : data.fahrenheitHundredths)/100.0); float diffHum = abs(lastHumidity - raHum.getAverage()); Serial.print(F("TempDiff :"));Serial.println(diffTemp); Serial.print(F("HumDiff :"));Serial.println(diffHum); if (isnan(diffHum)) tx = true; if (diffTemp >= TEMP_TRANSMIT_THRESHOLD) tx = true; if (diffHum >= HUMI_TRANSMIT_THRESHOLD) tx = true; if (tx) { measureCount = 0; float temperature = (isMetric ? data.celsiusHundredths : data.fahrenheitHundredths) / 100.0; int humidity = data.humidityPercent; Serial.print("T: ");Serial.println(temperature); Serial.print("H: ");Serial.println(humidity); send(msgTemp.set(temperature,1)); send(msgHum.set(humidity)); lastTemperature = temperature; lastHumidity = humidity; transmission_occured = true; if (sendBattery > 60) { sendBattLevel(true); // Not needed to send battery info that often sendBattery = 0; } } } /******************************************** * * Sends battery information (battery percentage) * * Parameters * - force : Forces transmission of a value * *******************************************/ void sendBattLevel(bool force) { if (force) lastBattery = -1; long vcc = readVcc(); if (vcc != lastBattery) { lastBattery = vcc; #ifdef BATT_SENSOR float send_voltage = float(vcc)/1000.0f; send(msgBatt.set(send_voltage,3)); #endif // Calculate percentage vcc = vcc - 1900; // subtract 1.9V from vcc, as this is the lowest voltage we will operate at long percent = vcc / 14.0; sendBatteryLevel(percent); transmission_occured = true; } } /******************************************* * * Internal battery ADC measuring * *******************************************/ long readVcc() { // Read 1.1V reference against AVcc // set the reference to Vcc and the measurement to the internal 1.1V reference #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) ADMUX = _BV(MUX5) | _BV(MUX0); #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) ADcdMUX = _BV(MUX3) | _BV(MUX2); #else ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); #endif delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Start conversion while (bit_is_set(ADCSRA,ADSC)); // measuring uint8_t low = ADCL; // must read ADCL first - it then locks ADCH uint8_t high = ADCH; // unlocks both long result = (high<<8) | low; result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000 return result; // Vcc in millivolts } /**************************************************** * * Verify all peripherals, and signal via the LED if any problems. * ****************************************************/ void testMode() { uint8_t rx_buffer[SHA204_RSP_SIZE_MAX]; uint8_t ret_code; byte tests = 0; digitalWrite(LED_PIN, HIGH); // Turn on LED. Serial.println(F(" - TestMode")); Serial.println(F("Testing peripherals!")); Serial.flush(); Serial.print(F("-> SI7021 : ")); Serial.flush(); if (humiditySensor.begin()) { Serial.println(F("ok!")); tests ++; } else { Serial.println(F("failed!")); } Serial.flush(); Serial.print(F("-> Flash : ")); Serial.flush(); if (flash.initialize()) { Serial.println(F("ok!")); tests ++; } else { Serial.println(F("failed!")); } Serial.flush(); Serial.print(F("-> SHA204 : ")); ret_code = sha204.sha204c_wakeup(rx_buffer); Serial.flush(); if (ret_code != SHA204_SUCCESS) { Serial.print(F("Failed to wake device. Response: ")); Serial.println(ret_code, HEX); } Serial.flush(); if (ret_code == SHA204_SUCCESS) { ret_code = sha204.getSerialNumber(rx_buffer); if (ret_code != SHA204_SUCCESS) { Serial.print(F("Failed to obtain device serial number. Response: ")); Serial.println(ret_code, HEX); } else { Serial.print(F("Ok (serial : ")); for (int i=0; i<9; i++) { if (rx_buffer[i] < 0x10) { Serial.print('0'); // Because Serial.print does not 0-pad HEX } Serial.print(rx_buffer[i], HEX); } Serial.println(")"); tests ++; } } Serial.flush(); Serial.println(F("Test finished")); if (tests == 3) { Serial.println(F("Selftest ok!")); while (1) // Blink OK pattern! { digitalWrite(LED_PIN, HIGH); delay(200); digitalWrite(LED_PIN, LOW); delay(200); } } else { Serial.println(F("----> Selftest failed!")); while (1) // Blink FAILED pattern! Rappidly blinking.. { } } }
-
[SOLVED] ESP8266 Inclusion Issue
I was running a UNO and a 5100 Ethernet shield as a GW but some of my sensors were to far away to work so I'm trying to use a ESP8266 as a GW. After bringing it up inclusion didn't work but I was getting an update from a temp sensor on the Vera. I then removed the MySensors plugin and load all the latest files in the Vera. I'm running MySensors 2.1.1 I downloaded yesterday. On the Vera neither of the Start or Stop buttons are lite. The Start or Stop buttons light only as long a I hover over them and pressing the start button I get a wait symbol for 2 or 3 seconds but that's it. When I press the inclusion button on the GW I don't see any changes. This is the startup log of the GW, sensor 25 is already running and I pressed the inclusion button on the GW and started sensor 6. I can't tell why inclusion isn't working. The Vera is IP is 192.168.0.48. The GW Sketch is included at the end.
scandone
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 9
cntconnected with RWCL, channel 1 ip:192.168.0.137,mask:255.255.255.0,gw:192.168.0.1 .IP: 192.168.0.137 0;255;3;0;9;MCO:BGN:STP 0;255;3;0;9;MCO:BGN:INIT OK,TSP=1 0;255;3;0;9;TSF:MSG:READ,25-25-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 0;255;3;0;9;TSF:MSG:BC 0;255;3;0;9;TSF:MSG:FPAR REQ,ID=25 0;255;3;0;9;TSF:CKU:OK,FCTRL 0;255;3;0;9;TSF:MSG:GWL OK 0;255;3;0;9;TSF:MSG:SEND,0-0-25-25,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 0;255;3;0;9;TSF:MSG:PINGED,ID=25,HP=1 0;255;3;0;9;TSF:MSG:SEND,0-0-25-25,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=32,c=1,t=45,pt=7,l=5,sg=0:79.9 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=32,c=1,t=45,pt=7,l=5,sg=0:79.9 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=0,c=1,t=0,pt=7,l=5,sg=0:79.7 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=4,c=1,t=0,pt=7,l=5,sg=0:68.9 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=1,c=1,t=0,pt=7,l=5,sg=0:72.5 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=2,c=1,t=0,pt=7,l=5,sg=0:64.4 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=12,c=1,t=34,pt=7,l=5,sg=0:2.0 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=11,c=1,t=4,pt=7,l=5,sg=0:80.7 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=3,c=1,t=0,pt=7,l=5,sg=0:83.3 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=13,c=1,t=2,pt=2,l=2,sg=0:1 pm open,type:2 0 0;255;3;0;9;TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 0;255;3;0;9;TSF:MSG:BC 0;255;3;0;9;TSF:MSG:FPAR REQ,ID=1 0;255;3;0;9;TSF:PNG:SEND,TO=0 0;255;3;0;9;TSF:CKU:OK 0;255;3;0;9;TSF:MSG:GWL OK 0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 0;255;3;0;9;TSF:MSG:PINGED,ID=1,HP=1 0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=0,t=17,pt=0,l=10,sg=0:2.0.1-beta 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=32,c=1,t=45,pt=7,l=5,sg=0:79.9 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=32,c=1,t=45,pt=7,l=5,sg=0:79.9 0;255;3;0;9;TSF:MSG:READ,6-6-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 0;255;3;0;9;TSF:MSG:BC 0;255;3;0;9;TSF:MSG:FPAR REQ,ID=6 0;255;3;0;9;TSF:CKU:OK,FCTRL 0;255;3;0;9;TSF:MSG:GWL OK 0;255;3;0;9;TSF:MSG:SEND,0-0-6-6,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=0,c=1,t=0,pt=7,l=5,sg=0:79.7 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=4,c=1,t=0,pt=7,l=5,sg=0:68.9 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=1,c=1,t=0,pt=7,l=5,sg=0:72.5 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 0;255;3;0;9;TSF:MSG:PINGED,ID=6,HP=1 0;255;3;0;9;TSF:MSG:SEND,0-0-6-6,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=2,c=1,t=0,pt=7,l=5,sg=0:64.4 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=12,c=1,t=34,pt=7,l=5,sg=0:2.0 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=11,c=1,t=4,pt=7,l=5,sg=0:68.3 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=3,c=1,t=0,pt=7,l=5,sg=0:83.3 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=13,c=1,t=2,pt=2,l=2,sg=0:1 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 0;255;3;0;9;TSF:MSG:SEND,0-0-6-6,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.0.0 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 0;255;3;0;9;TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 0;255;3;0;9;TSF:MSG:BC 0;255;3;0;9;TSF:MSG:FPAR REQ,ID=1 0;255;3;0;9;TSF:CKU:OK,FCTRL 0;255;3;0;9;TSF:MSG:GWL OK 0;255;3;0;9;!TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=255,c=3,t=11,pt=0,l=22,sg=0:TemperatureAndHumidity 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.1 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=0,c=0,t=7,pt=0,l=0,sg=0: 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 0;255;3;0;9;TSF:MSG:PINGED,ID=1,HP=1 0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=0,t=17,pt=0,l=10,sg=0:2.0.1-beta 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 0;255;3;0;9;TSF:MSG:SEND,0-0-6-6,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=1,c=1,t=0,pt=7,l=5,sg=0:79.0 0;255;3;0;9;TSF:MSG:READ,6-6-0,s=0,c=1,t=1,pt=7,l=5,sg=0:29.2 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=11,pt=0,l=18,sg=0:Temperature Sensor 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.1 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=0,c=0,t=6,pt=0,l=0,sg=0: 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 0;255;3;0;9;TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 0;255;3;0;9;TSF:MSG:READ,1-1-0,s=0,c=1,t=0,pt=7,l=5,sg=0:72.5 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=32,c=1,t=45,pt=7,l=5,sg=0:79.9 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=32,c=1,t=45,pt=7,l=5,sg=0:79.9 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=0,c=1,t=0,pt=7,l=5,sg=0:79.7 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=4,c=1,t=0,pt=7,l=5,sg=0:68.9 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=1,c=1,t=0,pt=7,l=5,sg=0:72.5 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=2,c=1,t=0,pt=7,l=5,sg=0:64.4 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=12,c=1,t=34,pt=7,l=5,sg=0:2.0 0;255;3;0;9;TSF:MSG:READ,25-25-0,s=11,c=1,t=4,pt=7,l=5,sg=0:66.3
/** * 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 - Henrik EKblad * Contribution by a-lurker and Anticimex, * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de> * Contribution by Ivo Pullens (ESP8266 support) * * DESCRIPTION * The EthernetGateway sends data received from sensors to the WiFi link. * The gateway also accepts input on ethernet interface, which is then sent out to the radio network. * * VERA CONFIGURATION: * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003 * * LED purposes: * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch, only the LEDs that is defined is used. * - 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 * * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions. * nRF24L01+ ESP8266 * VCC VCC * CE GPIO4 * CSN/CS GPIO15 * SCK GPIO14 * MISO GPIO12 * MOSI GPIO13 * GND GND * * Not all ESP8266 modules have all pins available on their external interface. * This code has been tested on an ESP-12 module. * The ESP8266 requires a certain pin configuration to download code, and another one to run code: * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch') * - Connect GPIO15 via 10K pulldown resistor to GND * - Connect CH_PD via 10K resistor to VCC * - Connect GPIO2 via 10K resistor to VCC * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch') * * Inclusion mode button: * - Connect GPIO5 via switch to GND ('inclusion switch') * * Hardware SHA204 signing is currently not supported! * * Make sure to fill in your ssid and WiFi password below for ssid & pass. */ #define LED_BUILTIN D4 #define D0 16 // GPIO16 #define D1 5 // GPIO5 I2C Bus SCL (clock) #define D2 4 // GPIO4 I2C Bus SDA (data) #define D3 0 // GPIO0 #define D4 2 // GPIO2 Same as "LED_BUILTIN", but inverted logic #define D5 14 // GPIO14 SPI Bus SCK (clock) #define D6 12 // GPIO12 SPI Bus MISO #define D7 13 // GPIO13 SPI Bus MOSI #define D8 15 // GPIO15 SPI Bus SS (CS) #define D9 3 // GPIO3 RX0 (Serial console) #define D10 1 // GPIO1 TX0 (Serial console) // Enable debug prints to serial monitor #define MY_DEBUG // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h #define MY_BAUD_RATE 115200 // Enables and select radio type (if attached) #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "RWCL" #define MY_ESP8266_PASSWORD "xxxxxxxxx" // Enable UDP communication #define MY_USE_UDP // Set the hostname for the WiFi Client. This is the hostname // it will pass to the DHCP server if not static. #define MY_ESP8266_HOSTNAME "sensor-gateway" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) #define MY_IP_ADDRESS 192,168,0,137 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,0,1 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // The port to keep open on node server mode #define MY_PORT 5003 // How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 2 // 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,0,48 // 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 120 // Digital pin used for inclusion mode button #define MY_INCLUSION_MODE_BUTTON_PIN 3 // Digital pin usef for inclusion LED // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 #define MY_WITH_LEDS_BLINKING_INVERSE // Flash leds on rx/tx/err // Led pins used if blinking feature is enabled above #define MY_DEFAULT_ERR_LED_PIN D0 // Error led pin #define MY_DEFAULT_RX_LED_PIN D4 // Receive led pin #define MY_DEFAULT_TX_LED_PIN D1 // the PCB, on board LED #if defined(MY_USE_UDP) #include <WiFiUdp.h> #endif #include <ESP8266WiFi.h> #include <MySensors.h> void setup() { } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attached sensors data here }
-
RE: GatewayESP8266 Compile problem.
Thanks that seems to have worked. This is what is needed.
In the file MyGatewayTransportEthernet.cpp around line 301 the following changes need to be made. All the [0]'s need to be removed.Old:
#if defined(MY_GATEWAY_ESP8266)
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
inputString[0].string[packet_size] = 0;
debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
const bool ok = protocolParse(_ethernetMsg, inputString[0].string);
#elseNew:
#if defined(MY_GATEWAY_ESP8266)
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
inputString.string[packet_size] = 0;
debug(PSTR("UDP packet received: %s\n"), inputString.string);
const bool ok = protocolParse(_ethernetMsg, inputString.string);
#else -
GatewayESP8266 Compile problem.
I,m having a problem compiling GatewayESP8266. I downloaded the latest libraries and started with a fresh copy of the Gateway program. I put in my WiFi and gateway info and it complied. I then enabled UDP and I got the expected error that it needed a MY_CONTROLLER_IP_ADDRESS. I added the address of Vera and that's when things went sideways. I got the following error.
In file included from C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/MySensors.h:200:0,
from C:\Users\RWoerz\AppData\Local\Temp\arduino_modified_sketch_73845\GatewayESP8266.ino:134:
C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool gatewayTransportAvailable()':
C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:302:35: error: no match for 'operator[]' (operand types are 'inputBuffer' and 'int')
_ethernetServer.read(inputString[0].string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
^
C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:303:14: error: no match for 'operator[]' (operand types are 'inputBuffer' and 'int')
inputString[0].string[packet_size] = 0;
^
In file included from C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/MySensors.h:28:0,
from C:\Users\RWoerz\AppData\Local\Temp\arduino_modified_sketch_73845\GatewayESP8266.ino:134:
C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:304:55: error: no match for 'operator[]' (operand types are 'inputBuffer' and 'int')
debug(PSTR("UDP packet received: %s\n"), inputString[0].string);
^
C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/core/MySensorsCore.h:90:40: note: in definition of macro 'debug'
#define debug(x,...) hwDebugPrint(x, ##VA_ARGS) //!< debug, to be removed (follow-up PR)
^
In file included from C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/MySensors.h:200:0,
from C:\Users\RWoerz\AppData\Local\Temp\arduino_modified_sketch_73845\GatewayESP8266.ino:134:
C:\Users\RWoerz\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:305:58: error: no match for 'operator[]' (operand types are 'inputBuffer' and 'int')
const bool ok = protocolParse(_ethernetMsg, inputString[0].string);
^
Multiple libraries were found for "WiFiUdp.h"
Used: C:\Users\RWoerz\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Multiple libraries were found for "MySensors.h"
Used: C:\Users\RWoerz\Documents\Arduino\libraries\MySensors
Not used: C:\Users\RWoerz\Documents\Arduino\libraries\arduino_343871
Not used: C:\Users\RWoerz\Documents\Arduino\libraries\arduino_271619
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module). -
RE: 💬 Building an Ethernet Gateway
I have a Vera but I'm moving some of my stuff over to OpenHab. So on one side I was using the standard W5100 GateWay on the other I need the MQTT GateWay. The major difference is in the "define MY_PORT" one is 5003 and the other is 1883. Is there a way to do both? Thanks.
-
RE: Support for ARDUINO_SAM (e.g. ARDUINO DUE)
What board do I pick in the Arduino IDE when I go to compile my code. It doesn't work if I pick DUE? Thanks.
-
RE: Support for ARDUINO_SAM (e.g. ARDUINO DUE)
@FotoFieber My GW seems fine but if I need to I can put up a ESP8266 as my GW. I need the Mega/DUE's I/O for a Solar heating project I'm working on that needs lots of I/O. I just bought the DUE thinking it would just work now that they support ARM CPU's but alas that's not the case.
I may have to just go to an all IP network and forget about the mysensors stuff for the Solar heating project. It would be sad as they've done so much great work. I also have Photon's I can't use because of the same issue. It's not really their problem it's mine. They are headed in the right direction as I think the 8 bit Arduino's of the world are going the way of the Dodo bird very soon.
I just moved off of a Vera and on to OpenHab. For some reason the Vera just wasn't stable in my environment.
-
RE: Support for ARDUINO_SAM (e.g. ARDUINO DUE)
@RWoerz Anything new on this issue? As I need the added I/O the DUE seemed like a great fit.
-
RE: Vera/MySensors/MQTT/OpenHab
Thank you very much for you reply. I can now quit beating my head against the table.
-
Vera/MySensors/MQTT/OpenHab
I started this whole journey with a Vera Edge and some MySensors sensors. It hasn't always been an easy one and due to some long standing problems Vera just replaced it. I the meantime I've added OpenHab that includes a MQTT broker. Now Vera can't talk to the MySensors ethernet GW. I know by changing to a MQTT GW that it's port changed from 5003 to 1883. Is that why Vera can't talk to it. I changed the port# in the Vera's MySensors config from 5003 to 1883 but so far no joy.
-
RE: Monitoring a wood boiler heating system
Great work how do you send error messages from a MySensors node. I'm building a solar hot water heater for my shop with temp sensors inside, outside, solar panel, storage tank, and the attic, I also have flow and pressures sensors in the tank pump solar panel and another tank pump and inside heat exchanger. Besides the pumps I also control attic, ceiling and roof louvers and fans. Needless to say there's lots that could go wrong. If you've got a way to send alarms I would love to see the Sketches. Thanks.
I would also like to see pictures of setup I think many other would also.
-
Error Handling
I'm trying to figure out a way to send error messages from my solar heater project to me in the form of a text message or email. Is there already a way to do that or does that have to be added to MySensors or Vera. We need to way to handle errors in the form of an error message i.e. "Your flux capacitor is out of alignment and it's about to wipe out New York". Well it might not to be that long. Oh and I second the request for V_PRESSURE so I can log water pressure in PSI.
-
RE: 💬 Serial Protocol - 2.x
Sorry I found V_FLOW 34 Flow of water (in meter) S_WATER. What exactly does "in meter" mean?
-
RE: 💬 Serial Protocol - 2.x
This is just what I've been looking for. I do however have a suggestion. I'm building a solar heater (water) for my shop and need to keep track of at least 3 temps (solar panel, storage tank, and inside shop), 1 water pressure and 1 water flow meter (for solar panel Pump) . There doesn't seem to be V_ or S_ variables for direct water pressure or flow. Would you please add something for them.
-
RE: Compile error #include <avr/dtostrf.h>
Thanks for the reply but I'm not much of a modern day programmer Most of my programming was done writing drivers for I/O cards in assembly in the before time.
-
Compile error #include <avr/dtostrf.h>
I'm trying out AtmelStudio 7 and so far it looks great. I am running into an issue while trying to compile the MySensors DallasTemperature sketch.
MyHwSAMD.cpp:20: In file included from
MyHwSAMD.h: 30:25: fatal error: avr/dtostrf.h: No such file or directory
#include <avr/dtostrf.h>
compilation terminatedI've looked on the internet but so far no real answer just a bunch of GeekSpeak I don't understand. Don't get me wrong I a huge Geek but there are some thing I'll never understand.
-
RE: Getting !TSF:ASID:FAIL,ID=0 Error In 2.0 Beta
I cleared the memory but not it seems with the MySensors Sketch so it didn't clear everything out. I ran the MySensors sketch today and everything works thanks.
-
RE: Getting !TSF:ASID:FAIL,ID=0 Error In 2.0 Beta
I plan to use it as a sensor to that talks to the ethernet gateway. Thanks for the help I'll you know.
-
Getting !TSF:ASID:FAIL,ID=0 Error In 2.0 Beta
I just changed over to an Ethernet gateway and things are working except when I try to use my old Serial Gateway. The gateway I used for almost a year is a 5V pro-mini, worked great. I used a UNO for my Ethernet gateway and would like to use my old gateway as a temperature sensor. I cleared the eprom and loaded the same sketch I'm using on 3 other temp sensors but so far no matter what I do I get the following error. The other temp sensors are a Nano and 2 UNO's.
MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.0.1-beta
TSM:INIT
TSM:INIT:TSP OK
!TSF:ASID:FAIL,ID=0
TSM:FAILURE
TSM:FAILURE:PDTA NANO with the same Sketch starts up with this.
MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.0.1-beta
MCO:BGN:BFR
TSM:INIT
TSM:INIT:TSP OK
TSF:ASID:OK,ID=1
TSM:FPAR
TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0
TSF:MSG:FPAR RES,ID=0,D=0
TSF:MSG:FPAR OK,ID=0,D=1
TSM:FPAR:OKRight now I have everything the Vera and all the other sensors on my workbench so everything is really
close. Any ideas? -
RE: Where does it all go?
Thank you very much. I did all that and the GW seems happy except for the fact Vera doesn't see the gateway. I get this from my vera.
Vera (MySensors plugin : Choose the Serial Port
MySensors Plugin[12] : Running Lua StartupI remember having to go in a change the baud rate on the USB port in Vera but I haven't been able to find that again.
I've read where nothing has changed in how the gateway talks to Vera. I was running a Nano as my serial gateway. but I saved it just in case and I'm now using a Uno. Vera firmware rev is 1.7.2043. I've also read you can't use a serial gateway with UI7 but my Nano has run fine for 8 months or so.
Also is there a writeup of what the Inclusion button does besides return a 1 then 60 sec later a 0. Should this put the Vera in Inclusion Mode?
I cleared the eeprom of the Uno. -
RE: serial gateway V2 not visible to Vera
I have the same problem. I remember having to set the baud rate somewhere but I can't seem to find it. Please give us some help here. Thanks.
-
Where does it all go?
Where does it all go. Great site with a huge amount of work, thanks. I decided to go to 2.0 and do a fresh start. My problem is very little in the getting started making a Serial Gateway matches up with the files that gets downloaded for 2.0. There is no libraries folder and so where do those files come from/to. If I was sleeping when all this was explained I'm sorry. Just assume I have nothing and want to start with 2.0.
-
Solar (H2O) Shop Heater
I'll start with a little background. Years ago I acquired two 70's vintage 3 ft x 8 ft solar panels that were used to make hot water. I recently moved and the one year old shop came with a 100 year old house. Anyway the guy that built the shop stopped just short of finishing it like no heater. I live in the Boise area and it get very cold here so I'm working on putting the panels to good use.
I'll post some pictures later but yesterday I tested a pressure sensor I bought on Amazon. "G1/4 inch 5V 0-0.8 MPa Pressure Level Controller Sensor for Oil Fuel Diesel Gas Water Air". It wasn't cheap at $16 but you can order it in 4 different pressure ranges. I hooked it to one of the analog inputs on an Arduino Uno. In open air the reading was 111. I then did a linear regression on the readings I took from 5 psi to 80 psi and came up with a slop of 7 and the following formula to compute PSI. PSI=(current_input_voltage - 111)/7. As I only have one sensor and only tested it on one micro-controller you will have to see if you get something close to 111 open air reading but it was very linear so the slope of 7 I think would hold on whatever you use it on. The open air reading might change some with elevation and maybe even weather but that's what I got.
I will also be using flow and temperature sensors on this project. I've mostly been working on the physical part of the project and just recently started on the control part so I don't have any of the software ready even for testing, maybe next week.
I'm not an expert on any of this so I'll take suggestions and will be happy to answer questions.