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
C

Crumpy10

@Crumpy10
Unfollow Follow
About
Posts
21
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Best 3d printers
    C Crumpy10
    Enclosures / 3D Printing

    Ok, so I got my hands on an Ender3 printer. So far so good, very impressed for the price. But could someone tell me what causes this?0_1564479120229_96D400A1-4B43-462F-8160-F1A376C13888.jpeg


  • Best 3d printers
    C Crumpy10
    Enclosures / 3D Printing

    Thanks everyone, good advice. A bit of trial and error learning, with a vertical learning curve...
    Looks like I may go for either the Creality CR10 or the Ender 3, then have a play printing some existing items to see whats possible before I do my own designs.


  • Best 3d printers
    C Crumpy10
    Enclosures / 3D Printing

    Well, I didnt think this post would get so popular! but thats great, have learnt a lot just by looking suggested things up.

    So, Software....

    I am thinking of using sketchup as I already use this quite a bit for different projects and can find my way around it well.
    Has anyone else used it and think there is better? Preferably free or open source...

    What's everyone's preference?


  • Best 3d printers
    C Crumpy10
    Enclosures / 3D Printing

    All great advice everyone, thanks for the input!


  • Having trouble with LastUpdate
    C Crumpy10
    OpenHAB

    Update -:
    Stop the bus, just found a solution!
    For anyone else searching I changed this in the sitemap

    Text item=LastUpdate01 label="Last seen [%1$tA, %1$td/%1$tm/%1$tY %1$tH:%1$tM]" icon="network"
    

    Works perfect now!


  • Having trouble with LastUpdate
    C Crumpy10
    OpenHAB

    Hi Everyone,
    I am having trouble getting 'Lastupdate' to work.

    I have included

    DateTime LastUpdate01 "Last Update"     { channel="mysensors:multimeter:gateway:multimeter_3_3:lastupdate" }
    

    in my items file.

    I am seeing this in Openhab Log

    2019-06-11 19:28:46.275 [vent.ItemStateChangedEvent] - LastUpdate01 changed from 2019-06-11T19:12:52.000+1200 to 2019-06-11T19:28:46.000+1200
    

    Added this to my sitemap

    Text item=LastUpdate01 label="Last seen" icon="network"
    

    But no data is being displayed in my sitemap?
    What have I done wrong this time??
    Thanks for any advice.


  • Why are my nodes either all Online or all Offline?
    C Crumpy10
    OpenHAB

    @fredswed Hi, did you ever get this sorted out? I am facing the same issue and cant find out whats going on.


  • Best 3d printers
    C Crumpy10
    Enclosures / 3D Printing

    Thanks for the response. All good points that I will investigate. I am happy with the engineering (avionics Eng by trade) etc
    At the moment I am looking at the Ender 3 pro but still researching.
    Cheers


  • Best 3d printers
    C Crumpy10
    Enclosures / 3D Printing

    Ok I am thinking of getting a 3d printer but do not know where to start and what to stay clear of!
    What's everyone using in the way of printer and software?
    Any advice greatly appreciated!


  • Battery Tank level node and Openhab
    C Crumpy10
    OpenHAB

    @bgunnarb thanks for the reply. That’s what I thought, that the battery monitor is included in the library. I just don’t know how that part gets the info through to openHAB. I am using the Ethernet gateway by the way. I have managed to get the info through using the multimeter function but I think there is a better way for battery level!


  • Battery Tank level node and Openhab
    C Crumpy10
    OpenHAB

    @dbemowsk Hi, Thanks for the reply. I am very new to Mysensors and not a programmer. I think the sendbatteryLevel is part of the included libraries but not fully sure. I am seeing both voltage and percent in the serial monitor but just cant work out how to send it through the gateway to the controller (openhab). I just cant work out what extra I need in the sketch to do this?


  • Battery Tank level node and Openhab
    C Crumpy10
    OpenHAB

    Hi All,
    I am a bit confused again (its not hard..) I am trying to combine a previous sketch from @Boots33 with battery reporting to openhab. The tank sketch works great (Thanks Boots!) but I can not figure out how to send the battery level. Here is my adapted sketch-:

    /*
      Sketch to read level of water in a round tank and  then send data back to controller
      uses MySensors V2 .
    
      Libraries used
      MySensors          https://www.mysensors.org/
      NewPing            https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home
      SPI                 installed with arduino IDE
    
    */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    // Enabled repeater feature for this node
    //#define MY_REPEATER_FEATURE
    
    //#define MY_RF24_CHANNEL 84    // channel of nrf network
    
    #include <MySensors.h>
    #include <SPI.h>
    #include <NewPing.h>
    
    #define MY_NODE_ID 3    // comment out this line if you use dynamic id's
    #define CHILD_ID_WATER 1
    #define CHILD_ID_PERCENT 2
    
    
    // newping settings
    #define TRIGGER_PIN  6                  // Arduino pin 6 connected to trigger pin on the ultrasonic sensor.
    #define ECHO_PIN     7                  // Arduino pin 7 connected to echo pin on the ultrasonic sensor.
    #define MAX_DISTANCE 240                // Maximum distance we want to ping for (in centimeters). you should set this to be 
    // a bit more than fullHeight + sensHeight.
    
    /*------change these to suit your tank setup-----*/
    const int tankRad = 170;                // Radius of tank in cm
    const int fullHeight = 198;             // Height of water when tank full in cm
    const int sensHeight = 30;              // height of sensor above full water mark in cm
    const int outletHeight = 7;             // height of water when tank reading will show empty in cm
    /*----------------------------------------------*/
    
    int BATTERY_SENSE_PIN = A0;             // select the input pin for the battery sense point
    int oldBatteryPcnt = 0;
    unsigned long lastSent;
    unsigned long heartbeatDelay = 15;     // how often the heartbeat will be sent, in minutes
    //unsigned long lastHeartbeat = millis(); // holder for last time heartbeat was sent
    uint32_t SLEEP_TIME = 10000;           // 900000=15 mins sleep time between reads (seconds * 1000 milliseconds)
    unsigned long pingHeight;               // holds total height from ultrasonic sender to current water height
    unsigned int waterAvail;                // holds current water available in litres
    
    byte oldWaterPercent;
    byte waterPercent = 0 ;                 // used to hold the tank water level percentage
    
    // NewPing setup of pins and maximum distance.
    NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
    
    MyMessage msgVolume(CHILD_ID_WATER, V_LEVEL);              // water available in litres
    MyMessage msgPercent(CHILD_ID_PERCENT, V_LEVEL);           // water percentsge available
    
    void setup() {
    
      pinMode(5, OUTPUT);
      analogReference(INTERNAL);
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Tank Level", "1.4");
    
      // Register all sensors to gateway (they will be created as child devices)
      present(CHILD_ID_WATER, S_DUST, "Water Available");
      present(CHILD_ID_PERCENT, S_DUST, "Water Percentage Available");
    }
    
    
    void loop()
    {
    // get the battery Voltage
    int sensorValue = analogRead(BATTERY_SENSE_PIN);
    #ifdef MY_DEBUG
    Serial.println(sensorValue);
    #endif
    
    // 1M, 470K divider across battery and using internal ADC ref of 1.1V
    // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
    // ((2.2e6+330e3)/330e3)*1.1 = Vmax = 8.4 Volts
    // 8.4/1023 = Volts per bit = 0.001075275
    
    int batteryPcnt = sensorValue / 10;
    
    #ifdef MY_DEBUG
    //float batteryV  = sensorValue * 0.001075275;
    float batteryV = sensorValue * 9.17 / 1023;
    
    Serial.print("Battery Voltage: ");
    Serial.print(batteryV);
    Serial.println(" V");
    
    Serial.print("Battery percent: ");
    Serial.print(batteryPcnt);
    Serial.println(" %");
    #endif
    
    if (oldBatteryPcnt != batteryPcnt) {
      // Power up radio after sleep
      sendBatteryLevel(batteryPcnt);
      oldBatteryPcnt = batteryPcnt;
    }
    {
      Serial.println("Waking out of sleep");
      digitalWrite(5, HIGH);
      Serial.println("Ultrasonic module ON");
      delay (1000);
    
      data_calc();      // perform calculations to get water remaining etc.
    
    
      if (oldWaterPercent != waterPercent) {        //check to see if new water data is available
        send(msgVolume.set(waterAvail));
        send(msgPercent.set(waterPercent));
        oldWaterPercent = waterPercent;
        lastSent = millis();
      }
    
      heartbeatCheck();                                    // call heartbeat function
      digitalWrite(5, LOW);
      Serial.println("Ultrasonic module OFF");
    
      Serial.println("Entering Sleep");
      sleep(SLEEP_TIME);
    
    }
    }
    /*-------------------------start of functions-------------------*/
    
    void heartbeatCheck() {
      unsigned long millisNow = millis();           // get the current time
      if ((millisNow - lastSent) > (heartbeatDelay * 60000)) {
        send(msgVolume.set(waterAvail));
        send(msgPercent.set(waterPercent));
        lastSent = millisNow;
      }
    
      /*if ((millisNow - lastHeartbeat) > (heartbeatDelay*60000)) {
        sendHeartbeat();
        wait(5);
        // sendBatteryLevel(100);
        lastHeartbeat = millis();
        #ifdef MY_DEBUG
          Serial.println("Heartbeat Sent" );
        #endif
        } */
    }
    
    void data_calc() {
      pingHeight = sonar.ping_median(5);             //- Do multiple (5) pings and return median
      pingHeight = sonar.convert_cm(pingHeight);     // then convert to cm
    #ifdef MY_DEBUG
      Serial.print("Ping Height raw in cm: ");
      Serial.println(pingHeight);
    #endif
      pingHeight  = constrain(pingHeight, sensHeight, (fullHeight - outletHeight) + sensHeight); // keep pingHeight within the expected values
      waterPercent = map(pingHeight, sensHeight, (fullHeight - outletHeight) + sensHeight, 100, 0);   // calculate the percentage of water available
      waterAvail = PI * pow(tankRad, 2) * (((fullHeight - outletHeight) + sensHeight) - pingHeight) / 1000; // calculate water available in litres
    
      // Write some debug info
    #ifdef MY_DEBUG
      Serial.print("Ping Height constrained in cm: ");
      Serial.println(pingHeight);
      Serial.print("Percentage Available: ");
      Serial.println(waterPercent);
      Serial.print("Litres Available: ");
      Serial.println(waterAvail);
    #endif
    }
    

    I am trying to figure out how the sketch sends the battery info to openhab and how I view it. Any tips or pointers would be most appreciated. Do I have to add another line in the void presentation for the voltage? And should Openhab discover the voltage data as another Thing?

    Cheers
    Crumpy


  • Monitoring 2 x 18650 batteries
    C Crumpy10
    Troubleshooting

    @electrik Not sure what it would be at 8.4v because that would be two fully charged 18650's and the two I have on test are currently giving 7.80v on the multimeter and returning about 870 on the serial monitor, reporting battery at 0.94v and 86%

    I would need to fully recharge two batteries later to tell what the max would be.


  • Monitoring 2 x 18650 batteries
    C Crumpy10
    Troubleshooting

    @mfalkvidd been there already but thanks.


  • Monitoring 2 x 18650 batteries
    C Crumpy10
    Troubleshooting

    @electrik Hi, the 2.2Meg is connected to the battery and the 330k is connected to GND.

    Cheers


  • Monitoring 2 x 18650 batteries
    C Crumpy10
    Troubleshooting

    @mfalkvidd Well thanks for looking at it, at least my maths is still working ok! Perhaps someone else may know whats going on...

    The strange thing is if I use this line-:

    float batteryV = sensorValue * 8.6 / 1023;
    

    I can get close. I found another thread where @TimO was using 7.2v with this in his sketch-:

    float batteryV = sensorValue * 6.1 / 1023;
    

    So I just increased the 6.1 slowly until my read value was close to my multimeter voltage. But I dont understand what the 6.1 in this line of code is doing, or where it comes from...


  • Monitoring 2 x 18650 batteries
    C Crumpy10
    Troubleshooting

    @mfalkvidd I have left the analogReference as it was in the original like this-:

    void setup()
    {
    	// use the 1.1 V internal reference
    #if defined(__AVR_ATmega2560__)
    	analogReference(INTERNAL1V1);
    #else
    	analogReference(INTERNAL);
    #endif
    }
    
    void presentation()
    {
    	// Send the sketch version information to the gateway and Controller
    	sendSketchInfo("Battery Meter", "1.0");
    }
    

    Just for learning about battery monitoring, I am using a Nano with two 18650's in series to power it. in my final project I will be using a Pro Mini. Unfortunately the ultrasonic sensor I need to use is a 5v sensor and needs a good supply. Hence learning about monitoring the 18650's.
    Cheers.

    Thanks for the reply.


  • Monitoring 2 x 18650 batteries
    C Crumpy10
    Troubleshooting

    Hi Guys,

    I have been playing around with the Battery Powered Sensor sketch, trying to get it to report correctly the level of 2x 18650 batteries. I am not a programmer and am getting a bit lost with the sketch. I have a voltage divider of 2.2Meg and 330K, So in my calculations 2 x 18650 batteries give me a max voltage of 8.4vdc fully charged, therefore with that divider Vout should be 1.096vdc or around that. So I have calculated that my Vmax is 1.100007332 and my Volts per bit for the sketch should be 0.001075275.
    But when I run the sketch I am getting around 1vdc on the serial monitor, when the voltmeter is reading 7.90vdc

    Heres the Loop part of my sketch, can some one point out my mistakes please?

    void loop()
    {
    	// get the battery Voltage
    	int sensorValue = analogRead(BATTERY_SENSE_PIN);
    #ifdef MY_DEBUG
    	Serial.println(sensorValue);
    #endif
    
    	// 1M, 470K divider across battery and using internal ADC ref of 1.1V
    	// Sense point is bypassed with 0.1 uF cap to reduce noise at that point
    	// ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
    	// 3.44/1023 = Volts per bit = 0.003363075
    
    	int batteryPcnt = sensorValue / 10;
    
    #ifdef MY_DEBUG
    	float batteryV  = sensorValue * 0.001075275;
     
    	Serial.print("Battery Voltage: ");
    	Serial.print(batteryV);
    	Serial.println(" V");
    
    	Serial.print("Battery percent: ");
    	Serial.print(batteryPcnt);
    	Serial.println(" %");
    #endif
    
    	if (oldBatteryPcnt != batteryPcnt) {
    		// Power up radio after sleep
    		sendBatteryLevel(batteryPcnt);
    		oldBatteryPcnt = batteryPcnt;
    	}
    	sleep(SLEEP_TIME);
    }
    

    Thanks


  • General questions on first GW and sensor setup
    C Crumpy10
    OpenHAB

    @TimO ,
    Thanks for the reply.

    OK So if I can use a mixture of either self discovery and files thats fine BUT as soon as I un-comment the sensors in mysensors.items the thing sensors double up in Openhab? See below?
    0_1556605808643_73ce56b6-6749-4d1b-b234-301b9f1bbd71-image.png

    Openhab discovered the highlighted sensors (only after I reset the sensor node!) and then when I ticked the discovered sensors it added the extra two sensors not highlighted?!? Weird as I have only one DHT11 sensor... Any ideas whats going on?

    I started out this evening by deleting the sensors and the gateway in openhab, restarted openhab. I then added the gateway, reset the node which added the 4 things.
    Now I am getting data on the sitemap for the first time! Eh.....
    Should I have each sensor doubled up then? and I didnt link any channels either....

    Now I am confused...
    :thinking_face:


  • Minimum sketch requirement for OpenHAB discovery to work
    C Crumpy10
    OpenHAB

    @pavel-hrudka I know this is quite an old post but I discovered tonight that when openHAB would not discover my node, I hit reset on the node and openHAB discovered the sensor when it restarted and contacted the GW. May help someone in the future!

  • Login

  • Don't have an account? Register

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