Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
MasMatM

MasMat

@MasMat
About
Posts
149
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ESPnow as transport layer
    MasMatM MasMat

    I never noticed the 20 device cap. That won't do.
    What I am thinking of now, is to use EspHome and just dedicate a router to handle just that network - so kinda creating an IoT network without internet access and as standalone as possible. Using static IPs should make the response better too.

    Thanks for looking into this.

    Feature Requests

  • ESPnow as transport layer
    MasMatM MasMat

    I've been looking into ESPnow and it looks good to me in many ways. Also the architecture would simplify building sensors.
    I'm not a programmer at all, so I have no real idea of the scope of coding & testing this request would require. Or if the protocol could be suited to current topology.
    But still, I wanted to throw this out there and hopefully get a response from someone who's better informed.

    Feature Requests

  • Ghost Child
    MasMatM MasMat

    Isn't 255 the child id for default battery level?
    The code after is per log parser "!MCO:PRO:RC=1 Recursive call detected in _process(), call level=1"

    I'd look in your code.
    Also I can't figure out your setup from what you describe (rpi + nano via usb?)

    Troubleshooting

  • ESP-NOW
    MasMatM MasMat

    Old topic, I know. Did anything ever come of this?
    I'm also thinking it would be easy & cheap to get the espnow working as a transport layer.
    I found this: https://www.mysensors.org/apidocs-beta/classESPNOW.html
    But it goes above my head and abilities when it comes to code.

    General Discussion i recently noticed that expres between esp8266 and es[p 220v which allows direct conection if has released esp-now

  • Measure multiple voltages
    MasMatM MasMat

    Check. Gotta redesign.
    I'll get optos on the AC-voltages and power the Rpi from the 48/12V ground source.

    Thanks for confirming my doubts.

    Troubleshooting

  • Measure multiple voltages
    MasMatM MasMat

    If the grounds are connected: you mean I could connect them. Is it a bad idea?
    When I really look at my goals, measuring is necessary only for the 48V line.
    All the others I can get by with a on/off-info. Optocouplers for 240v data maybe?
    The 48v and 12v probably have common ground considering the dc-dc converter? I'm not familiar with their design.

    Troubleshooting

  • Measure multiple voltages
    MasMatM MasMat

    I need help with my build. I had what I thought was a great idea but now I'm having doubts & regrets.

    I want to

    1. monitor the utility power (three phase. L1, L2, L3)
    2. monitor solar inverter power (single phase)
    3. monitor solar battery 48+ V
    4. monitor 12V power supply (DC-DC 48=>12V)
    5. send alarms if any are down & return back up
    6. have six green leds on in a dash when all is clear - extra orange and red led for alarm states

    The 240Vs each have a plug and a wall wart/phone charger plugged in.
    I built a thru-hole pcb with 6 LEDs and voltage dividers for each power supply.
    A Rpi Zero + MCP3008 reads the voltage dividers.
    I connected the grounds (neg wires) on the chargers (4x) and hooked it to the pcb. I have leds light up. The 48v and 12v however don't light the leds (their gnd is not connected). The MCP3008 is not reading (the code could be wrong - just did a quick test).

    As I was thinking about this, I got worried.
    Can I connect all the grounds together (4x wall plug, 48V and 12V) ?
    If not, what would be a good way to accomplish what I'm trying to do? I would like to read at least the solar battery voltage (40-57V) beacause that changes. The others can be on/off-type.

    Any help or advice is appreciated!

    Troubleshooting

  • Smart doorbell
    MasMatM MasMat

    OK. The fstab has credentials file and username password - I recommend picking one. Cred file probably more secure (but permission issues may arise again).

    What I like to do is add my own log entries (into a logfile of my own - not syslog) into the script - to begin with, it logs all kinds of steps the program goes thru. That way I can figure out what makes it stuck - or go crazy otherwise. Then remove all the crazy logging once the script works.
    Example from a shell script of mine of one of many lines marking up whatever steps:
    echo "date -u InetReboot script" >> /home/pi/reboots.log

    "Camera taking pictures constantly" does sound like bouncing..? Reading the button? Could be hardware. Maybe slow down the script also - add "time.sleep(50)" at the end?
    I'm not sure but does python need the GPIO-definitions at the beginning?
    i.e.:
    import RPi.GPIO as GPIO
    GPIO.setmode(GPIO.BOARD)
    and maybe add a pullup/pulldown depending on your wiring.

    My Project

  • Smart doorbell
    MasMatM MasMat

    Just some things to check (I'm NOT a linux ninja):
    -crontab: why do "sudo crontab -e"? Would using just "crontab -e" use pi-users crontab and have less conflicting permissions?
    -fstab has multiple credentials currently
    -the launcher I believe has unnecessary lines (the changing directories)
    -did you have multiple pythons? (bbt.py, doorbell.py?)

    Just my two cents. Most of my problems are like this or permissions issues that just take too damn long to figure out.

    My Project

  • Roller shutter(s_cover) on Domoticz
    MasMatM MasMat

    Old thread, I know. Anybody know if this was ever fixed? I can get by with just open/close but percentage would be extra snazzy.

    I'm using a 12V dc motor and microswitches at limit points. The blind is just SO heavy/dragging that I had to get a beefy DC motor. The apparatus moves nicely. Just the control circuitry to do.

    Domoticz

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

    @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.

    Development

  • Voltage Sensors wrong and no Onewire
    MasMatM MasMat

    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
    Troubleshooting

  • Sensor for Vallox DigitSE RS485 ventilation system with integration into FHEM.
    MasMatM MasMat

    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).

    My Project rs485 vallox fhem

  • 💬 Building a Raspberry Pi Gateway
    MasMatM MasMat

    @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

    Announcements

  • 💬 Building a Raspberry Pi Gateway
    MasMatM MasMat

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

    Announcements

  • 💬 Building a Raspberry Pi Gateway
    MasMatM MasMat

    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

    Announcements

  • AnalogRead problem
    MasMatM MasMat

    @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%

    Troubleshooting

  • Sketch problems.... I think
    MasMatM MasMat

    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.

    Troubleshooting

  • AnalogRead problem
    MasMatM MasMat

    @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!

    Troubleshooting

  • AnalogRead problem
    MasMatM MasMat

    @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.

    Troubleshooting
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular