Skip to content
  • set hostname using static IP

    General Discussion mysensors hostname static
    3
    0 Votes
    3 Posts
    45 Views
    TheoLT
    I did a grep on the source code and found this snipper #if defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_ESP32) // Turn off access point WiFi.mode(WIFI_STA); #if defined(MY_GATEWAY_ESP8266) WiFi.hostname(MY_HOSTNAME); #elif defined(MY_GATEWAY_ESP32) WiFi.setHostname(MY_HOSTNAME); #endif #if defined(MY_IP_ADDRESS) WiFi.config(_MQTT_clientIp, _gatewayIp, _subnetIp); #endif /* End of MY_IP_ADDRESS */ (void)WiFi.begin(MY_WIFI_SSID, MY_WIFI_PASSWORD, 0, MY_WIFI_BSSID); #endif MySensors uses the standard ESP libraries for this. So I expect it to work. But you need to provide at least a bit of source code. Right now it's hard to answer your question. Regarding to MySensors: A HTTP hostname can only be set for Gateways that either use Wifi or Ethernet For nodes you can provide a sketchname and that will be seen in your controller. Regarding to static non static IP addresses. I prefer to use DHCP and set that device in my router as a static IP. There I also give it another hostname. So that in case I have to replace my Gateway I can do it all in the router. Hope this helps. But please provide more info on what you're trying to achieve
  • 0 Votes
    3 Posts
    33 Views
    TheoLT
    You don't check for which sensor the message is send - message.getSensor() - and in both cases you set the relays both on Like Skywatch said. So you could do something like: if ( message.type == V_STATUS ) { // check if GW send a status change if ( message.getSensor() == sensor 1 ) { // handles sensor 1 } else if ( message.getSensor() == sensor 2 ) { // handles sensor 1 } ... etc }
  • 0 Votes
    3 Posts
    41 Views
    OldSurferDudeO
    @nagelc said in New Setup for Home Environment Monitoring – Using NRF24L01+, Arduino Pro Mini, and BME280: bme280 I read somewhere that the temperature sensor on the BME280 is sort of an afterthought. I did a few experiments comparing them to the DHT11/12/22 and found them only a little better. (Take this with a grain of salt, maybe you'll want to do you're own experiments.) I did do a lot of experiments with the DHT's and they really suck. +/-2°C Which turns out to mean +/-2°C offset (component variation) and +/-2°C measurement: +/-4°C from what the temperature actually is. My experience, yours may be better. Please post your experience with OTA. I haven't tried it on Arduino's but it's awesome on ESP8266. I hesitate with Arduino's because I had some erratic behaviour running Arduino's when pushing the memory limit. I, too, use the MQTT data transport to Home Assistant (HA) and I find that excellent. Getting data from HA is a bit tricky, but do-able. I have a flow meter and use HA to store the last read; meaning, if there is a power failure, HA sends the last read on Arduino boot. I don't use the EEPROM because that has a spec of 100,000 writes which the meter would do in about a year, thus, necessitating a new Arduino. I truly appreciate you sharing. Thanks! -OSD
  • Running out of nodeId's

    General Discussion mysensors
    10
    3 Votes
    10 Posts
    81 Views
    nagelcN
    @GLAB You can set the frequencies using the settings in MyConfig.h, which is in the MySensors folder. If you put any of the defines from MyConfig.h into your sketch, they will override the MyConfig.h setting for that sketch only. If you are using the RF24 radio, there are different channels which correspond to a given frequency. The default is channel 76. There is a list of typical channels in MyConfig.h. If you want to change the channel for all the sketches, change it in MyConfig.h. If you want to change it just for the sketch, add a define to the sketch. For example: #define MY_RF24_CHANNEL (84) The problem with changing the channel in a sketch is that the gateway has to be on the same channel to receive from the node. So, normally it makes sense to change in MyConfig.h because you usually want the gateway and all the nodes on the same channel. Other radio's like the RFM69 list the frequency instead of using a channel. They can be overridden in the sketch as well. You can find the defines that are needed in MyConfig.h
  • 0 Votes
    2 Posts
    33 Views
    OldSurferDudeO
    I have success! (oops, that's suppose to be Timer1) I only sample for 1/60 of a second. What I did was to back up all the timer registered I used and then resorted them after I was done sampling. (As opposed to initializing the registers in setup and then starting the timer when needed.) Now I have a Nano sampling the data and sending it to a MySensors Gateway on an RPi3B+ which then sends it to an MQTT broker runing on an old laptop. Also running on the laptop is Home Assistant running inside of VirtualBox. If MySensors does use Timer1, it appears that restoring the registers allows it to be shared. //------------------------------------------------------ISR ISR(TIMER1_OVF_vect){ // interrupt service routine for overflow TCNT1 = TimerPreloadValue; // must be first line! starts the timer counting again digitalWrite(TRIGGER_START_SAMPLE_PIN,HIGH); samplesVolts[--sample]=analogRead(VOLTS_IN_PIN); // decrement before capturing samplesCurrent[sample]=analogRead(CURRENT_IN_PIN); digitalWrite(TRIGGER_START_SAMPLE_PIN,LOW); if (!sample){ // count down to zero digitalWrite(TRIGGER_START_SAMPLE_PERIOD_PIN,LOW); // indicate that sampling is complete samplingEnd = micros(); TCCR1B &= 248; // turns off timer } } //------------------------------------------------------sampleOneCycle void sampleOneCycle(){ // back up timer registers uint8_t TCNT1_b = TCNT1; uint8_t TCCR1B_b = TCCR1B; uint8_t TCCR1A_b = TCCR1A; uint8_t TIMSK1_b = TIMSK1; // configure timer which starts the sampling noInterrupts(); // disable all interrupts TCCR1A = 0; TCCR1B = 0; TCNT1 = TimerPreloadValue; // preload timer //TCCR1B |= (1 << CS10)|(1 << CS12); // 1024 prescaler TCCR1B &= 248; // turns off timer? TIMSK1 |= (1 << TOIE1); // enable timer overflow interrupt ISR // demark sampling sample = NUMBER_OF_SAMPLES; // count down to zero digitalWrite(TRIGGER_START_SAMPLE_PERIOD_PIN,HIGH); samplingStart = micros(); TCNT1 = 65535; // first trigger right away! TCCR1B |= 1; // turns on timer interrupts(); // enable all interrupts // wait for sampling to be complete while(digitalRead(TRIGGER_START_SAMPLE_PERIOD_PIN)){}; samplingEnd = micros(); // restore timer registers TCNT1 = TCNT1_b; TCCR1B = TCCR1B_b; TCCR1A = TCCR1A_b; TIMSK1 = TIMSK1_b; }
  • #define DEFAULT_RFM69_IRQ_PIN

    General Discussion mysensors
    15
    0 Votes
    15 Posts
    65 Views
    zboblamontZ
    @Tmaster What I meant by my previous comment was to tap on the Node name to see what sensors were connected - Had you clicked on TANQUE you would have seen a box pop up below giving you all the children to that particular Node with what value was last updated and when, so you could easily have found out all about your mysterious 13 children. At least you have it sorted now, but it pays to do a bit of housekeeping in the sketch setup and Domoticz - eg which of the 6 "Unknown" Nodes is the one you want to next have a look at ? All my Node IDs are set at the Node, and the sketch name labels the Node ID also, the Nodes are named in Domoticz for easy identification. In the sketch my sensors are numbered sequentially and commented on what they are, so naming them in Domoticz becomes very much easier.
  • Send an array of ADC data

    General Discussion mysensors
    1
    0 Votes
    1 Posts
    18 Views
    No one has replied
  • 💬 Easy Switch Box

    OpenHardware.io arduino mysensors lora atmega328 low power switch
    1
    0 Votes
    1 Posts
    25 Views
    No one has replied
  • MySensors Error received

    Indigo Domotics mysensors
    5
    1 Votes
    5 Posts
    54 Views
    T
    I successfully worked around the issue by updating the /Library/Application Support/Perceptive Automation/Indigo 2022.1/Plugins/MySensors.indigoPlugin/Contents/Server Plugin /plugin.py script to recognize the internal 21 code. Here's the diff: 34c134,135 < "GATEWAY_READY" : [14, "Gateway ready", ""] "GATEWAY_READY" : [14, "Gateway ready", ""], "DISCOVER_RESPONSE" : [21, "Discover response", ""] 715a717,719 elif itemType == self.getInternalNumber("DISCOVER_RESPONSE"): # 21 Ignore pass P.S. Indigo 2022.1 is complaining about this plugin that it won't be supported in future releases. Is there anyone out there planning to update this plugin?
  • 0 Votes
    2 Posts
    23 Views
    NeverDieN
    Here's a similar project: https://www.openhardware.io/view/268/Arduino-Pro-Mini-Shield-for-RFM69HW
  • 💬 nRF24L01 Adapter Board (AH)

    OpenHardware.io mysensors
    1
    0 Votes
    1 Posts
    15 Views
    No one has replied
  • MyS blocking i2c PCF8574

    Hardware mysensors
    13
    0 Votes
    13 Posts
    142 Views
    J
    final sketch and functional with MyController /* * DESCRIPTION : 4 inputs and 4 outputs on i2C bus with a PCF8574 * * LIBRAIRIES: * - Rob Tillaart pour PCF8574 https://github.com/RobTillaart/Arduino/tree/master/libraries/PCF8574 * - MySensors / Arduino Uno https://github.com/mysensors/MySensors * * ELEMENTS: * - Expander PCF8574 avec module Metasys JC / 4di 4do - 0X03D i2c adress * * MODIFICATION: * -x- RAS : Fonctionnelle * -o- * -o- * * (36%) de l'espace de stockage de programmes */ //----------- 9 Mai 2022 ---------------- PCF8574 -4DI-4DO / MyS RS485 et MyC -----------------// //------------------- MyS --------------------------------- //#define MY_DEBUG /*Enable debug prints to serial monitor*/ //#define MY_DEBUG_OTA_DISABLE_ECHO //testing #define MY_TRANSPORT_WAIT_READY_MS 3000 /*Tempo de mis en Com (millisecondes) à placer avant Mysensors.h*/ #define MY_NODE_ID 40 /*Node en ID static*/ /* ----- Module TTL-RS485 ----*/ #define MY_RS485 /*Apl du transport RS485 (protocol?)*/ #define MY_RS485_DE_PIN 10 /*Cmd DE pin*/ #define MY_RS485_BAUD_RATE 9600 /*Set RS485 baud rate to use*/ #define MY_REPEATER_FEATURE /*Activer fonctionnalité de répéteur du nœud*/ #include <MySensors.h> //---------------- PCF ------------------------------- #include "PCF8574.h" PCF8574 PCF27a (0x3D); // adjust addresses i2c pcf8574 // ------ objet ------ #define CHILD_ID_B0 0 /*Id IN - bp */ #define CHILD_ID_B1 1 #define CHILD_ID_B2 2 #define CHILD_ID_B3 3 #define CHILD_ID_R4 4 /*Id OUT - relay */ #define CHILD_ID_R5 5 #define CHILD_ID_R6 6 #define CHILD_ID_R7 7 #define RELAY_ON 0 // 1 valeur #define RELAY_OFF 1 // 0 invers //---------- MyS ------------- MyMessage msg0(CHILD_ID_B0,V_TRIPPED); /*Boton*/ MyMessage msg1(CHILD_ID_B1,V_TRIPPED); MyMessage msg2(CHILD_ID_B2,V_TRIPPED); MyMessage msg3(CHILD_ID_B3,V_TRIPPED); MyMessage msg4(CHILD_ID_R4,V_STATUS); /*Relay*/ MyMessage msg5(CHILD_ID_R5,V_STATUS); MyMessage msg6(CHILD_ID_R6,V_STATUS); MyMessage msg7(CHILD_ID_R7,V_STATUS); bool info; // pour info GW sur MyC bool state = false; // output // bool state4 = false; bool state5 = false; bool state6 = false; bool state7 = false; int oldValue0=-1; int oldValue1=-1; int oldValue2=-1; int oldValue3=-1; // Input //---------------- SETUP ------------------------- void setup() { // Serial.begin(115200); // debug //--------- testing IsConnected i2c PCfx ------------ Serial.println(__FILE__); Serial.print("PCF8574_LIB_VERSION:\t"); Serial.println(PCF8574_LIB_VERSION); if (!PCF27a.begin()) { Serial.println("could not initialize..."); } if (!PCF27a.isConnected()) { Serial.println("=> not connected"); } else { Serial.println("=> connected!!"); } // ---- info send to gateway ---- send(msg0.set(info)); send(msg1.set(info)); //input wait(200); send(msg2.set(info)); send(msg3.set(info)); //input wait(200); //delays for frames, depending on system load and bus type (wireless or wired) send(msg4.set(info)); send(msg5.set(info)); //output wait(200); send(msg6.set(info)); send(msg7.set(info)); //output } //----------------- MyS ---------------------------- void presentation() { sendSketchInfo("PCF8574 x4in/out - node40", "2.0"); /*info version sketch*/ /*Mysenors Enregistre Child sur la Gw*/ present(CHILD_ID_B0, S_DOOR, "boton0"); /*Boton*/ present(CHILD_ID_B1, S_DOOR, "boton1"); wait(200); present(CHILD_ID_B2, S_DOOR, "boton2"); present(CHILD_ID_B3, S_DOOR, "boton3"); wait(200); //delays for frames, depending on system load and bus type (wireless or wired) present(CHILD_ID_R4, S_BINARY, "relay4"); /*Relay*/ present(CHILD_ID_R5, S_BINARY, "relay5"); wait(200); present(CHILD_ID_R6, S_BINARY, "relay6"); present(CHILD_ID_R7, S_BINARY, "relay7"); wait(200); // metric = getControllerConfig().isMetric; } //----------------- LOOP ---------------------------- void loop() { //----------- MyS input ------------------------------- int value0 = PCF27a.read(0); if (value0 != oldValue0) { send(msg0.set(value0==HIGH ? 1 : 0)); //Send new value oldValue0 = value0; } int value1 = PCF27a.read(1); if (value1 != oldValue1) { send(msg1.set(value1==HIGH ? 1 : 0)); oldValue1 = value1; } int value2 = PCF27a.read(2); if (value2 != oldValue2) { send(msg2.set(value2==HIGH ? 1 : 0)); oldValue2 = value2; } int value3 = PCF27a.read(3); if (value3 != oldValue3) { send(msg3.set(value3==HIGH ? 1 : 0)); oldValue3 = value3; } } //----------- MyS out ------------------------------- void receive(const MyMessage &message) { if (message.getType()==V_STATUS) { switch (message.sensor) { case 4: state= message.getBool(); PCF27a.write(4, state?RELAY_ON:RELAY_OFF); break; case 5: state = message.getBool(); PCF27a.write(5, state?RELAY_ON:RELAY_OFF); break; case 6: state = message.getBool(); PCF27a.write(6, state?RELAY_ON:RELAY_OFF); break; case 7: state = message.getBool(); PCF27a.write(7, state?RELAY_ON:RELAY_OFF); break; } } } //------------------------------ End pgm -------------------------------------
  • SHT30 on arduino

    My Project mysensors
    4
    0 Votes
    4 Posts
    54 Views
    skywatchS
    @yoshi824 Most of us have been where you are now! I suggest that you try to see the patterns in the code that you have working and try to make the SHT30 work from what you learn. If it does not work as you want then post here the full code you have and what it is/isn't doing and you should get some help.
  • Ultrasonic sensor JSN-SR04T

    Hardware mysensors
    4
    0 Votes
    4 Posts
    64 Views
    L
    To provide a large enough pulse to drive the ceramic transducer , you need a lot of energy, so they pump up the 5v with an inductor/transformer to provide a high voltage pulse. This is 60v or more… The more Energy you produce the farther the pulse will travel…. Everything thing else on the board run at 3.3 to 5V. Add a large Capacitor of 100 µF are so between the 5v and ground on the device, this may clean up your problem.. Some CPU modules just can’t supply enough current quick enough that’s needed when the pulse is triggered. These are very inexpensive device, we’re luck to see them work at 1/2 the spec range.
  • ESP8266 as (MQTT) Gateway with I2C Sensors

    Hardware mysensors
    2
    1 Votes
    2 Posts
    31 Views
    BearWithBeardB
    @Sunseeker According to the Connecting the Radio page, D2 is the default pin for the CE signal for the NRF24. If you'd like to use this pin for I2C, you can free it up by assigning a different pin for the CE signal by adding this line to your sketch: #define MY_RF24_CE_PIN pin IIRC, all available pins should work for this purpose (D0, D3, D4). Just pick one and if it doesn't work, use one of the other pins. Please make sure to add that line before #include <MySensors.h>.
  • SCT-013-000 Calibration Value

    General Discussion mysensors
    1
    1
    0 Votes
    1 Posts
    38 Views
    No one has replied
  • Can't get ESP8266 gateway to work anymore

    My Project mysensors
    8
    0 Votes
    8 Posts
    101 Views
    YveauxY
    @Zwer2k my expectations seem correct. I created a bug report that also includes a rudimentary workaround. https://github.com/mysensors/MySensors/issues/1496#issue-968399284
  • 0 Votes
    4 Posts
    50 Views
    F
    @ZenBlizzard in case you are measuring the output with a multimeter, you will get an averaged level, since AC current waveform should be sinusoidal and overlapped with the Vcc/2->2.56V in your case. To measure the current you need a decently high sampling and some math. #define SENSITIVITY 66 // mV/A const float readings = 5; const float alpha = 2.0 / (2 * readings + 1); for (ifor = 0; ifor < 250; ifor++) { // Voltage voltageSampleRead = analogRead(V) * vccRead / 1023 - vccRead / 2; /* read the sample value including offset value*/ voltageSampleSum = voltageSampleSum + sq(voltageSampleRead); /* accumulate total analog values for each sample readings*/ voltageSampleOffsetSum = voltageSampleOffsetSum + voltageSampleRead; // Current currentSampleRead = analogRead(I) * vccRead / 1023 - vccRead / 2; /* read the sample value including offset value*/ currentSampleSum = currentSampleSum + currentSampleRead * currentSampleRead; /* accumulate total analog values for each sample readings*/ currentSampleOffsetSum = currentSampleOffsetSum + currentSampleRead; wait(1); } voltageMean = voltageSampleSum / ifor; /* calculate average value of all sample readings taken*/ voltageOffset = voltageSampleOffsetSum / ifor; reading = (sqrt(voltageMean) - voltageOffset) * 230.0 / 1.0; // read voltage / reported voltage. voltage = round_to_dp(alpha * reading + (1 - alpha) * voltage,1); Serial.println(voltage); if (voltage < 25) voltage = 0; currentMean = currentSampleSum / ifor; /* calculate average value of all sample readings taken*/ currentOffset = currentSampleOffsetSum / ifor; reading = (sqrt(currentMean) - currentOffset) / SENSITIVITY * 1000 - currentZeroOffset; // subtract no load current. if (reading < 0) reading = 0; current = round_to_dp( alpha * reading + (1 - alpha) * current,2);
  • 💬 HVAC Recuperator control

    OpenHardware.io hvac recuperator mysensors
    1
    0 Votes
    1 Posts
    30 Views
    No one has replied
  • 0 Votes
    2 Posts
    31 Views
    W
    @WiktorDIY The ch340 are notorious for being broken. The best I ever achieved was 19200 and flakey.. I purchased a real Nano not a ch knock off eg uses a different uart no problems

26

Online

11.7k

Users

11.2k

Topics

113.1k

Posts