Skip to content

My Project

967 Topics 13.5k Posts

Show off and share your great projects here! We love pictures!

  • Arduino-controlled-battery-charger AND Amazon DOT control VA Domoticz

    1
    1 Votes
    1 Posts
    1k Views
    No one has replied
  • Gas meter monitoring with optical sensor

    5
    4 Votes
    5 Posts
    5k Views
    I
    @rubyan Thanks, i have some trouble with adjusting it. I set the trct5000 when the 6 comes by the led goes on. When i use this sketch from the forum /** * 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 - Mark Verstappen * * DESCRIPTION * Use this sensor to measure volume and flow of your house gasmeter. * You need to set the correct pulsefactor of your meter (pulses per m3). * The sensor starts by fetching current volume reading from gateway (VAR 1). * Reports both volume and flow back to gateway. * * Unfortunately millis() won't increment when the Arduino is in * sleepmode. So we cannot make this sensor sleep if we also want * to calculate/report flow. * http://www.mysensors.org/build/pulse_water */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <Time.h> #include <TimeLib.h> #include <SPI.h> #include <MySensor.h> #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your sensor. (Only 2 and 3 generates interrupt!) #define SENSOR_INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway) #define PULSE_FACTOR 100 // Nummber of blinks per m3 of your meter (One rotation/liter) #define SLEEP_MODE false // flowvalue can only be reported when sleep mode is false. #define MAX_FLOW 0,1 // Max flow (l/min) value to report. This filters outliers. #define CHILD_ID 1 // Id of the sensor child unsigned long SEND_FREQUENCY = 30000; // Minimum time between send (in milliseconds). We don't want to spam the gateway. MyMessage flowMsg(CHILD_ID,V_FLOW); MyMessage volumeMsg(CHILD_ID,V_VOLUME); MyMessage lastCounterMsg(CHILD_ID,V_VAR1); double ppl = ((double)PULSE_FACTOR)/1000; // Pulses per liter volatile unsigned long pulseCount = 0; volatile unsigned long lastBlink = 0; volatile double flow = 0; boolean pcReceived = false; unsigned long oldPulseCount = 0; unsigned long newBlink = 0; double oldflow = 0; double volume =0; double oldvolume =550.67; // Oude meterstand unsigned long lastSend =0; unsigned long lastPulse =0; void setup() { // initialize our digital pins internal pullup resistor so one pulse switches from high to low (less distortion) pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); pulseCount = oldPulseCount = 0; // Fetch last known pulse count value from gw request(CHILD_ID, V_VAR1); lastSend = lastPulse = millis(); attachInterrupt(SENSOR_INTERRUPT, onPulse, FALLING); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Gas Meter", "1.0"); // Register this device as Gasflow sensor present(CHILD_ID, S_GAS); } void loop() { unsigned long currentTime = millis(); // Only send values at a maximum frequency or woken up from sleep if (SLEEP_MODE || (currentTime - lastSend > SEND_FREQUENCY)) { lastSend=currentTime; Serial.println("--------- Debug void loop ------------"); if (!pcReceived) { //Last Pulsecount not yet received from controller, request it again request(CHILD_ID, V_VAR1); return; } if (!SLEEP_MODE && flow != oldflow) { oldflow = flow; Serial.print("m3/min:"); Serial.println(flow); // Check that we dont get unresonable large flow value. // could hapen when long wraps or false interrupt triggered if (flow<((unsigned long)MAX_FLOW)) { send(flowMsg.set(flow, 2)); // Send flow value to gw } } // No Pulse count received in 2min if(currentTime - lastPulse > 120000){ flow = 0; } // Pulse count has changed if ((pulseCount != oldPulseCount)||(!SLEEP_MODE)) { oldPulseCount = pulseCount; Serial.println("flow: "); Serial.print(flow); // Serial.println(Time.now()); Serial.print("pulsecount: "); Serial.println(pulseCount); send(lastCounterMsg.set(pulseCount)); // Send pulsecount value to gw in VAR1 double volume = ((double)pulseCount/((double)PULSE_FACTOR)); if ((volume != oldvolume)||(!SLEEP_MODE)) { oldvolume = volume; Serial.print("volume: "); Serial.println(volume, 3); Serial.println("---------------------------------------------------"); send(volumeMsg.set(volume, 3)); // Send volume value to gw } } } if (SLEEP_MODE) { sleep(SEND_FREQUENCY); } } void receive(const MyMessage &message) { if (message.type==V_VAR1) { unsigned long gwPulseCount=message.getULong(); pulseCount += gwPulseCount; flow=oldflow=0; Serial.println("--------------- Debug void receive ---------------"); Serial.print("Received last pulse count from gw: "); Serial.println(pulseCount); Serial.println("---------------------------------------------------"); pcReceived = true; } } void onPulse() { if (!SLEEP_MODE) { unsigned long newBlink = micros(); unsigned long interval = newBlink-lastBlink; Serial.println("--------------- Debug void onPulse ---------------"); // Serial.println("newblink: "); // Serial.print(newBlink); // Serial.println("interval: "); // Serial.print(interval); // Serial.println(); if (interval!=0) { lastPulse = millis(); if (interval<500000L) { // Sometimes we get interrupt on RISING, 500000 = 0.5sek debounce ( max 120 l/min) return; } flow = (60000000.0 /interval) / ppl; Serial.println("flow = (60000000.0 /interval) / ppl"); Serial.println(flow); Serial.println("---------------------------------------------------"); } lastBlink = newBlink; } pulseCount++; } The counter goes up but it is still off with the gasmeter. Then i upload you're sketch and the counter doesn't go up and the serial monitor says Stable pin value different! Can you help?
  • Automate Curtain with Mysensor

    4
    0 Votes
    4 Posts
    2k Views
    Dominic BonneauD
    Yeah ! could do the trick ... i don't have time to check right now but is he explained every detail and hardware of his process ? Thanks
  • Identify a Sensor

    5
    0 Votes
    5 Posts
    2k Views
    t1m0T
    @mfalkvidd ah okay. I Think that script would be okay and i can usw it for Pimatic... Thank you :)
  • How do i sent "virtual switches" from node to Controller?

    25
    0 Votes
    25 Posts
    8k Views
    T
    @SuperKris you already solved the problem with Pin0 and 1 (did you?). Here is possibly another solution (from 2.0 API): MY_DISABLED_SERIAL Disabled Enable this in sketch if you want to use TX(1), RX(0) as normal I/O pin so #define MY_DISABLED_SERIAL should free Pin 0 and Pin 1.
  • Get Temperature from other nodes(through VERA).

    7
    0 Votes
    7 Posts
    3k Views
    C
    Hi @korttoma, Just an other question, II'm also using PLEG. Is there a way to compeer the last value against the new value and only IF these values are different we sending a this new value. some thing like : local temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 35) local oldTemp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","VAR_1", 14) if temp != oldTemp then luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="14;2", variableId="VAR_1", value=temp}, 3) end Thanx
  • Multi sensing node for plant monitoring

    7
    1 Votes
    7 Posts
    2k Views
    D
    @Nca78 This would be nice as a complete battery operated MySensors node all in one board. I would be interested if you get this working.
  • Count car-starts

    47
    0 Votes
    47 Posts
    16k Views
    F
    Version 1.13 changed to fixed NODE_ID // Made by Daniel Nilsson // Tested with Domoticz 3.5721 // 2016-12-10 #include <SPI.h> #include <MySensor.h> #define CHILD_ID 0 // Id of the sensor child #define NODE_ID 7 // a number or AUTO to let controller assign #define SKETCH_NAME "Car start counter" // Change to a fancy name you like #define SKETCH_VERSION "1.13" // Your version int Controller; // Current start counts from Controller, like Domoticz boolean pcReceived = false; // If we have recieved the start counts from Controller or not int starts; // summary of all starts to be sent to Controller int eeprom; // start counts read from/to be stored in EEPROM MySensor gw; MyMessage volumeMsg(CHILD_ID,V_RAIN); MyMessage lastCounterMsg(CHILD_ID,V_VAR1); void setup() { pinMode(3,OUTPUT); delay(2*45000); // Allow time if USB/cigarette plug is powered before you turned the key digitalWrite(3,HIGH); delay(300); digitalWrite(3,LOW); delay(300); digitalWrite(3,HIGH); delay(300); digitalWrite(3,LOW); //Begin gw.begin(incomingMessage, NODE_ID, false); // Send the Sketch Version Information to the Gateway gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); // Register this device as Rain sensor (will not show in Domoticz until first value arrives) gw.present(CHILD_ID, S_RAIN); Serial.println(""); eeprom = gw.loadState(0); // read EEPROM Serial.print(eeprom); // print EEPROM Serial.println(" starts have not been sent"); Serial.println("add 1 start"); Serial.print(eeprom); Serial.print("+1="); eeprom = eeprom + 1; Serial.println(eeprom); gw.saveState(0,eeprom); // store to EEPROM at position 0 Serial.println(""); Serial.println("Startup completed"); } void loop() { //See if we have the start counts from Controller - and ask for it if we dont. if (!pcReceived) { Serial.println("Request start counts"); gw.request(CHILD_ID, V_VAR1); gw.wait(1000); return; } Serial.println(""); eeprom = gw.loadState(0); // read EEPROM Serial.print(eeprom); Serial.println(" starts have not been sent"); Serial.print(Controller); Serial.println(" starts from Controller"); starts = Controller + eeprom; // total starts Serial.print(eeprom); Serial.print("+"); Serial.print(Controller); Serial.print("="); Serial.println(starts); Serial.print("Send "); Serial.print(starts); Serial.println(" to Controller"); Serial.println(""); if (!resend((volumeMsg.set(starts)), 6))return; if (!resend((lastCounterMsg.set(starts)), 6)) return; Serial.println(""); Serial.println("store 0 to EEPROM"); gw.saveState(0,0); // set 0 start to EEPROM, all have been sent Serial.println("sleep"); // mission accomplished digitalWrite(3,HIGH); delay(900); digitalWrite(3,LOW); while(1){} } // check if "st:fail" during gw.send, thanks n3ro bool resend(MyMessage &msg, int repeats) { int repeat = 1; boolean sendOK = false; int repeatdelay = 2000; while ((sendOK == false) and (repeat < repeats)) { if (gw.send(msg)) { sendOK = true; } else { sendOK = false; Serial.print("Error "); Serial.println(repeat); } repeat++; delay(repeatdelay); } if (sendOK == false && repeat == repeats){ return false; } return true; } //Read if we have a incoming message. void incomingMessage(const MyMessage &message) { if (message.type==V_VAR1) { Controller = message.getULong(); pcReceived = true; Serial.print("Received start counts from Controller: "); Serial.println(Controller); } }
  • Home ventilation filter status - Pressure sensor MPX2010DP

    2
    0 Votes
    2 Posts
    2k Views
    M
    @mikee You would want the MPX5010DP instead to get a 5V analog output for Arduino ADC, but still - to detect increased filter pressure drop I'd say you'll need 10Pa resolution. With MPX5010DP you'll get 10kPa/1024=9.75, i.e. OK. I guess you'd be able to detect something despite the noise, but not an early warning or trending. (You would want a 0..1kPa range sensor or something instead to do that. I don't now which one.) Give it a try and please report back! If you search the internet for "arduino MPX2010DP" you'll find a few projects measuring water level.
  • Understanding combined sketch

    3
    0 Votes
    3 Posts
    1k Views
    fernando alvarez buyllaF
    @mfalkvidd thanks mate that's exactly what I need
  • My best nRF24L01+PA+LNa node (gateway/ repeater) so far

    14
    3 Votes
    14 Posts
    10k Views
    F
    Now it is working extremely much better, I have 8 days in a row without any errors. I think this is how it should be.
  • humidity sensor value

    hardware
    1
    0 Votes
    1 Posts
    912 Views
    No one has replied
  • gw.sleep on battery powered magnet door switch

    42
    0 Votes
    42 Posts
    16k Views
    slingS
    @siod new observation: I have two temp nodes with red Htu21d in them. One keeps locking up randomly. Have to go outside and reset the arduino. I'll try another sensor today and see if it fixes things. Have completely rebuild the node twice now with new parts except the sensor.
  • Selecting a motor

    8
    1 Votes
    8 Posts
    3k Views
    breimannB
    @stefaanv Hi there, how is your coup going now? I've just pulled down an old kids cubby house at a friend who is moving, and put it back up on our farm. So I'm getting ready to build my auto doors etc.
  • [contest] My 4-in1 LED-dimmer/motion/temp-hum sensor

    contest
    9
    5 Votes
    9 Posts
    19k Views
    Fat FlyF
    Small question. I want to try this but some errors. Library is installed with library manager. Ubuntu 16.04 and last Arduino ide. First try IDE not find library and i change in line 29 #include <MySensor.h> to #include <MySensors.h> add only s and then this error. motion_dht22_led_dimmer:44: error: 'MySensor' does not name a type MySensor gw(9,10);
  • How to use a scrolling display board

    11
    0 Votes
    11 Posts
    5k Views
    D
    @Sparkman said: I think they likely accomplish by mixing 3 colors That is how most if not all RGB LEDs work. Using PWM on the red, green and blue LEDs is how you achieve the different colors. I could probably have more than just the 2 colors if I can find a way to mix the 2 colors using PWM, but that might be a bit much for a nano to handle with all of the display multiplexing going on.
  • Weather station (the easy way)

    1
    4 Votes
    1 Posts
    2k Views
    No one has replied
  • LG TV controller

    25
    15 Votes
    25 Posts
    23k Views
    T
    @dbemowsk Just an idea, use a dimmer in domoticz for the volume, when you receive a value from the controller, then send VOLM and the value.. There is no need for the controller to know how to set the volume (the VOLM command) For IR commands, that's probably another story, Haven't looked that much into it (yet).. Right now I have a logitech harmony elite, integrated with domoticz, so that I (from domoticz) can turn on different scenes.. But I can not send an individual command to the tv, or the radio..
  • Mysensor-ing a Roomba vacuum cleaner.

    15
    0 Votes
    15 Posts
    7k Views
    M
    Take a look to this.
  • No ID assigned by gateway.

    dimmer domoticz ac 220v
    7
    0 Votes
    7 Posts
    3k Views
    Suresh MaliS
    After filding around a lot with the MySensor2.0 lib and spending my whole weekend, when I could not get things going I finally switched back to MySensors1.5.4. After that I made quick progress and my node was on network. Here is the link below of a working Dimmer node. https://www.youtube.com/embed/N_Zx1xARwtM

44

Online

12.0k

Users

11.2k

Topics

113.4k

Posts