Skip to content

Troubleshooting

Help! Everything just falls apart
2.7k Topics 21.5k Posts
  • ESP8266 Gateway motion sensor only working when "serial monitor" open

    3
    0 Votes
    3 Posts
    2k Views
    O
    I started out with just the basics, but i get spammed out put of motion triggered and disregards if there is motion or not with the following code * 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 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/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. */ #include <EEPROM.h> #include <SPI.h> // 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 9600 // Enables and select radio type (if attached) //#define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "home" #define MY_ESP8266_PASSWORD "********" // 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,178,87 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,1,254 #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, 178, 68 // 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 // Flash leds on rx/tx/err // #define MY_LEDS_BLINKING_FEATURE // Set blinking period // #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Led pins used if blinking feature is enabled above #define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin #define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin #define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED #if defined(MY_USE_UDP) #include <WiFiUDP.h> #else #include <ESP8266WiFi.h> #endif #include <SPI.h> #include <MySensors.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input } void presentation() { // Present locally attached sensors here // Send the sketch version information to the gateway and Controller sendSketchInfo("Motion Sensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOTION); } void loop() { // Send locally attached sensors data here // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw } Thank you for the reply if i comment out all the debounce and re upload it then doesn't read the motion sensor and just out puts motion dectected at power up.
  • Livolo Wall Switch, 433.92mhz?

    1
    0 Votes
    1 Posts
    846 Views
    No one has replied
  • [SOLVED] Combine sketches for Relay + status (RGB)LED

    4
    0 Votes
    4 Posts
    1k Views
    Boots33B
    Great! Glad it worked for you
  • 0 Votes
    12 Posts
    5k Views
    Nca78N
    @TheoL it is. When you define a radio, it defines MY_RADIO_FEATURE // Enable radio "feature" if one of the radio types was enabled #if defined(MY_RADIO_NRF24) || defined(MY_RADIO_RFM69) || defined(MY_RS485) #define MY_RADIO_FEATURE #endif Same thing when you define a gateway : #if defined(MY_GATEWAY_SERIAL) || defined(MY_GATEWAY_W5100) || defined(MY_GATEWAY_ENC28J60) || defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_MQTT_CLIENT) #define MY_GATEWAY_FEATURE Then at the end if MY_RADIO_FEATURE and MY_GATEWAY_FEATURE are not defined it generates this compilation error #if !defined(MY_GATEWAY_FEATURE) && !defined(MY_RADIO_FEATURE) #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless. #endif
  • Burn bootloader while NRF24L01 is connected

    11
    0 Votes
    11 Posts
    2k Views
    F
    I am using IDE 1.6.8
  • Sleep walk?

    3
    0 Votes
    3 Posts
    737 Views
    bjacobseB
    @Danhiel said: BinarySwitchSleepSensor.ino If the sleep you mention, is the one to let your buttons settle as the code in this example, line100. then it's "just" to let your buttons settle, to handle the contact/switch bounce // Short delay to allow buttons to properly settle sleep(5); https://github.com/mysensors/MySensors/blob/development/examples/BinarySwitchSleepSensor/BinarySwitchSleepSensor.ino
  • Mqtt and openhab

    4
    0 Votes
    4 Posts
    957 Views
    TheoLT
    @Dominic-Bonneau Have a look at this thread https://forum.mysensors.org/topic/4415/my-final-setup-to-get-mysensors-and-openhab-communicating-via-mqtt it might provide you with the answers you seek.
  • How to determine from which Node a message is comming from

    3
    0 Votes
    3 Posts
    1k Views
    TheoLT
    @mfalkvidd Thanx for the quick reply and the example. It's exactly what I was I was looking for. I just overlooked the union definition in Message.h. I'm currently sending the message to the Node itself as a test. But event that that works.
  • Trying my first temperature sketch

    2
    0 Votes
    2 Posts
    885 Views
    raptorjrR
    I found the link to the updated 2.0 sketch and even though I still have problems, this is not one of them anymore =) https://github.com/mysensors/MySensorsArduinoExamples
  • Looking for a Gas Usage Monitor Sketch

    1
    0 Votes
    1 Posts
    514 Views
    No one has replied
  • Trying to convert a rain sensor sketch. get a fail error

    1
    0 Votes
    1 Posts
    607 Views
    No one has replied
  • How to change sender, command, msg type, payload type, ... ?

    8
    0 Votes
    8 Posts
    3k Views
    mfalkviddM
    @npkhoi thanks for e plaining. Then it should be sufficient to replace send(msg.set((int16_t)ceil(valMQ))); with send(msg.set(random()));
  • 2 Pushbuttons with sleep, lots of st=fail

    18
    0 Votes
    18 Posts
    4k Views
    CrankyCoderC
    Just finished switching them out with 100's. MUCH better. Still having a fail on startup. looks like it's when it's sending the framework version TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 !TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=fail:2.0.0 TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=ok:0 TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=10,sg=0,ft=0,st=ok:WallSwitch TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.1 TSP:MSG:SEND 1-1-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok: Request registration... TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2 TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1 Node registration=1 Init complete, id=1, parent=0, distance=1, registration=1 TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-1 s=1,c=1,t=2,pt=2,l=2,sg=0:0 TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-1 s=1,c=1,t=2,pt=2,l=2,sg=0:0 TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-1 s=1,c=1,t=2,pt=2,l=2,sg=0:0 TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-1 s=1,c=1,t=2,pt=2,l=2,sg=0:1 TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-1 s=1,c=1,t=2,pt=2,l=2,sg=0:1 TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-1 s=1,c=1,t=2,pt=2,l=2,sg=0:1 Connected much faster and 3 presses of both buttons all succeeded.
  • Arduino Nano and NRF24L01+PA+LNA

    12
    0 Votes
    12 Posts
    5k Views
    Boots33B
    Yes it is hard to find a data sheet on, most suppliers seem to quote around 115mA but I would allow a bit more just in case.
  • VeraEdge & serial gateway

    1
    1 Votes
    1 Posts
    609 Views
    No one has replied
  • two arduino, two avrdude error ..

    10
    0 Votes
    10 Posts
    3k Views
    Dominic BonneauD
    OMG I think I found my problem .... Is it possible to put code into Arduino mini pro with this : https://cdn-shop.adafruit.com/1200x900/954-02.jpg Because I check tuto on the web and they all use this : https://abra-electronics.com/images/thumbnails/280/217/detailed/134/ARD-FTDI-F(1).jpg Thanks
  • Help with Switch/Case/Break statement

    11
    0 Votes
    11 Posts
    3k Views
    D
    @tbowmo Thanks for the help. I see now where I was going wrong. I have everything working as expected. The only thing I needed to do was add some special commands to the message statement. For some reason, the relay would not turn off when the water low level was reached; used this below as a counter for now. Thanks again. /** * 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 * * DESCRIPTION * Automated Sump-Pump for De-Humidifier * * PURPOSE: * To automatically when water is at a pre-set level, have small * sump pump engage and empty water until it hits the desired * level. Uses the NewPING Library with Ultrasonic Sensor HC-SR04 * */ // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 22 //or comment out for automatic // #define MY_REPEATER_FEATURE // Enabled repeater feature for this node #include <SPI.h> #include <MySensors.h> #include <NewPing.h> #define RELAY_PIN 3 // To control the sump pump, define relay pin here. #define TRIGGER_PIN 4 //HC-SR04 Trgger Pin (Transmit) #define ECHO_PIN 5 //HC-SR04 Echo Pin (Receive) #define MAX_DISTANCE 100 //Maximum Distance for Sensor scan (tank depth) no more than 297f int LOW_WATER = 2; // int HIGH_WATER = 20; // int RADIUS = 15; //Radius of cylindrical bucket. Used for Flow calculations int bucketDepth = 30; int waterDepth = 5; unsigned long SEND_VOLUME = 0; // Trigger to send flow values to HA controller unsigned long WATER_VOLUME = 0; // Just a place holder.... unsigned long previousMillis = 0; //Tracks time list last depth report. unsigned long reportMillis = 10000; //How often to do depth report unsigned long manualWait = 20000; //Time for manual pump on action. 20 seconds default (to avoid pump dryout) long unsigned int Distance = 5; long unsigned int oldDepth = 0; //used to track transmission of water level on change only. #define CHILD_ID_RELAY 0 //To allow manual control of the sump pump from HA controller #define CHILD_ID_DEPTH 1 // Used to show water depth. #define CHILD_ID_VOLUME 2 // Sensor to send Water Volume info NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum depth // MySensors Message Initialization MyMessage msgRelay(CHILD_ID_RELAY, V_LIGHT); MyMessage msgDepth(CHILD_ID_DEPTH, V_DISTANCE); MyMessage msgPrefix(CHILD_ID_DEPTH, V_UNIT_PREFIX); //Adds SI unit (CM) for depth measurement. MyMessage msgVolume(CHILD_ID_VOLUME, V_VOLUME); // Water volume info. In Metres cubed unsigned long previousReport = 0; // For tracking report time void setup() { pinMode(RELAY_PIN, OUTPUT); digitalWrite(RELAY_PIN, LOW); send(msgPrefix.set("CM")); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("DeHumidifierSumpPump", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_RELAY, S_LIGHT); present(CHILD_ID_DEPTH, S_DISTANCE); present(CHILD_ID_VOLUME, S_WATER); send(msgPrefix.set("CM")); } void loop() { unsigned long currentMillis = millis(); Distance = sonar.ping_cm(); waterDepth = (bucketDepth - Distance); if (waterDepth >= HIGH_WATER && SEND_VOLUME == 0){ digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); SEND_VOLUME = 1; } else if ( (waterDepth <= LOW_WATER) && SEND_VOLUME == 1 ) { digitalWrite(RELAY_PIN, LOW); send(msgRelay.set (0)); SEND_VOLUME = 0; } if ( (currentMillis - previousMillis) >= reportMillis) { send(msgDepth.set(Distance)); send(msgPrefix.set("CM")); WATER_VOLUME = ((((sq(RADIUS)) * 3.14) * (waterDepth)) / 1000); send(msgVolume.set(WATER_VOLUME)); previousMillis = currentMillis; } wait(reportMillis); } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if ((message.type==V_LIGHT) && (waterDepth >= LOW_WATER)) { // Change pump state for 20 seconds. digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); wait(manualWait); digitalWrite(RELAY_PIN, LOW); send(msgRelay.set(0)); } }
  • Arduino Mega + RelayWithButtonActuator sketch

    11
    0 Votes
    11 Posts
    4k Views
    jnatherJ
    Please, could you post your code? I can´t make my arduino mega work.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Trouble with GatewayW5100

    3
    0 Votes
    3 Posts
    853 Views
    D
    @Boots33 - You'd the Man Boots!!! That was it. Commented that line out, and it's working! After inspecting the code again, I noticed the "!" (NOT) defined for "MY_W5100_SPI_EN" which indeed must have stopped Soft SPI. Thanks again!

29

Online

11.7k

Users

11.2k

Topics

113.2k

Posts