Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. MasMat
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    MasMat

    @MasMat

    15
    Reputation
    139
    Posts
    911
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Location Helsinki, FI Age 41

    MasMat Follow

    Best posts made by MasMat

    • RE: Sensor dht+relay won't send data or present

      To follow up. It was hardware: broken vcc pin on the dht11 corrupted the whole sensor code badly. Resolder and added wait-code, inverted the on-off 0-vs-1 and I have a good working sensor. The duplicate is also installed and working reliably.
      A 6-relay board is also working nicely and Domoticz is great. My old system is nearly replaced and I couldnt be happier.

      Respect and thanks all around!

      posted in Troubleshooting
      MasMat
      MasMat
    • RE: AnalogRead problem

      @Yveaux and @boum You two beat me by 2hrs.
      @user2684 whose code this is (cudos to him, have used this bit on a number of sensors!) had probably figured that out and I screwed myself when I changed the original analogRead to int.

      Now the whole thing works 100%

      posted in Troubleshooting
      MasMat
      MasMat
    • RE: πŸ’¬ Building a Raspberry Pi Gateway

      @gohan N00b question, but which steps from the step-by-step need to be redone to "compile it" after altering myconfig.h? Or can you just post the command lines? 😳

      posted in Announcements
      MasMat
      MasMat
    • RE: [Tutorial] How to burn 1Mhz & 8Mhz bootloader using Arduino IDE 1.6.5-r5

      I have now. I always have that nagging feeling...
      But after MANY iterations, finally success. At least partly. ✌

      BlinkWithoutDelay works AND mysensors sketch as well (will do more testing...).
      What made it work, if anyone else struggles with this:

      -connect uno (to computer-linux), board:uno, upload ArduinoISP, disconnect
      -add shield to uno and atmega328p-pu to shield, connect to computer, board: "8mhz on breadboard", "programmer: "Arduino as ISP", burn bootloader, disconnect
      -board: Uno, connect as above, "upload sketch using programmer", disconnect EDIT this last part appears to work but internal clock is all messed up. Bootloader works fine like this.

      The magic happened after I changed the board back to Uno after burning bootloader. Why is beyond me, but maybe some arduino-ninja can figure it out.

      posted in Development
      MasMat
      MasMat
    • RE: [SOLVED]Two nodes with relays interfering

      Nevermind. Whined too soon.
      Completely worked over the node4 code, moved "include"s around and eventually changed the relay presentations and receive clauses. Hope this helps someone with their problems later:
      Thanks a millions!

      void before()
      {
          // Set relay pin in output mode
          pinMode(RELAY_1, OUTPUT);
          // Set relay to last known state (using eeprom storage)
          digitalWrite(RELAY_1, loadState(CHILD_ID_RELAY)?RELAY_ON:RELAY_OFF);
      }
      
      later this....
      
      present(CHILD_ID_RELAY, S_BINARY);
      
      
      ....and ending with this...
      
      void receive(const MyMessage &message)
      {
      if (message.type==V_STATUS) {
          if (message.destination == MY_NODE_ID) { // Only switch the relay if the message is for this node
              Serial.print("Updating relay state");
              // Change relay state
              digitalWrite(RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
              // Store state in eeprom
              saveState(CHILD_ID_RELAY, message.getBool());
              // Write some debug info
          }
          // Write some debug info
          Serial.print("Incoming change for sensor:");
          Serial.print(message.sensor);
          Serial.print(", New status: ");
          Serial.println(message.getBool());
      }
       
      }
      
      
      posted in Troubleshooting
      MasMat
      MasMat
    • RE: πŸ’¬ Building a Raspberry Pi Gateway

      @anticimex I've built a new node, DHT11 that sends temp&hum data. I reconfigured Rpi with this:

      sudo ./configure --my-transport=nrf24 --my-rf24-irq-pin=15 --my-signing-debug --my-signing=password --my-signing-password=XXXXXX --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-user=YYYY --my-mqtt-password=ZZZZZ --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1 --my-leds-err-pin=12 --my-leds-rx-pin=16 --my-leds-tx-pin=18
      

      This is what I get in gw syslog:

      Apr  2 22:53:11 DietPi mysgw: Starting gateway...
      Apr  2 22:53:11 DietPi mysgw: Protocol version - 2.2.0
      Apr  2 22:53:11 DietPi mysgw: MCO:BGN:INIT GW,CP=RNNGLSQX,VER=2.2.0
      Apr  2 22:53:11 DietPi mysgw: !SGN:BND:PWD<8
      Apr  2 22:53:11 DietPi mysgw: !SGN:INI:BND FAIL
      Apr  2 22:53:11 DietPi mysgw: TSF:LRT:OK
      Apr  2 22:53:11 DietPi mysgw: TSM:INIT
      Apr  2 22:53:11 DietPi mysgw: TSF:WUR:MS=0
      Apr  2 22:53:11 DietPi mysgw: TSM:INIT:TSP OK
      Apr  2 22:53:11 DietPi mysgw: TSM:INIT:GW MODE
      Apr  2 22:53:11 DietPi mysgw: TSM:READY:ID=0,PAR=0,DIS=0
      Apr  2 22:53:11 DietPi mysgw: MCO:REG:NOT NEEDED
      Apr  2 22:53:11 DietPi mysgw: MCO:BGN:STP
      Apr  2 22:53:11 DietPi mysgw: MCO:BGN:INIT OK,TSP=1
      Apr  2 22:53:11 DietPi mysgw: GWT:RMQ:MQTT RECONNECT
      Apr  2 22:53:11 DietPi mysgw: connected to 127.0.0.1
      Apr  2 22:53:11 DietPi mysgw: GWT:RMQ:MQTT CONNECTED
      Apr  2 22:53:11 DietPi mysgw: GWT:TPS:TOPIC=mysensors-out/0/255/0/0/18,MSG SENT
      Apr  2 22:53:23 DietPi mysgw: TSF:MSG:READ,99-99-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      Apr  2 22:53:23 DietPi mysgw: TSF:MSG:BC
      Apr  2 22:53:23 DietPi mysgw: TSF:MSG:FPAR REQ,ID=99
      Apr  2 22:53:23 DietPi mysgw: TSF:PNG:SEND,TO=0
      Apr  2 22:53:23 DietPi mysgw: TSF:CKU:OK
      Apr  2 22:53:23 DietPi mysgw: TSF:MSG:GWL OK
      Apr  2 22:53:23 DietPi mysgw: SGN:SKP:MSG CMD=3,TYPE=8
      Apr  2 22:53:23 DietPi mysgw: TSF:MSG:SEND,0-0-99-99,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
      Apr  2 22:53:25 DietPi mysgw: TSF:MSG:READ,99-99-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      Apr  2 22:53:25 DietPi mysgw: SGN:SKP:MSG CMD=3,TYPE=24
      Apr  2 22:53:25 DietPi mysgw: TSF:MSG:PINGED,ID=99,HP=1
      Apr  2 22:53:25 DietPi mysgw: SGN:SKP:MSG CMD=3,TYPE=25
      Apr  2 22:53:25 DietPi mysgw: TSF:MSG:SEND,0-0-99-99,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
      Apr  2 22:54:18 DietPi mysgw: TSF:MSG:READ,99-99-0,s=1,c=3,t=16,pt=0,l=0,sg=0:
      Apr  2 22:54:18 DietPi mysgw: SGN:SKP:MSG CMD=3,TYPE=16
      Apr  2 22:54:18 DietPi mysgw: !SGN:NCE:GEN
      Apr  2 22:54:23 DietPi mysgw: TSF:MSG:READ,99-99-0,s=0,c=3,t=16,pt=0,l=0,sg=0:
      Apr  2 22:54:23 DietPi mysgw: SGN:SKP:MSG CMD=3,TYPE=16
      Apr  2 22:54:23 DietPi mysgw: !SGN:NCE:GEN
      

      This is kicking my butt... I cant understand that last part about the nonce 😞
      I will add the code from the node as soon as possible.

      posted in Announcements
      MasMat
      MasMat
    • RE: mysgw MQTT Issues

      Just a quick idea: are you powering the RFM69 from the Rpi?
      I use a Rpi Zero W and when I powered my radio NRF24 from that it doesnt get enough juice even with caps.
      I now use a bigger USB-wall wart and use AMS1117-3.3 to power the radio (PA-version) and added caps.

      My two cents

      posted in Troubleshooting
      MasMat
      MasMat
    • RE: πŸ’¬ Building a Raspberry Pi Gateway

      @mfalkvidd Made the password 10 characters. From looks of the logs, it's working now.
      I cant believe I skipped the step of making the password longer... Just got too fixated on the password I came up with.

      posted in Announcements
      MasMat
      MasMat
    • RE: RPi gw broken, invalid message length

      Apparently sleeping less and debugging late solves problems. This is SOLVED.

      My IDE library was outdated. I updated my Arduino Mysensors-library, upload to one node, and my node started to communicate fine. Must reupload all nodes unfortunately. Probably the problems are caused by signing differences in previous library versions vs. 2.3.0 release for Raspberry.

      Again, hope this helps someone who encounters the same problem.

      posted in Troubleshooting
      MasMat
      MasMat
    • RE: πŸ’¬ Building a Raspberry Pi Gateway

      @ej3-martin My LEDs come on when the Rpi boots (is that what you mean by testing?). Also you can invert the LEDs (on but blink off) if you want. I figured the wiring makes for better power delivery rather than feeding voltage from the GPIO

      posted in Announcements
      MasMat
      MasMat

    Latest posts made by MasMat

    • RE: [Tutorial] How to burn 1Mhz & 8Mhz bootloader using Arduino IDE 1.6.5-r5

      @FIRE-FOX The answer depends a little on what OS you're using.
      In linux I have an Arduino-folder where the program files (not necessarily the sketches) are AND a hardware folder. Also on OSX I have an Arduino-folder (where I have my sketch-directories and libraries and hardware.
      Locate the hardware-folder (use whatever search-option your OS has) and you can pretty easily figure out where the breadboard-directory goes.

      I wish you luck with the bootloader programming. I went crazy a couple of times but once I got the routine down, it's worth the trouble.

      posted in Development
      MasMat
      MasMat
    • Voltage Sensors wrong and no Onewire

      Hi,

      I need more eyes and help with code on this.
      I have a solar battery (6S Li-ion, Nissan Leaf cells) and I want to monitor voltages, temps and (later) control a safety relay/contactor. The Arduino (3.3v pro mini is powered by a adjustable step down converter set to 3.65V -- just couldnt get 3.3V no matter how closely I turned the knob).
      The voltages come out wrong (1M+100kOhm dividers) - even with a multiplier to even it out. The DS18B20's dont register at all (with simple example sketches they read fine!).

      Measured at battery and at voltage divider:
      4,01 - 0,353
      8,02 - 0,715
      12,03 - 1,064
      16,05 - 1,419
      20,05 - 1,775
      24,06V - 2,15 V

      My code

      #define MY_DEBUG                             // Enable debug prints to serial monitor
      #define MY_RADIO_RF24 // Enable and select radio type attached
      #define MY_NODE_ID 22
      
      #define voltagePin1 19 //A5 -- 1S
      #define voltagePin2 18
      #define voltagePin3 17
      #define voltagePin4 16
      #define voltagePin5 15
      #define voltagePin6 14 //A0 -- 6S
      #define RELAY1 5
      #define RELAY2 6
      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
      #define MAX_ATTACHED_DS18B20 2
      
      #include <MySensors.h>
      #include <OneWire.h>
      #include <DallasTemperature.h>
      
      int voltSenseMax = 40150; // * Voltage divider R1 1 megaohm  R2 100 kilohms  -- 3.65V VCC
      int sampleCount = 0;  
      int sum = 0;              // sum of samples taken 
      int numSamples = 5;  
      int voltMilli;
      float voltage_array[6] = { 0, 0, 0, 0, 0, 0,};
      OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
      DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      DeviceAddress tempDeviceAddress;
      bool receivedConfig = false;
      bool metric = true;
      
      MyMessage msg_S_MULTIMETER(0, V_VOLTAGE);
      MyMessage msg(0,V_TEMP);
      
      void setup()
      {
        sensors.begin(); delay(10);
        
      for (int j=14; j<20; j++) {
       pinMode(j, INPUT);
        }
        
       pinMode(RELAY1, OUTPUT);
       digitalWrite(RELAY1, HIGH);
       pinMode(RELAY2, OUTPUT);
       digitalWrite(RELAY2, LOW);
      
      }
      
      void presentation()  
      {  
       sendSketchInfo("Solar Battery Monitor", "v05092020");    // Send the sketch version information to the gateway and Controller
      
        for (int j=14; j<20; j++) {
        present(j, S_MULTIMETER);
        }
        
        present(RELAY1, S_BINARY, "Cutoff Relay1");
        present(RELAY2, S_BINARY, "Cutoff Relay2");
        
        numSensors = sensors.getDeviceCount();
        Serial.print("Locating devices...");
        Serial.print("Found ");
        Serial.print(numSensors, DEC);
        Serial.println(" devices.");
        for (int i=0; i<numSensors; i++) {   
      
           present(i, S_TEMP);
        }
      }
      
      void loop()     
      {    
      // TEMPERATURES   
        sensors.requestTemperatures();
        for (int i=0; i<numSensors; i++) {
          if(sensors.getAddress(tempDeviceAddress, i)){
          Serial.print("Temperature for device: "); Serial.println(i,DEC);
          float tempC = sensors.getTempC(tempDeviceAddress);
          Serial.print("Temp C: ");
          Serial.println(tempC);
          send(msg.setSensor(i).set(tempC,1));
          }
        }
      
      // VOLTAGES
        for (int k=0; k<6; k++) {
          while (sampleCount < numSamples) {
              sum += analogRead(k+14);
              sampleCount++;
              delay(5);
              }
         
        int voltMilli = -(map((sum / numSamples),0,1023,0,voltSenseMax))*1.5988;  // map the reading and get the result in millivolts
        send(msg_S_MULTIMETER.setSensor(k+14).set((voltMilli / 1000.0), 2));   // Divide by 1000 to convert back to volts to two decimal places, send data to controller.                                                                                                                                            // send voltage message to gateway with 1 decimal place
        Serial.print(voltMilli / 1000.0);
        Serial.println(" V");
      //  float voltage_array[k] = (voltMilli / 1000);
        sampleCount = 0;
        sum = 0;
        delay(5000);
        }
      
      delay(15000);
      
      } 
      
      void receive(const MyMessage &message)
      {
        if (message.type==V_STATUS) {
          digitalWrite(message.sensor, message.getBool());
          saveState(message.sensor, message.getBool());
          Serial.print("Incoming change for sensor:"); Serial.print(message.sensor);
          Serial.print(", New status: "); Serial.println(message.getBool());
        }
      }
      

      I would also like to get the voltages as values to play with in the code (to monitor high and low voltages) but I cant make "voltage_array" work. Can someone with more arduino-code powers help here?

      1. why do the voltages read wrong? Why do the values come out negative (see the "-" in the voltMilli calculation)?
      2. why do the ds18b20's not show up?
      3. how do I get the values from the for-loop to play with? The "float voltage_array[k] = (voltMilli / 1000)" causes errors
      posted in Troubleshooting
      MasMat
      MasMat
    • RE: Sensor for Vallox DigitSE RS485 ventilation system with integration into FHEM.

      I found this old thread and since I have a Vallox machine it's interesting. RS485 is new to me but MySensors isn't.

      Can I have a node like this described by Heinz parallel with the "mickey mouse"-display? Using the display's connector? Or is it one or the other?

      I'd feel better having both (manual display&buttons and connection to MySensors=>Domoticz, in my case).

      posted in My Project
      MasMat
      MasMat
    • RE: πŸ’¬ Building a Raspberry Pi Gateway

      @ej3-martin My LEDs come on when the Rpi boots (is that what you mean by testing?). Also you can invert the LEDs (on but blink off) if you want. I figured the wiring makes for better power delivery rather than feeding voltage from the GPIO

      posted in Announcements
      MasMat
      MasMat
    • RE: πŸ’¬ Building a Raspberry Pi Gateway

      @NicolΓ‘s-Potier that's way way over my understanding and fluency with Mysensors. And way off topic, I think.

      posted in Announcements
      MasMat
      MasMat
    • RE: πŸ’¬ Building a Raspberry Pi Gateway

      You're not being able to connect to your MQTT broker (Mosquitto or Moqutte as was in mycontroller.org). I havent used mycontroller so I cant help with that.

      I use Mosquitto on the same Rpi (so just install mosquitto and mosquitto-clients). You should secure it but test first without credentials to get going. Remember to create credentials in mosquitto AND reconfig your gw

      posted in Announcements
      MasMat
      MasMat
    • RE: AnalogRead problem

      @Yveaux and @boum You two beat me by 2hrs.
      @user2684 whose code this is (cudos to him, have used this bit on a number of sensors!) had probably figured that out and I screwed myself when I changed the original analogRead to int.

      Now the whole thing works 100%

      posted in Troubleshooting
      MasMat
      MasMat
    • RE: Sketch problems.... I think

      I dont know what controller you are using but I had similar problems with domoticz when presenting s_light_level and V_Level vs v_light_level. It had to do with domoticz update.

      Thats what came to mind. I didnt find a sketch problem if this wasn't part of your problem.

      posted in Troubleshooting
      MasMat
      MasMat
    • RE: AnalogRead problem

      @electrik Thanks I'll check those.
      I added a lot of serial.Print's to debug where it goes south and it appears to ruin already at the first division after the analogRead (I started receiving 530's analogRead at room temp). So probably something else completely that's rotten. I'll try another machine with another Arduino IDE. It should work now that the original question is answered.
      So I'll consider this solved. Thanks again!

      posted in Troubleshooting
      MasMat
      MasMat
    • RE: AnalogRead problem

      @electrik ..and then just adjust the volts/bit for 3.3 rather than 1.1v, correct? (i.e x3). That fixed it, thank you.
      BUT presented a weird problem. The analogRead gives a proper value but the math then is not working and I cant figure it out. I did the calculations myself and get a proper result:

      int _nominal_resistor2 = 10000;
        int _nominal_temperature2 = 25;
        int _b_coefficient2 = 3950;
        int _series_resistor2 = 10000;
        int adcTmm = analogRead(THMR_PIN);
        Serial.println(adcTmm);
        float readingSau = (1023 / adcTmm)  - 1;
        readingSau = _series_resistor2 / readingSau;
        float temperatureS = readingSau / _nominal_resistor2;     // (R/Ro)
        temperatureS = log(temperatureS);                  // ln(R/Ro)
        temperatureS /= _b_coefficient2;                   // 1/B * ln(R/Ro)
        temperatureS += 1.0 / (_nominal_temperature2 + 273.15); // + (1/To)
        temperatureS = 1.0 / temperatureS;                 // Invert
        temperatureS -= 273.15;                         // convert to C
        send(msgTempSau.set((int16_t)temperatureS, 2));
          Serial.print("Sauna T: ");
          Serial.print(temperatureS);
          Serial.println(" C");
      

      But still the serial monitor shows:

      7409 MCO:SLP:WUP=1
      7413 TSF:TRI:TSB
      Sauna door: 1
      7430 TSF:MSG:SEND,21-21-10-0,s=3,c=1,t=16,pt=0,l=1,sg=0,ft=0,st=OK:1
      7966 TSF:MSG:SEND,21-21-10-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:29.00
      Shower T: 29.00
      7989 TSF:MSG:SEND,21-21-10-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:87.0
      Shower H: 87.00
      536
      8005 TSF:MSG:SEND,21-21-10-0,s=16,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:-273.00
      Sauna T: -273.15 C
      Sauna off, sleeping 30min
      Battery Voltage: 4.22 V   Battery percent: 97.70 %
      8028 TSF:MSG:SEND,21-21-10-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:97
      8097 MCO:SLP:MS=1800000,SMS=0,I1=1,M1=1,I2=255,M2=255
      8108 TSF:TDI:TSL
      

      I changed variable names to account there wouldnt be overlap with DHT library & dht part of sketch.

      posted in Troubleshooting
      MasMat
      MasMat