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
S

stingone

@stingone
About
Posts
27
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 💬 Temperature Sensor
    S stingone

    @Sealander

    see solution above. Delete your dallas library and replace with the one above in the master zip file. That was the solution for me.

    Announcements

  • How to build a repeater
    S stingone

    @mfalkvidd said:

    @stingone what does the serial debug output say?

    TSM:UPL
    TSP:PING:SEND (dest=0)
    !TSP:MSG:SEND 6-6-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=fail:1
    TSP:CHKUPL:FAIL (hops=255)
    !TSM:UPL:FAIL
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSP:SEND:TNR
    TSP:MSG:READ 5-5-6 s=255,c=3,t=8,pt=1,l=1,sg=0:1
    TSP:MSG:FPAR RES (ID=5, dist=1)
    TSP:MSG:PAR OK (ID=5, dist=2)
    !TSP:SEND:TNR
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=6)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    !TSP:MSG:SEND 6-6-5-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=fail:1
    TSP:CHKUPL:FAIL (hops=255)
    !TSM:UPL:FAIL
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    Init complete, id=6, parent=255, distance=255, registration=1
    !TSP:SEND:TNR```
    
    
    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=6)
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=6)
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=6)
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 6-6-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    
    General Discussion

  • How to build a repeater
    S stingone

    Now testing for few day's and i see that one of my sensors stops working after few minutes.. the one that is most close to the gateway... after resetting it sends af few minutes and then stops working again...

    General Discussion

  • How to build a repeater
    S stingone

    @ramoncarranza said:

    no need to change anything on your original sensors and and yes it will relay signals from multiple sensors to your gateway/controller. Just our of curiosity, what controller are you using???

    Just build the repeater today..how can i see check if it is working properly??

    Nevermind its working :):) just received the information on the repeater... great support thanks

    General Discussion

  • How to build a repeater
    S stingone

    @ramoncarranza said:

    no need to change anything on your original sensors and and yes it will relay signals from multiple sensors to your gateway/controller. Just our of curiosity, what controller are you using???

    Using pimatic v9. on a raspberry pi 3. I already build a mysensors combined temp/ph sensor. But had to change the code in mysensors v2.0. I'm using lot of 433mhz over more then 25 devices.. but im now changing also towards mysensors :). so the mysensors is a little bit new to me.

    General Discussion

  • How to build a repeater
    S stingone

    @ramoncarranza

    Ok so no need to change any code in my original sensor? and will it send multiple values from more sensors if picked-up?

    General Discussion

  • How to build a repeater
    S stingone

    @ramoncarranza

    So just using that example code is enough?

    General Discussion

  • How to build a repeater
    S stingone

    @scalz said:

    Hello,

    Here it is https://www.mysensors.org/download/sensor_api_20#create-repeating-nodes
    lot of great docs on main site though ;)

    so do i need to use for each sensor a repeater? copy the sensor code and add the #define MY_REPEATER_FEATURE in the top of the code?

    General Discussion

  • Problems dallas tempsensor
    S stingone

    @Boots33 said:

    @stingone That is a known issue with the latest dallas library. See this post for the fix

    Many thanks.. works all fine now :) had indeed the wrong datasheet...

    Troubleshooting

  • How to build a repeater
    S stingone

    Hello everyone.

    I cant find a clear solution how to build a repeater. i have a tempsensor on 40m distance from my gateway and want to build a repeater in between.

    Can anyone tell me what to do achieving this e.g. sample code etc..

    Thanks..

    General Discussion

  • Problems dallas tempsensor
    S stingone

    @Boots33
    Will check the wires again...
    what about the compile error?

    int16_t DallasTemperature::millisToWaitForConversion(uint8_t)' is private

    I did a fresh install with latest libraries.. but still getting this error everytime while compilling.

    Troubleshooting

  • Problems dallas tempsensor
    S stingone

    Hello everyone.

    Today i tried to create temp sensor... i did it before for my fishtank all worked fine.

    Today i used a DS18D20 incl 4k7 resistor. After hooking-up the sensor burned down right away... hooked-up to the 5v. Also getting no information from the serial monitor....

    I already flashed it to a gateway to see if my arduino and NRF24 still was working and it did. so i have no clue what goes wrong here...

    Any suggestions before burning more sensors...

    Troubleshooting

  • 💬 Temperature Sensor
    S stingone

    No compile error but i cant see anything on the serial monitor. also the temp sensor burend out with a 4k7 resistor :S

    Announcements

  • Help on code for Mysensors 2.0
    S stingone

    @mfalkvidd said:

    It depends on how much work you are prepared to do and how much flexibility you want in the code.

    If you only use one temperature sensor and don't have any plans to add more, change

    gw.send(msg.setSensor(i).set(temperature,1));
    
    gw.send(msg.set(temperature,1));
    

    Only using the ph sensor and 1 temperatuur sensor no need for more temp sensors.

    Development

  • Help on code for Mysensors 2.0
    S stingone

    @mfalkvidd said:

    @stingone this line

     gw.send(msg.setSensor(i).set(temperature,1));
    

    will set the child id to 0 for the first temp sensor, to 1 for the second and so on. That's why you get temperature data on id 0, which is also used by the ph sensor.

    What would be best to do?

    Development

  • Help on code for Mysensors 2.0
    S stingone

    Got it working with another laptop..wil recompile to 2.0 in the weekend.

    Just a quick question. I have 2 sensors on 1 arduino. Works fine however sometimes it shows the value of the temp sensor on the value of the ph sensor.

    #include <SPI.h>
    #include <MySensor.h>
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #include "Vcc.h"        // https://github.com/Yveaux/Arduino_Vcc
    
    static const float VccMin = 0.0;        // Minimum expected Vcc level, in Volts. (0.6V for 1 AA Alkaline)
    static const float VccMax = 3.3;        // Maximum expected Vcc level, in Volts. (1.5V for 1 AA Alkaline)
    static const float VccCorrection = 3.29 / 3.31;  // Measured Vcc by multimeter divided by reported Vcc
    Vcc vcc(VccCorrection);
    
    #define CHILD_ID_PH 0
    #define ArrayLenth 10               // times of collection
    #define PH_SENSOR_ANALOG_PIN A0         // pH meter Analog output to Arduino Analog Input 0
    #define LED_DIGITAL_PIN 13
    #define Offset 0.25           //deviation compensate
    
    #define CHILD_ID_TEMP 1
    #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 16
    
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    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.
    
    unsigned long lastSend = 0;
    static const unsigned long SEND_FREQUENCY = 30000;  // Minimum time between send (in milliseconds)
    
    MySensor gw;
    
    float lastPhHValue;
    
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    boolean receivedConfig = false;
    boolean metric = true; 
    
    MyMessage msgPH(CHILD_ID_PH, V_VAR1);
    MyMessage msg(CHILD_ID_TEMP,V_TEMP);
    
    void setup()
    {
        // Startup up the OneWire library
        sensors.begin();
        // requestTemperatures() will not block current thread
        sensors.setWaitForConversion(false);
        
        //gw.begin(NULL, 100, false); //deze gebruiken, 100 is de node_id, die weer gebruiken in pimatic
        gw.begin();
        //Serial.print("0;0;3;0;2;");Serial.print(LIBRARY_VERSION);
        
        pinMode(LED_DIGITAL_PIN, OUTPUT);
        numSensors = sensors.getDeviceCount();
        
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("pHmeter", "1.1");
        
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_PH, S_WATER);
    
        // Present all sensors to controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
        gw.present(i, S_TEMP);
        }
    }
    
    void loop()
    {
        // By calling process() you route messages in the background
        gw.process();
        read_PH();
        read_TEMP();
    
        gw.sleep(SLEEP_TIME);
    }
    
    void read_PH(){
       unsigned long now = millis();
        bool sendTime = now - lastSend > SEND_FREQUENCY;
        if (sendTime)
        {
            lastSend = now;
            
            //    float v = vcc.Read_Volts();
            //    Serial.print("VCC = " );
            //    Serial.print(v);
            //    Serial.println(" Volts" );
            
            int batteryPcnt = (int)vcc.Read_Perc(VccMin, VccMax);
            //    Serial.print("VCC = " );
            //    Serial.print(batteryPcnt);
            //    Serial.println(" %" );
            
            gw.sendBatteryLevel(batteryPcnt);
        }
        
        // Read PH_SENSOR_ANALOG_PIN in phValue
        float voltage = analogReadAverage(PH_SENSOR_ANALOG_PIN, 10) * 5.0 / 1024;
        
        // convert the millivolt into pH value
        float PhValue = 3.5 * voltage+Offset;
        
        
        
            Serial.print("    pH:");
            Serial.print(PhValue, 2);
            Serial.println(" ");
            
            gw.send(msgPH.set(PhValue, 2)); // envoi au reseau avec deux decimales
            
            digitalWrite(LED_DIGITAL_PIN, digitalRead(LED_DIGITAL_PIN) ^ 1);
            
            lastPhHValue = PhValue;
        
    }
    
    
    void read_TEMP(){
      sensors.requestTemperatures();
    
      // query conversion time and sleep until conversion completed
      int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      gw.sleep(conversionTime);
    
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
     
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
     
        // Only send data if temperature has changed and no error
        #if COMPARE_TEMP == 1
        if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
        #else
        if (temperature != -127.00 && temperature != 85.00) {
        #endif
     
          // Send in the new temperature
          gw.send(msg.setSensor(i).set(temperature,1));
          // Save new temperatures for next compare
          lastTemperature[i]=temperature;
        }
      }   
    }
    
    
    
    
    
    
    
    double analogReadAverage(uint8_t pin, unsigned long ms)
    {
        double average = 0;
        int buffer[ArrayLenth];
        
        for (int i = 0; i < ArrayLenth; i++)
        {
            buffer[i] = analogRead(PH_SENSOR_ANALOG_PIN);
            delay(ms);
        }
        
        if (ArrayLenth < 5)
        {
            // less than 5, calculated directly statistics
            for (int i = 0; i < ArrayLenth; i++)
            {
                average += buffer[i];
            }
            average = average / ArrayLenth;
        }
        else
        {
            // Sort the values from small to large
            for (int i = 0; i < ArrayLenth; i++)
            {
                for (int j = i + 1; j < 10; j++)
                {
                    if (buffer[i] > buffer[j])
                    {
                        int temp = buffer[i];
                        buffer[i] = buffer[j];
                        buffer[j] = temp;
                    }
                }
            }
            
            // take the average value of center sample
            for (int i = 2; i < ArrayLenth - 2; i++)
            {
                average += buffer[i];
            }
            
            average = average / (ArrayLenth - 4);
        }
        
        return average;
    }
    
    
    

    And in Pimatic

    {
          "id": "temperatuur-aquarium",
          "name": "Temperatuur Aquarium",
          "class": "MySensorsDST",
          "nodeid": 2,
          "sensorid": 0
        },
        {
          "id": "phmeter-aquarium",
          "name": "pH Aquarium",
          "class": "MySensorsPH",
          "nodeid": 2,
          "sensorid": 0,
          "batterySensor": false
        },
    

    debug [pimatic-mysensors]: <- MySensorsPH { sender: 2, sensor: 0, type: 0, value: '25.4' }
    22:23:06debug [pimatic-mysensors]: <- MySensorDST { sender: 2, sensor: 0, type: 0, value: '25.4' }
    22:23:06debug [pimatic-mysensors]: <- I_LOG_MESSAGE 0;0;3;0;9;read: 2-2-0 s=0,c=1,t=0,pt=7,l=5,sg=0:25.4
    22:23:05debug [pimatic-mysensors]: <- MySensorsPH { sender: 2, sensor: 0, type: 24, value: '6.60' }
    22:23:05debug [pimatic-mysensors]: <- I_LOG_MESSAGE 0;0;3;0;9;read: 2-2-0 s=0,c=1,t=24,pt=7,l=5,sg=0:6.60

    If you look at the output in pimatic you can see that the mysensorsPH and mysensorsDST have the temp value. This happens 50% of the time.

    Development

  • Help on code for Mysensors 2.0
    S stingone

    @scalz said:

    Hello.

    It seems that you have not converted your old sketch to 2.0 In the new release there is no need of declaring a Mysensor instance like before "Mysensor gw" and some other stuff ..

    So, what you can do:

    • convert your sketch to 2.0. For details see here : https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x
    • or look at the 2.0 examples sketch to see how it looks now. and don't worry if there is not so much code in new sketch compared to before, the stuff is hidden that's all ;)

    If still issues, please post logs so we can help you. without not easy..

    I will try to change the code. for now i installed the 1.5 again however compiling is fine but it says at the end error uploading sketch thats all no other messages.. i already tried 3 board other usb cable. com ports settings are fine and i can use the serial monitor with the existing code but somehow it wont upload the new.

    Development

  • Help on code for Mysensors 2.0
    S stingone

    Hi everone.

    Couple of months i created a code for my dallas an ph sensor. however i reinstalled my pc and installed the mysensors 2.0 resulting in a error with No forward link or gateway feature activated.

    /*
      Original code created by DFRobot for their probes, 
      adapted by haze5@icloud.com Mysensors for the project.
    */
    
    
    #include <SPI.h>
    #include <MySensors.h>
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #include "Vcc.h"        // https://github.com/Yveaux/Arduino_Vcc
    
    static const float VccMin = 0.0;        // Minimum expected Vcc level, in Volts. (0.6V for 1 AA Alkaline)
    static const float VccMax = 3.3;        // Maximum expected Vcc level, in Volts. (1.5V for 1 AA Alkaline)
    static const float VccCorrection = 3.29 / 3.31;  // Measured Vcc by multimeter divided by reported Vcc
    Vcc vcc(VccCorrection);
    
    #define CHILD_ID_PH 0
    #define ArrayLenth 10               // times of collection
    #define PH_SENSOR_ANALOG_PIN A0         // pH meter Analog output to Arduino Analog Input 0
    #define LED_DIGITAL_PIN 13
    #define Offset 0.25           //deviation compensate
    
    #define CHILD_ID_TEMP 1
    #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 16
    
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    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.
    
    unsigned long lastSend = 0;
    static const unsigned long SEND_FREQUENCY = 30000;  // Minimum time between send (in milliseconds)
    
    MySensor gw;
    
    float lastPhHValue;
    static const float deltaPhValue = 0.5;
    
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    boolean receivedConfig = false;
    boolean metric = true; 
    
    MyMessage msgPH(CHILD_ID_PH, V_VAR1);
    MyMessage msg(CHILD_ID_TEMP,V_TEMP);
    
    void setup()
    {
        // Startup up the OneWire library
        sensors.begin();
        // requestTemperatures() will not block current thread
        sensors.setWaitForConversion(false);
        
        //gw.begin(NULL, 100, false); //deze gebruiken, 100 is de node_id, die weer gebruiken in pimatic
        gw.begin();
        //Serial.print("0;0;3;0;2;");Serial.print(LIBRARY_VERSION);
        
        pinMode(LED_DIGITAL_PIN, OUTPUT);
        numSensors = sensors.getDeviceCount();
        
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("pHmeter", "1.0");
        
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_PH, S_WATER);
    
        // Present all sensors to controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
        gw.present(i, S_TEMP);
        }
    }
    
    void loop()
    {
        // By calling process() you route messages in the background
        gw.process();
        read_PH();
        read_TEMP();
    
        gw.sleep(SLEEP_TIME);
    }
    
    void read_PH(){
       unsigned long now = millis();
        bool sendTime = now - lastSend > SEND_FREQUENCY;
        if (sendTime)
        {
            lastSend = now;
            
            //    float v = vcc.Read_Volts();
            //    Serial.print("VCC = " );
            //    Serial.print(v);
            //    Serial.println(" Volts" );
            
            int batteryPcnt = (int)vcc.Read_Perc(VccMin, VccMax);
            //    Serial.print("VCC = " );
            //    Serial.print(batteryPcnt);
            //    Serial.println(" %" );
            
            gw.sendBatteryLevel(batteryPcnt);
        }
        
        // Read PH_SENSOR_ANALOG_PIN in phValue
        float voltage = analogReadAverage(PH_SENSOR_ANALOG_PIN, 10) * 5.0 / 1024;
        
        // convert the millivolt into pH value
        float PhValue = 3.5 * voltage+Offset;
        
        
        
        
        if (sendTime || abs(PhValue - lastPhHValue) > deltaPhValue)
        {
            Serial.print("    pH:");
            Serial.print(PhValue, 2);
            Serial.println(" ");
            
            gw.send(msgPH.set(PhValue, 2)); // envoi au reseau avec deux decimales
            
            digitalWrite(LED_DIGITAL_PIN, digitalRead(LED_DIGITAL_PIN) ^ 1);
            
            lastPhHValue = PhValue;
        }
    }
    
    
    void read_TEMP(){
      sensors.requestTemperatures();
    
      // query conversion time and sleep until conversion completed
      int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      gw.sleep(conversionTime);
    
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
     
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
     
        // Only send data if temperature has changed and no error
        #if COMPARE_TEMP == 1
        if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
        #else
        if (temperature != -127.00 && temperature != 85.00) {
        #endif
     
          // Send in the new temperature
          gw.send(msg.setSensor(i).set(temperature,1));
          // Save new temperatures for next compare
          lastTemperature[i]=temperature;
        }
      }   
    }
    
    
    
    
    
    
    
    double analogReadAverage(uint8_t pin, unsigned long ms)
    {
        double average = 0;
        int buffer[ArrayLenth];
        
        for (int i = 0; i < ArrayLenth; i++)
        {
            buffer[i] = analogRead(PH_SENSOR_ANALOG_PIN);
            delay(ms);
        }
        
        if (ArrayLenth < 5)
        {
            // less than 5, calculated directly statistics
            for (int i = 0; i < ArrayLenth; i++)
            {
                average += buffer[i];
            }
            average = average / ArrayLenth;
        }
        else
        {
            // Sort the values from small to large
            for (int i = 0; i < ArrayLenth; i++)
            {
                for (int j = i + 1; j < 10; j++)
                {
                    if (buffer[i] > buffer[j])
                    {
                        int temp = buffer[i];
                        buffer[i] = buffer[j];
                        buffer[j] = temp;
                    }
                }
            }
            
            // take the average value of center sample
            for (int i = 2; i < ArrayLenth - 2; i++)
            {
                average += buffer[i];
            }
            
            average = average / (ArrayLenth - 4);
        }
        
        return average;
    }
    
    
    Development

  • PH and Temp controller
    S stingone

    Re: PH and Temp controller with arduino

    Hi everyone... couple of months ago i started working on a PH controller and temp controller. I finally got it working including in Pimatic.

    You can find the whole how-to, part-list and combined sketch in here.

    PH and Temp controller for Pimatic with mysensors (how-to)

    My Project

  • Telephone line switch
    S stingone

    @TheoL said:

    @stingone I think it could be achieved by a relay. I know from the guy from hackaweek at youTube, that there can be peaks of up to 50V on a telephone line. I don't know the amperage, but you can measure that.

    Normaly its arround 40V DC between A and B
    When being called 40V DC + 20 AC 25Hz.
    When the line is open it drops to 10V DC

    Amps is arround 30mA

    Dont know what kind of relay to use to achieving this.

    General Discussion
  • Login

  • Don't have an account? Register

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