Skip to content

My Project

967 Topics 13.5k Posts

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

  • Mysensorized Roomba

    18
    4 Votes
    18 Posts
    9k Views
    B
    there is plenty of space for a nano or pro mini. wemos mini or nodemcu should also fit (spam links removed by moderator)
  • MySensors-powered arcade game screen with wireless gamepad controller

    esp8266
    10
    12 Votes
    10 Posts
    8k Views
    alowhumA
    WOW!!! What a cool project!
  • Interupt not waking sensor

    10
    0 Votes
    10 Posts
    2k Views
    S
    @terence-faul said in Interupt not waking sensor: when the Interupt is called does that invoke the loop from the beginning?``` No, it resumes. But in your case, as sleep is your last function in Loop(), loop is relaunched. I just quick looked at your code (no time). Have you tried to remove others sensors code, and run a reedswitch only code. It should be the first step in your debugging. Better do step by step to check what's the culprit. If your reedswitch code is working ok, if there is any interference with other sensors/libraries, the logic order/algo etc. Are you using sleep() for saving energy (so a batt powered device)?? then imho I would have choosen a better sensor. I don't get why people still uses these dht.. Eg. cheap si7021, Bosch BMEs : better power consumption, voltage range. DHT libs has lot of delays, yuk! eg. minimum 10ms just for a read start signal (more for the complete reading), imho it needs refactoring to be used in non blocking way. So, you can: disable your DHT code and try reedswitch code only. if it works. then you have a problem with 1) your code logics 2) external lib (but imho it's a bad sensor choice) Check 1) by maybe changing a bit your code logics(order of functions calls like testing your reedswith right after your sleep call). if it doesn't fix, rewrite sensor lib in non blocking way to be used with your sketch if you don't feel enough good for rewriting lib, then change sensor brand/model, and you may fix this problem ;) As a rule of thumb, libs are not all well optimized even if their examples works, but sometimes it needs tinkering so it can work in larger projects like a mysensors multisensors sketch. So before using a lib, I often check&fix if there are any delays/loops/blocking stuff and others details which could bring some problems and slow down my dev. Edit: ahah I didn't notice, you beat me @mfalkvidd :)
  • My SHT21 and ds18b20 sensor

    sht21 ds18b20
    7
    4 Votes
    7 Posts
    6k Views
    S
    Looks great! Would love to see the schematic and 3D print file for the enclosure. @Blom Would you be able to share them?
  • Ethernet gateway

    2
    0 Votes
    2 Posts
    1k Views
    HomerH
    @terence-faul I'm only new to this myself, so I can't help with anything specific, but I did a search and found another thread where someone was having issues with a similar setup to you. Maybe you might find some info there that helps you. The thread is here : https://forum.mysensors.org/topic/5059/ethernet-gateway-with-w5100
  • This topic is deleted!

    1
    2
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Wirsbo/Uponor thermostat replacement

    hardware thermostat development
    11
    5 Votes
    11 Posts
    14k Views
    D
    @bjornhallberg The sensors are working fine and have been installed in my home for the last couple of years. Some optimisation needs to be done to the code, that i have not done. This is more connected to understanding when the mysensors network is in "range" as i want to fallback on the manual knob if the mysensor network is inactive for some reason or if i sell the house and the controller goes with me.
  • Help on Micro:bit sensors IDEA

    2
    0 Votes
    2 Posts
    711 Views
    alowhumA
    Is it possible? Probably. but if you're new to electronics, this sounds like a very daunting task! MySensors is very good at getting sensor data into a database wirelessly. A database/system like Domoticz, for example, will let you create graphs from your data. Challenges to think about: the 3D map will be very distorted. you'll need to make software to do all this. Why not explore photogrammetry instead? There are great apps for that. My recommendation would be to just start with making a basic sensor (perhaps something already on the Micro:bit, like the motion sensor or the magnetic sensor), and get that data into Domoticz. That will spark new ideas, ideas that you will be able to more easily make. For example, you can get some data from place A and use it to actuate a motor/turn something on in place B. One of the first things I ever did was to create a disco lamp that turns on when the temperature reaches 26 degrees celcius. When it gets summer, it's time to party!
  • RFID-RC522 and sending text via serialgateway

    3
    0 Votes
    3 Posts
    806 Views
    O
    I get no output from the card I try to read. When I comment out all lines connected with mysensors library it works There are no errors The sketch checks cards id and returns name of the card owner, if it is known, if not "unknown person" is printed on serial. I wanted to send names detected to domoticz, so based on them it would be possible to create an event 0;255;3;0;9;0 MCO:BGN:INIT GW,CP=R-NGA---,REL=255,VER=2.3.1 0;255;3;0;14;Gateway startup complete. 0;255;0;0;17;2.3.1 0;255;3;0;11;USER 0;255;3;0;12;1.1 0;20;0;0;36; 0;255;3;0;9;9 MCO:BGN:STP 0;255;3;0;9;68 MCO:REG:NOT NEEDED 0;255;3;0;9;71 MCO:BGN:INIT OK,TSP=NA```
  • Strange Situation

    16
    0 Votes
    16 Posts
    2k Views
    zboblamontZ
    @crankycoder Ok on the heater, but what I was getting at was if it is mains borne interference, appliances elsewhere might also trigger the phenomenon but you hadn't noticed as you were not in THAT room.... Sounds like you have some rogue amateur wiring there, for kitchens and bathrooms a ground wire is mandatory for safety I always understood, on a metal ballast case it provides RF shielding. Perhaps you could shield the board for your Light Module if the caps don't sort it out?
  • Where do i start?

    8
    0 Votes
    8 Posts
    2k Views
    rejoe2R
    @reindier Please add some more info on your setup. In general, an ESP8266-based node is only intented to be a gateway (also other hardware con be chosen). Possibilities about using more than one gateway depend on the controller software you intend to use. Some support it, but could have additional restrictions. In general, I'd never use a multiple NodeMCU-setup with sensors directly attached to this MCU type the "MySensors"-way but instead use standard (especially MQTT) options for them (outside MySensors). So what means "arduino" on your setup? Just the Arduino IDE for programming the ESP8266's? If it's really ATMega328 MCU's, I'd go for other transport layers than regular WiFi (eg. use RFM69 transceivers).
  • New Sense Bender GW no USB response

    gw usb
    1
    0 Votes
    1 Posts
    679 Views
    No one has replied
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    17 Views
    No one has replied
  • Portable RFM69 Signal Scanner

    10
    1
    6 Votes
    10 Posts
    10k Views
    gohanG
    Yes, that was Rev 9, but the sketch would work with anything you have
  • DHT11 and Ethernet Gateway with enc28j60

    9
    0 Votes
    9 Posts
    2k Views
    mfalkviddM
    @giangired yes, a counter or using millis() (which technically is a counter) is the right solution. Relay nodes can’t sleep, because nodes can not receive incoming commands when sleeping.
  • BBQ Probes for the Perfect Steak

    6
    0 Votes
    6 Posts
    2k Views
    alowhumA
    What you should look at is the Adafruit_MAX31855 library Then buy a K-type sensor device online. https://github.com/adafruit/Adafruit-MAX31855-library You can also use the cheaper Max6675. Watch the voltage it uses. You'll have so search a bit, but you can also buy meat-probe style K-type sensors at Aliexpress. This code may be of use: /** * * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * DESCRIPTION * * PID smoker, in progress * */ #include <AutoPID.h> //#include <PID_v1.h> //#define PIN_INPUT 0 //#define RELAY_PIN 6 //auto-pid settings and gains #define OUTPUT_MIN 0 #define OUTPUT_MAX 3500 // this should not exceed the ASECOND value below. #define KP 6 #define KI .1 #define KD 10 //Define Variables we'll be connecting to double setPoint, Output; // autopid double smokerSetpoint = 90; double meatSetpoint = 70; double temperatureA = 0; // Holds the temperature of the first MAX sensor. double temperatureB = 0; // Holds the temperature of the second MAX sensor. double temperatureC = 0; // Holds the temperature of the second MAX sensor. //Define the aggressive and conservative PID Tuning Parameters //double Kp=2, Ki=5, Kd=1; // the original middle of the road settings. //double aggKp=4, aggKi=0.2, aggKd=1; // the original aggressive settings. //double aggKp=2, aggKi=2, aggKd=1; //double consKp=1, consKi=0.05, consKd=0.25; /* * P: the bigger the number the harder the controller pushes. * I: the SMALLER the number (except for 0, which turns it off,) the more quickly the controller reacts to load changes, but the greater the risk of oscillations. * D: the bigger the number the more the controller dampens oscillations (to the point where performance can be hindered) * * learn more: http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/ * * 1. Get the Proportional working first. A fast and easy trick is to increase the proportional gain until oscillations start (the critical or ultimate gain) then cut the gain in half. * */ //PID myPID(&temperatureA, &Output, &smokerSetpoint, aggKp, aggKi, aggKd, DIRECT); AutoPID myPID(&temperatureB, &smokerSetpoint, &Output, OUTPUT_MIN, OUTPUT_MAX, KP, KI, KD); #define ACTIVATIONTEMPERATURERANGE 10 // at what temperature delta below or above the target temperature should the PID take over the heating proces? So if the target is 100, then this would be between 70 and 130 degrees. #define HASOLEDSCREEN // Remove this line if you are not using an OLED screen on the node. #define DONTCHECKCONNECTION // Uncomment this line if you do not care if the node loses connection with the controller. #ifdef HASOLEDSCREEN #define OLED_I2C_ADDRESS 0x3C //#include <SPI.h> #include <SSD1306Ascii.h> // simple drivers for the screen. #include <SSD1306AsciiAvrI2c.h> SSD1306AsciiAvrI2c oled; #endif // if you uncomment this, you can get test and debug updates about everything the sensor is doing by using the serial monitor tool. //#define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 // A 2.4Ghz transmitter and receiver, often used with MySensors. //#define MY_RADIO_RFM69 // 433Mhz transmitter and reveiver. //#define MY_RADIO_NRF5_ESB // NRF5 devices //#define MY_RADIO_RFM95 //#define MY_RF24_PA_LEVEL RF24_PA_MIN #define MY_RF24_PA_LEVEL RF24_PA_LOW // This sets a low-power mode for the radio. Useful if you use the version with the bigger antenna, but don't want to power that from a separate power source. It can also fix problems with fake Chinese versions of the radio. //#define MY_RF24_PA_LEVEL RF24_PA_HIGH //#define MY_RF24_PA_LEVEL RF24_PA_MAX // Advanced settings #define MY_TRANSPORT_WAIT_READY_MS 8000 // try connecting for a few seconds. Otherwise just continue. #define MY_SPLASH_SCREEN_DISABLED // saves a little memory. //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE // saves a little memory. //#define MY_NODE_ID 100 //#define MY_PARENT_NODE_ID 0 //#define MY_PARENT_NODE_IS_STATIC //#define MY_RF24_CHANNEL 100 // this helps to get a better reception in Europe. The default channel that MySensors uses (76) overlaps with European wifi band 13 :-( // Easy to use security, yay! //#define MY_SIGNING_SIMPLE_PASSWD "putyourpasswordhere" //#define MY_SIGNING_SOFT_RANDOMSEED_PIN A7 // setting a pin to pickup noise makes encryption more secure. // Choose if you want this sensor to also be a repeater. //#define MY_REPEATER_FEATURE // Just remove the two slashes at the beginning of this line to also enable this sensor to act as a repeater for other sensors. If this node is on battery power, you probably shouldn't enable this. // LIBRARIES (in the Arduino IDE go to Sketch -> Include Library -> Manage Libraries to add these if you don't have them installed yet.) #include <MySensors.h> #include "Adafruit_MAX31855.h" // VARIABLES YOU CAN CHANGE #define RELAY_ON 0 // GPIO value to write to turn on attached relay. Some relays are reversed. #define RELAY_OFF 1 // GPIO value to write to turn off attached relay Some relays are reversed. #define HEATER_RELAY_PIN 14 // Arduino Digital I/O pin number for heater relay. 14 = A0, 19 = A5 (A6 and A7 are input only) #define MAXDOA 3 // Pins for the two K-type sensors. #define MAXCSA 4 // Pins for the two K-type sensors. #define MAXCLKA 5 // Pins for the two K-type sensors. #define MAXDOB 6 // Pins for the two K-type sensors. #define MAXCSB 7 // Pins for the two K-type sensors. #define MAXCLKB 8 // Pins for the two K-type sensors. #define ASECOND 4000 // How long does a second take? (default is 1000 milliseconds) #define SAFEGUARD_TEMP 160 // Maximum temperature (currently in celcius) that may be detected before the relay is shutdown. #define RETURNTONORMAL_TEMP 100 // After a safeguard shutdown, at what cooled down temperature (currently in celcius) should the system go back to normal state? #define MAXIMUMCONNECTIONLOSSCOUNT 6 // How many safetycheck will we allow the connected to be down? (6 = 60 seconds) #define MAXIMUMTEMPERATURESENSORERRORS 100 // How many faulty measurements to accept per 10 second period. A faulty sensor will give one error per second. #define SECURITYCHECKINTERVAL 15 // How many seconds before a new security check is performed //VARIABLES YOU PROBABLY SHOULDN'T CHANGE #define TEXT_CHILD_ID 1 // for MySensors. Within a node each sensor/actuator should have its own ID number. #define THERMOSTAT_CHILD_ID 2 #define TEMP_A_CHILD_ID 3 #define TEMP_B_CHILD_ID 4 #define TEMP_C_CHILD_ID 5 // Internal temperature sensor #define POWER_CHILD_ID 6 // The PID's current power output level, as a percentage. #define MEATTARGET_CHILD_ID 7 byte powerPercentage = 0; // The PID's current power output level (relative to the output_max), recalculated as a percentage. boolean meatTemperatureReached = false; // Changes to true when the meat has reached the desired temperature. //boolean runEverySecondThings = true; // this moves the things that are done every second to beyond the part of the second where the device is heating. // initialize the Thermocouple Adafruit_MAX31855 thermocouple(MAXCLKA, MAXCSA, MAXDOA); // This is the enclosure thermometer. This temperature is used to safety checks. Adafruit_MAX31855 thermocoupleb(MAXCLKB, MAXCSB, MAXDOB); // This is the mean temperature. // Security variables boolean runSafetyCheck = true; boolean safetyShutdown = true; // Set to true if something is wrong with the system. This then turns off the relay. boolean targetTooHot = false; // A safety feature. If the device somehow gets really hot, disable the heater. byte connectionLossCounter = 0; // How often did a request to the controller not result in any response? byte tempSensorErrorCount = 0; // How often did the temperature sensor give an error? // Mysensors settings MyMessage statusMsg(TEXT_CHILD_ID,V_TEXT); // Sets up the message format that we'll be sending to the MySensors gateway later. The first part is the ID of the specific sensor module on this node. The second part tells the gateway what kind of data to expect. MyMessage thermostatMsg(THERMOSTAT_CHILD_ID, V_HVAC_SETPOINT_HEAT); MyMessage temperatureMsg(TEMP_A_CHILD_ID, V_TEMP); MyMessage powerMsg(POWER_CHILD_ID, V_PERCENTAGE); // the current powerlevel of the heater, as a percentage. void before() { pinMode(HEATER_RELAY_PIN, OUTPUT); digitalWrite(HEATER_RELAY_PIN, RELAY_OFF); } void setup() { Serial.begin(115200); // for serial debugging. delay(500); Serial.println(F("starting smoker")); // autopid extra options myPID.setTimeStep(ASECOND); myPID.setBangBang(ACTIVATIONTEMPERATURERANGE); // if temperature is more than X degrees below or above setpoint, OUTPUT will be set to min or max respectively. // myPID.setTimeStep(WindowSize); // set autoPID update interval. Currently once every loop. // myPID.setOutputRange(0,maxOutputTime); // what range should the output be between? Maximum size can be the entire loop time. (perhaps this could make the cripledelay superfluous? Just set this to 60% of the window size?) // myPID.SetOutputLimits(0, WindowSize); // tell the PID to range between 0 and the full window size #ifdef HASOLEDSCREEN oled.begin(&Adafruit128x64, OLED_I2C_ADDRESS); oled.setFont(Adafruit5x7); //oled.set2X(); // big letters oled.ssd1306WriteCmd(SSD1306_DISPLAYON); //oled.setScroll(true); oled.setCursor(0,0); oled.print(F("Smoker 1.6")); delay(1000); #endif if(isTransportReady()){ Serial.println(F("Connected to gateway!")); #ifdef HASOLEDSCREEN oled.setCursor(90,0); oled.print(F("W")); #endif send(statusMsg.setSensor(TEXT_CHILD_ID).set( F("Smoker starting") )); //send(thermostatMsg.setSensor(THERMOSTAT_CHILD_ID).set(smokerSetpoint,2)); // should that 2 be a one? Only one decimal? Hmm send(powerMsg.set(powerPercentage)); //send(thermostatMsg.setSensor(MEATTARGET_CHILD_ID).set(meatSetpoint,2)); request(THERMOSTAT_CHILD_ID,V_HVAC_SETPOINT_HEAT); request(MEATTARGET_CHILD_ID,V_HVAC_SETPOINT_HEAT); }else{ Serial.println(F("! NO CONNECTION")); } } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("PID Smoker", "1.6"); present(TEXT_CHILD_ID, S_INFO,"status"); present(THERMOSTAT_CHILD_ID, S_HEATER, "SmokerSetpoint"); present(TEMP_A_CHILD_ID, S_TEMP, "Temperature A"); present(TEMP_B_CHILD_ID, S_TEMP, "Temperature B"); present(TEMP_C_CHILD_ID, S_TEMP, "Temperature internal"); present(POWER_CHILD_ID, S_DIMMER, "Powerlevel"); present(MEATTARGET_CHILD_ID, S_HEATER, "Meat target temperature"); } void loop() { // the clock static unsigned long lastClockTick = 0; // When was the last second of the clock. static byte secondCounter = 0; // How many seconds have passed // // A. // CONTINUOUSLY // call the PID function, check if the heating element should be on or off. // if (safetyShutdown == true) { myPID.stop(); digitalWrite(HEATER_RELAY_PIN, RELAY_OFF); } else { myPID.run(); //autopid, call every loop, updates automatically at certain time interval //if (ASECOND - (millis() - lastClockTick) < Output{ if ((millis() - lastClockTick) < Output){ digitalWrite(HEATER_RELAY_PIN, RELAY_ON); Serial.print(F("|")); }else{ digitalWrite(HEATER_RELAY_PIN, RELAY_OFF); Serial.print(F("_")); } delay(100); /* if(temperatureB > smokerSetpoint){ digitalWrite(HEATER_RELAY_PIN, RELAY_ON); }else{ digitalWrite(HEATER_RELAY_PIN, RELAY_OFF); } */ } // // B. // EVERY SECOND // check temperature, calculate new PID value, update display. // if(millis() - lastClockTick >= ASECOND) { lastClockTick = millis(); secondCounter++; //runEverySecondThings = true; Serial.println(); if(secondCounter > SECURITYCHECKINTERVAL){ secondCounter = 0; runSafetyCheck = true; } Serial.print(F("#"));Serial.println(secondCounter); //} //if(runEverySecondThings == true && millis() - lastClockTick >= OUTPUT_MAX + 10){ // this moves all the calculations for getting temperature and pdating the screen to the part of the second loop after the heating is finished. // this moves all the calculations for getting temperature and pdating the screen to the part of the second loop after the heating is finished. // output the value form the PID algorithm. Serial.println(); Serial.print(F("output: ")); Serial.println(Output); powerPercentage = map(Output, 0, OUTPUT_MAX, 0, 100); Serial.print(F("power percentage: ")); Serial.println(powerPercentage); // getting latest temperature data double temperatureAreading = 0;//thermocouple.readCelsius(); double temperatureBreading = thermocoupleb.readCelsius(); temperatureC = thermocouple.readInternal(); Serial.print(F("A: "));Serial.println(temperatureA); Serial.print(F("B: "));Serial.println(temperatureB); Serial.print(F("Int: "));Serial.println(temperatureC); // Check if the temperature values are realistic, or that they indicate a sensor problem. if (isnan(temperatureAreading) || temperatureAreading == 0) { tempSensorErrorCount++; } else { temperatureA = temperatureAreading; // avoiding NaN } if (isnan(temperatureBreading) || temperatureBreading == 0) { tempSensorErrorCount++; } else { temperatureB = temperatureBreading; // This makes sure the PID algorithms is only fed with real temperatures. } if (isnan(temperatureC) || temperatureC == 0) { tempSensorErrorCount++; } // every second update the display #ifdef HASOLEDSCREEN if(safetyShutdown == false){ //oled.set2X(); oled.setCursor(0,0); if(myPID.atSetPoint(ACTIVATIONTEMPERATURERANGE)){ oled.print(F("PID:")); }else{ oled.print(F("PRE:")); } oled.print(powerPercentage); oled.print(F("% ")); //}else{ // if(temperatureB < smokerSetpoint){ // oled.print(F("HEAT: ")); oled.print(powerPercentage); oled.print(F("% ")); // }else{ // oled.print(F("COOLING")); // } //} // show temperature sensor values oled.set2X(); oled.setCursor(0,2); oled.print(F("Pot: ")); oled.print(temperatureB); oled.println(F(" ")); oled.setCursor(0,5); oled.print(F("Meat:")); oled.print(temperatureA); oled.println(F(" ")); // show setpoint target temperatures oled.set1X(); oled.setCursor(60,4); oled.print(F("-> ")); oled.print(smokerSetpoint); oled.setCursor(60,7); oled.print(F("-> ")); oled.print(meatSetpoint); // show wireless connection icon (if there is a connection) oled.setCursor(90,0); if(connectionLossCounter > 1){ // If the connection is bad, hide the wireless icon. oled.print(F(" ")); } //show second counter oled.setCursor(100,0); oled.print(secondCounter); oled.print(F(" ")); } #endif // some debug options. //double pulseLength = myPID.getPulseValue(); //Serial.print(F("pulse value: ")); Serial.println(pulseLength); double integraal = myPID.getIntegral(); Serial.print(F("integraal: ")); Serial.println(integraal); //runEverySecondThings = false; } // end of the part that runs every second // // C. // EVERY TEN SECONDS // safety check, communicate with server, is the meat hot? // if(runSafetyCheck == true){ // the second part moves this work to beyond the heating part of the cycle. This way it shouldn't influence the heating length, and this the PID calculations. Serial.println(F("")); Serial.println(F("STARTING SAFETY CHECK ETC")); runSafetyCheck = false; // A. // CHECKING - Every 10 seconds we do a safety check. // is the server up? connectionLossCounter++; if ( connectionLossCounter > 250 ) { connectionLossCounter = 251; } // get latest setpoint values. (might not be required, some controllers send this when the values update.) //request(THERMOSTAT_CHILD_ID,V_HVAC_SETPOINT_HEAT); // every 10 seconds, request the latest smokerSetpoint data. Also used to check if the wireless connection if still alive. In theory domoticz should now pro-actively send the new data to the node, so then this code is just useful to check the connection. //request(MEATTARGET_CHILD_ID,V_HVAC_SETPOINT_HEAT); // check connection if(connectionLossCounter > MAXIMUMCONNECTIONLOSSCOUNT){ // connected lost for X amount of safety checks. Serial.println(F("! LOST CONNECTION TO SERVER")); #ifdef HASOLEDSCREEN oled.setScroll(true); oled.println(F("NO CONNECTION")); #endif } // heater not too hot? if(temperatureA > SAFEGUARD_TEMP || temperatureB > SAFEGUARD_TEMP){ targetTooHot = true; Serial.println(F("! TOO HOT")); #ifdef HASOLEDSCREEN oled.setScroll(true); oled.println(F("TOO HOT")); #endif } // Not too many errors with the temperature sensor(s)? Serial.print(F("tempSensorErrorCount: ")); Serial.println(tempSensorErrorCount); if(tempSensorErrorCount > MAXIMUMTEMPERATURESENSORERRORS){ Serial.println(F("TEMPERATURE SENSOR ERROR")); #ifdef HASOLEDSCREEN oled.setScroll(true); oled.println(F("SENSOR ERROR")); #endif } // B. // HEALING - Some functions might return, and then the system could return to normal. // It has cooled down enough if(safetyShutdown == true && targetTooHot == true && temperatureB > RETURNTONORMAL_TEMP){ // For safety, the "return to normal" temperature is lower than the maximum room temperature. This avoids flip-flopping. Serial.println(F("too hot, cooling down")); #ifdef HASOLEDSCREEN oled.println(F("COOLING DOWN!")); #endif }else if(targetTooHot == true && temperatureB <= RETURNTONORMAL_TEMP){ targetTooHot = false; } // C. // DECIDE IF OPERATION IS SAFE #ifdef DONTCHECKCONNECTION connectionLossCounter = 0; // pretend there is no connection error, even if there is. #endif if(tempSensorErrorCount > MAXIMUMTEMPERATURESENSORERRORS || connectionLossCounter > MAXIMUMCONNECTIONLOSSCOUNT || targetTooHot == true){ // Decision: something is wrong, so SHUTDOWN the relay. Serial.println(F("! ERROR DETECTED")); if(safetyShutdown == false){ // first time that the error is detected send(statusMsg.setSensor(TEXT_CHILD_ID).set( F("ERROR") )); } safetyShutdown = true; Serial.println(F("CURRENTLY IN SAFETY SHUTDOWN MODE")); #ifdef HASOLEDSCREEN oled.setScroll(true); oled.println(F("SAFETY SHUTDOWN!")); #endif }else{ // Decision: everything looks OK. Serial.println(F("EVERYTHING LOOKS OK")); if(safetyShutdown == true){ send(statusMsg.setSensor(TEXT_CHILD_ID).set( F("SMOKER OK") )); Serial.println(F("heater is ok again")); #ifdef HASOLEDSCREEN oled.setScroll(false); // the scrollmode causes flickering of the screen. For normal operation, the display function only redraws parts of the screen. #endif } safetyShutdown = false; } tempSensorErrorCount = 0; // reset for next round of counting. // send the temperature data to the controller if(!isnan(temperatureB)){ Serial.println(F("sending temp B to controller")); send(temperatureMsg.setSensor(TEMP_B_CHILD_ID).set(temperatureB, 1)); } if(!isnan(temperatureA)){ Serial.println(F("sending temp A to controller")); send(temperatureMsg.setSensor(TEMP_A_CHILD_ID).set(temperatureA, 1)); } if(!isnan(temperatureC)){ Serial.println(F("sending temp C to controller")); send(temperatureMsg.setSensor(TEMP_C_CHILD_ID).set(temperatureC, 1)); } } // end of the part that runs every 10 seconds } // end of main loop void receive(const MyMessage &message){ Serial.println(F("+++receiving message+++")); connectionLossCounter = 0; // reset the counter, indicating we have recently connected to the controller. #ifdef HASOLEDSCREEN // show wireless connection icon oled.set1X(); oled.setCursor(90,0); oled.print(F("W")); #endif /* if (message.type == V_TEXT && message.sensor == THERMOSTAT_CHILD_ID) { Serial.print(F("Received text data: ")); Serial.println(message.data); // Not doing anything with this. }*/ if (message.type == V_HVAC_SETPOINT_HEAT) { if(message.sensor == THERMOSTAT_CHILD_ID){ smokerSetpoint = atof(message.data); Serial.print(F("smokerSetpoint: ")); Serial.println(smokerSetpoint); send(thermostatMsg.setSensor(THERMOSTAT_CHILD_ID).set(smokerSetpoint,2)); // this fixes a bug in domoticz where the display in domoticz doesn't itself update the new setpoint. } if(message.sensor == MEATTARGET_CHILD_ID){ meatSetpoint = atof(message.data); Serial.print(F("meatSetpoint: ")); Serial.println(meatSetpoint); send(thermostatMsg.setSensor(MEATTARGET_CHILD_ID).set(meatSetpoint,2)); // this fixes a bug in domoticz where the display in domoticz doesn't itself update the new setpoint. } } }
  • RS485 Gatway with relay and DS18B20 sensors

    3
    0 Votes
    3 Posts
    1k Views
    butalukB
    Thank you for your support! It now works without losing some switching commands. I have adapted the Gateway software according to your suggestions. And in the fhem, I defined the devices as follows: define MYSENSOR_10 MYSENSORS_DEVICE 10 setuuid MYSENSOR_10 5c61b043-f33f-3ee4-4a0b-da4876cebf4faa94 attr MYSENSOR_10 IODev meinMSG attr MYSENSOR_10 mapReading_id4 4 id attr MYSENSOR_10 mapReading_id5 5 id attr MYSENSOR_10 mapReading_id6 6 id attr MYSENSOR_10 mapReading_id7 7 id attr MYSENSOR_10 mapReading_power 0 power attr MYSENSOR_10 mapReading_power1 1 power attr MYSENSOR_10 mapReading_power2 2 power attr MYSENSOR_10 mapReading_power3 3 power attr MYSENSOR_10 mapReading_status 0 status attr MYSENSOR_10 mapReading_status1 1 status attr MYSENSOR_10 mapReading_status2 2 status attr MYSENSOR_10 mapReading_status3 3 status attr MYSENSOR_10 mapReading_temperature4 4 temperature attr MYSENSOR_10 mapReading_temperature5 5 temperature attr MYSENSOR_10 mapReading_temperature6 6 temperature attr MYSENSOR_10 mapReading_temperature7 7 temperature attr MYSENSOR_10 mode node attr MYSENSOR_10 requestAck 1 attr MYSENSOR_10 room Heizung_OG attr MYSENSOR_10 setReading_power 1 attr MYSENSOR_10 setReading_power1 1 attr MYSENSOR_10 setReading_power2 1 attr MYSENSOR_10 setReading_power3 1 attr MYSENSOR_10 setReading_status off,on attr MYSENSOR_10 setReading_status1 off,on attr MYSENSOR_10 setReading_status2 off,on attr MYSENSOR_10 setReading_status3 off,on To control the relays individually, I defined a "readingsProxy" for each relay: define Relais1 readingsProxy MYSENSOR_10:status attr Relais1 devStateIcon on:sani_heating_level_100@red:off off:sani_heating_level_0@#18B8ED:on attr Relais1 group Heizungskreise, attr Relais1 room Heizung_OG attr Relais1 setFn {($CMD eq "on")?"status on":"status off"} attr Relais1 setList on off Thank you!
  • 'Mysensor' a smoke detector with sound detection

    9
    0 Votes
    9 Posts
    3k Views
    ileneken3I
    @tmaster Actually, the KY-038 works exactly what I want (except for the power consumption). I also have ones that are connect to mains power, and the false alarms are rare. Also, I have the Arduino programmed to sleep some time after detecting a sound and sending a message. In the case of a real alarm, it will keep sending regularly, which would make it obvious. The "batteries just end in a few months" is what I'm asking about - avoiding the .4ma used by the LM393. I'm hoping I can replace it with the LMV393, but I'm not sure if it will work. Regarding the "you think you are safe", Mysensors has heartbeats, and battery percentage reporting to deal with all that.
  • UV skin type sensor

    2
    1 Votes
    2 Posts
    937 Views
    Y
    @teecee1337 hi, and welcome to the forum! As the proof of the pudding is in the reading I would order some sensors and just give it a try. The sparkfun sensors seem easy to get started. They communicate through i2c and come with an Arduino library so it should be easy to get some readings out.
  • A sensor to detect breathing

    6
    0 Votes
    6 Posts
    2k Views
    B
    @artag Yes I agree, the anemometer should also have a very short responsetime, so it's possible to sense breathing

31

Online

12.0k

Users

11.2k

Topics

113.4k

Posts