Navigation

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

    vorowski

    @vorowski

    0
    Reputation
    11
    Posts
    525
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    vorowski Follow

    Best posts made by vorowski

    This user hasn't posted anything yet.

    Latest posts made by vorowski

    • RE: Inexpensive Differential Pressure to measure Water Flow?

      Try flow-meters for coffermakers.

      Like
      https://www.juraprofi.de/Jura-Ersatzteile/Sensoren-und-Sicherungen/Flowmeter-Durchflussmelder::2901.html

      posted in Hardware
      vorowski
      vorowski
    • RE: A good locking switch/button for "oldschool" mysensor-device control

      http://shop.ezcontrol.de/fernbedienungen/elv-fs20-s6a-6-tasten-aufputz-wandsender/a-10164/

      Would ne neat....not Sure if You Can buy enclosure only though....

      Anybody knows?

      W

      posted in Hardware
      vorowski
      vorowski
    • RE: Double click | Hold for buttons

      https://github.com/mathertel/OneButton
      This is what I use for this.

      posted in General Discussion
      vorowski
      vorowski
    • RE: More then one MAX6675 in one node? ...smoking meat and fish...

      Where do you buy the sensors?

      posted in Troubleshooting
      vorowski
      vorowski
    • RE: Mysensor-ing a Roomba vacuum cleaner.

      this is the code I used....

      /*
       General comments
      This sketch controls a IRobot Roomba via Mysensors
      
      uses the Roomba library from
      http://www.airspayce.com/mikem/arduino/Roomba
      
      Implemented:
      Dock
      Medium clean
      OFF
      Spot clean
      
      
      
      Target functionality:
      Read sensors:
      1 SensorChargingState = 21 (ChargeStateNotCharging = 0, ChargeStateReconditioningCharging = 1, ChargeStateFullChanrging = 2, ChargeStateTrickleCharging = 3, ChargeStateWaiting = 4, ChargeStateFault = 5)
      2 SensorBatteryTemperature = 24
      3 SensorBatteryCharge = 25
      4 SensorBatteryCapacity = 26
      
      Events:
      1 Mode { ModeOff = 0, ModePassive = 1, ModeSafe = 2, ModeFull = 3 
      2. Power mode
      
      Trigger the following commands:
      1 Go to dock (stop) void dock() - Causes roomba to immediately seek the docking station. No equivalent for Create. 
      2 Clean
      3 Maintenance - void drive() - Starts the Roomba driving with a specified wheel velocity and radius of turn 
      4 Play a song :-) -  void playSong  ( uint8_t  songNumber ) 
      5 Spot cleaning - OPT code 134
      
      
      
      hook up radio - remember to switch serial output of MYSENSORS off!
      
      
      ******************************
      | Wire the NRF24L01+ module: |
      ******************************
      Arduino   NRF24L01+   Comment
      GND       GND         Black 
      5VReg     3.3V VCC    Red
      9         CE          Orange
      10        CSN/CS      Yellow 
      13        SCK         Green 
      11        MOSI        Blue 
      12        MISO        Violet 
      2         IRQ         Gray 
       
       */
      
      // 21.02.2016 created by WL
      // ... and NOT working!
      
      
      
      // 05.03.2016 created by WL
      // ... and  working!
      
      //include required libraries****************************************
      //********************************************************************
      
      #include "OneButton.h" // http://www.mathertel.de/Arduino/OneButtonLibrary.aspx
      #include <SPI.h>
      #include <MySensor.h>
      #include <Roomba.h>
      
      //Set Variable *****************************************************
      //******************************************************************
      // Setup a new OneButton on pin A1.  
      OneButton button1(A1, true);
      
      // Setup other variables
      Roomba roomba(&Serial, Roomba::Baud115200); // Defines the Roomba instance and the HardwareSerial it is connected to
      
      // Setup PINs
      const int ledPin1 = 5; //green
      const int ledPin2 = 6; //red
      
      //Pin2 & 3 External interrup / PWM: 3, 5, 6, 9, 10, and 11 / SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK) / LED: 13 / I2C: A4 (SDA) and A5 (SCL) - this applies for Pro Mini & Nano
      
      // Setup other variables
      //Child IDs 
      #define CHILD_ID 0   // Id of the command node
      #define CHILD_ID_1 1   // Id of the battery check node
      #define CHILD_ID_2 2   // Id of the 2nd node
      
      // Setup other variables
      int Roomba1 = 0; // 1 - dock / 2 - clean / 3 - spot / 4 - off
      
      
      //for sensorgetting
      char* ChargeTypes[6] = {
        "Not charging","Reconditioning Charging","Full Charging","Trickle Charging","Waiting","Charging Fault Condition"};
      char* OiTypes[4] = {
        "Off","Passive","Safe","Full"};
      
      int packetSizes[58] = {
        0,0,0,0,0,0, //1-6
        1,1,1,1,1,1,1,1,1,1,1,1, //7-18
        2,2, //19-20
        1, //21
        2,2, //22-23
        1, //24
        2,2,2,2,2,2,2, //25-31
        1, //32
        2, //33
        1,1,1,1,1, //34-38
        2,2,2,2,2,2, //39-44
        1, //45
        2,2,2,2,2,2, //46-51
        1,1, //52-53
        2,2,2,2, //54-57
        1 //58
      };
      
      boolean lowBattery = true; // Acts as a debounce
      long battery_Current_mAh = 0;
      long battery_Total_mAh = 0;
      long battery_percent = 0;
      boolean DeadBattery = false;
      boolean FullBattery = true;
      unsigned long chargingState = 0;
      long voltage = 0;
      long temp = 0;
      long OiMode = 0;
      long ChargeSource = 0;
      boolean firstRun = true; //We don't want it Tweeting when it is getting the current state
      boolean buttonsDown = false;
      long CorrectDockCycles = 0;
      unsigned long cliffStartTime = 0;
      int drivedurationforward = 1000; //value in ms from controller how long to go forward
      int drivedurationback =1000; //value in ms from controller how long to go back
      long sensorfrequency = 30000; // frequency the sensors are read
      long lastsensorread = 0; // when were the sensors read the last time
      
      uint8_t buf[52];
      
      // Initialize Mysensors
      MySensor gw;
      
      // Initialize messages
      MyMessage msg(CHILD_ID, V_VAR1); //Receive commands from controller
      MyMessage msg2(CHILD_ID, V_VAR2); //Receive drivedurationback from controller
      MyMessage msg3(CHILD_ID, V_VAR3); //Receive drivedurationforward from controller
      MyMessage msg4(CHILD_ID, V_VAR4); //Receive sensorfrequency from controller
      
      MyMessage msg1_1(CHILD_ID_1, V_VAR1); //Declare sensor message To send ChargeState
      MyMessage msg1_2(CHILD_ID_1, V_VAR2); //status of Voltage
      MyMessage msg1_3(CHILD_ID_1, V_VAR3); //status of Temperature
      MyMessage msg1_4(CHILD_ID_1, V_VAR4); //status of Charge [%]
      MyMessage msg1_5(CHILD_ID_1, V_VAR5); //status of ChargeSource
      
      MyMessage msg2_1(CHILD_ID_2, V_VAR1); // status of OiMode
      MyMessage msg2_2(CHILD_ID_2, V_VAR2); // status of Status
      //MyMessage msg2_3(CHILD_ID_2, V_VAR3); // status of Status
      //MyMessage msg2_4(CHILD_ID_2, V_VAR4); // status of Status
      MyMessage msg2_5(CHILD_ID_2, V_VAR5); // status of DEBUG
      
      
      // setup code here, to run once************************************
      //*******************************************************************
      void setup() {
      
        roomba.start(); // Starts the Open Interface and sets the mode to Passive. You must send this before sending any other commands. Initialises the serial port to the baud rate given in the constructor
        //Serial.println("Starting the RoombaControlsketch......");
        
           
           // link the button 1 functions.
        button1.attachClick(click1);
        button1.attachDoubleClick(doubleclick1);
      
        /////////////////////////////////////
        // The MySensors library is started// 
        /////////////////////////////////////
        gw.begin(incomingMessage);  // gw.begin(NULL, AUTO, true); // The third argument enables repeater mode - no sleeping for repeaters!
      
        //Send the sensor node sketch version information to the gateway
        gw.sendSketchInfo("ControlmyRoomba", "1.1");
        
        //Present sensors
        gw.present(CHILD_ID, S_CUSTOM); //Your sensor must first present itself to the controller
        gw.present(CHILD_ID_1, S_CUSTOM); //Your sensor must first present itself to the controller
        gw.present(CHILD_ID_2, S_CUSTOM);
        //gw.present(CHILD_ID_3, S_LIGHT);
      
        //Request Data from controller (Setup) - not always required
        gw.request(CHILD_ID, V_VAR2); //request drivedurationback
        gw.request(CHILD_ID, V_VAR3); //request drivedurationforward
        gw.request(CHILD_ID, V_VAR3); //request sensorfrequency
        
       // Setup required PINS
        pinMode(ledPin1, OUTPUT);  // initialize digital ledPin as an output.
        pinMode(ledPin2, OUTPUT);  // initialize digital ledPin as an output.  
        pinMode(13, OUTPUT); 
        // initialize digital pin 13 as an output.
      
        //blink bot hLEDs to indicate setup looped
        digitalWrite(ledPin1, HIGH);
        digitalWrite(ledPin2, HIGH);
        delay(50);
        digitalWrite(ledPin1, LOW);
        digitalWrite(ledPin2, LOW);
        delay(50);
        digitalWrite(ledPin1, HIGH);
        digitalWrite(ledPin2, HIGH);
        delay(50);
        digitalWrite(ledPin1, LOW);
        digitalWrite(ledPin2, LOW);
        delay(1000);
      } // setup
      
      
      // main code here, to run repeatedly:*******************************
      //******************************************************************** 
      void loop() 
      { 
        // keep watching the push buttons:
        button1.tick();
        gw.process();
        if (millis() > lastsensorread + sensorfrequency)
        {
            readsensors();
        }
      
      
        
      } // loop
      
      
      ////////////////////////////////////////////////////////////////////////
      
      //receive data from GW
      void incomingMessage (const MyMessage &message) 
      {
        if (message.sensor == CHILD_ID) 
        { 
          blinkLED(ledPin1);
          if (message.type == V_VAR1) 
          {
            Roomba1 = atoi(message.data); // Roombastatus
            
            if (Roomba1 == 1) 
            {
              roomba.dock(); 
              gw.send(msg2_5.set("received dock"));  // Send info value to gw
              blinkLED(13);
            }
            else if (Roomba1 == 2) {
              Serial.write(135); // medium clean  
              gw.send(msg2_5.set("received medium clean"));  // Send info value to gw
            }
            else if (Roomba1 == 3) {
              roomba.spot(); //if Roomba is in a cleaning mode this will pause the cycle
              gw.send(msg2_5.set("received spot"));  // Send info value to gw
            }
            else if (Roomba1 == 4) {
              Serial.write(133); // Power down
              gw.send(msg2_5.set("received power down"));  // Send info value to gw
            }
            else if (Roomba1 == 5) {
              driveback(); // drive backward
              gw.send(msg2_5.set("drive back"));  // Send info value to gw
            }
            else if (Roomba1 == 6) {
              driveforward(); // drive backward
              gw.send(msg2_5.set("drive forward"));  // Send info value to gw
            }
            else if (Roomba1 == 7) {
              Serial.write(133); // Power down
              gw.send(msg2_5.set("received power down"));  // Send info value to gw
            }
            else if (Roomba1 == 8) {
              Serial.write(133); // Power down
              gw.send(msg2_5.set("received power down"));  // Send info value to gw
            }
            else if (Roomba1 == 9) {
              Serial.write(133); // Power down
              gw.send(msg2_5.set("received power down"));  // Send info value to gw
            }
            else if (Roomba1 == 10) {
              Serial.write(133); // Power down
              gw.send(msg2_5.set("received power down"));  // Send info value to gw
            }
           }
         if (message.type == V_VAR2) 
          {
            drivedurationback = atoi(message.data); // 
            gw.send(msg2_5.set("received drivedurationback"));  // Send info value to gw
          }
         if (message.type == V_VAR3) 
          {
            drivedurationforward = atoi(message.data); // 
            gw.send(msg2_5.set("received ne drivedurationforward"));  // Send info value to gw
          } 
         if (message.type == V_VAR4) 
          {
            sensorfrequency = atoi(message.data); //
            sensorfrequency = 1000*sensorfrequency; 
            gw.send(msg2_5.set("received sensorfrequency"));  // Send info value to gw
          }  
        }
        
      }
      
      
      
      
      
      
      
      // ----- button 1 callback functions/////////////////////////////////////////
      
      // This function will be called when the button1 was pressed 1 time (and no 2. button press followed).
      void click1() {
        //Serial.println("Button 1 click.");
        blinkLED(13);
        roomba.safeMode();
        
         // 2 bytes per note
        uint8_t song[] = {62, 12, 66, 12, 69, 12, 74, 36};
        roomba.song(0, song, 8);
        delay(20);
        roomba.playSong(0);
      
        
        
      
        
        gw.send(msg2_5.set("play song"));  // Send info value to gw
        roomba.start();
        
      
       
      } // click1
      
      
      // This function will be called when the button1 was pressed 2 times in a short timeframe.
      void doubleclick1() {
        readsensors();
        
        
         
      } // doubleclick1
      
      
      
      
      
      
      
      // Function declarations
      //*********************************************************************
      
      //for sensorgetting
      int getPacketSize(int p) {
       return packetSizes[p-1]; 
      }
      int getPacketOffset(int p) {
        int i=0;
        for  (int s=1; s<p; s++) {
          i+=getPacketSize(s);
        }
        return i;
      }
      
      
      
      //read sensors
      void readsensors()
      {
           if (roomba.getSensors(6, buf, 52)) {
      
          int off = 0;
      
          // Battery Checks
          off = getPacketOffset(21);
          chargingState = buf[off+0];
          voltage = buf[off+2]+256*buf[off+1];
          temp = buf[off+5];
          battery_Current_mAh = buf[off+7]+256*buf[off+6];
          battery_Total_mAh = buf[off+9]+256*buf[off+8];
          
          if (battery_Total_mAh == 0) battery_Total_mAh=1;
          int nBatPcent = battery_Current_mAh*100/battery_Total_mAh;
          battery_percent = nBatPcent;
      
          //Oi Mode
          off = getPacketOffset(35);
          OiMode = buf[off+0];
      
          //ChargeSource
          off = getPacketOffset(34);
          ChargeSource = buf[off+0];
          
      
          gw.send(msg2_5.set("charging state"));  // Send info value to gw
          gw.send(msg2_5.set(chargingState));  // Send info value to gw
          gw.send(msg1_1.set(ChargeTypes[chargingState]));  // Send info value to gw
      
          
          gw.send(msg1_2.set(voltage));  // Send info value to gw
          
          
          gw.send(msg1_3.set(temp));  // Send info value to gw
      
          gw.send(msg2_5.set("battery_Current_mAh"));  // Send info value to gw
          gw.send(msg2_5.set(battery_Current_mAh));  // Send info value to gw
          gw.send(msg2_5.set("battery_Total_mAh"));  // Send info value to gw
          gw.send(msg2_5.set(battery_Total_mAh));  // Send info value to gw
          gw.send(msg1_4.set(battery_percent));  // Send info value to gw
          
          gw.send(msg2_1.set(OiTypes[OiMode]));  // Send info value to gw
          gw.send(msg2_2.set(ChargeSource));  // Send info value to gw
          lastsensorread = millis();
          blinkLED(ledPin2);
      
          
      
          
        }
        else{ gw.send(msg2_5.set("roomba is off"));}  // Send info value to gw
      }
      
      
      //Drive backward
      void driveback()
      {
        roomba.safeMode();
        delay(20);
        long drivestart = millis();
        roomba.drive(0xFF38, 0x8000); // Drive straight backwards
        while (millis() < drivestart+drivedurationback){
          gw.send(msg2_5.set("driving"));  // Send info value to gw
          }
        roomba.drive(0, 0); // Stop
        gw.send(msg2_5.set("stopped"));  // Send info value to gw
        roomba.start(); // back topassive mode
      }
      
      //Drive forward
      void driveforward()
      {
        roomba.safeMode();
        delay(20);
        long drivestart = millis();
        roomba.drive(0xc8, 0x8000); // Drive straight forward
        while (millis() < drivestart+drivedurationforward){
          gw.send(msg2_5.set("driving"));  // Send info value to gw
          }
        roomba.drive(0, 0); // Stop
        gw.send(msg2_5.set("stopped"));  // Send info value to gw
        roomba.start(); // back topassive mode
      }
      
      
      
      //blink a specified LED
      
      void blinkLED(int blinkPIN) //ledPinx needs to be specified
      {
        //Serial.print("blink LED ");
        //Serial.println(blinkPIN);
        //Serial.println(""); // move the cursor to the next line
        digitalWrite(blinkPIN, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(100);              // wait for a delay ms
        digitalWrite(blinkPIN, LOW);    // turn the LED off by making the voltage LOW 
        delay(30);
      }
      
      
      
      //roomba.playSong(0); //play song number 0 / OPT Code 141 + 1 data byte
        //roomba.playSong(0); //play song number 0 / OPT Code 141 + 1 data byte
        //roomba.leds(ROOMBA_MASK_LED_NONE, 0, 0); //does something withe LEDs / OPT Code 139 + 3 data bytes
        //roomba.leds(ROOMBA_MASK_LED_1, 100, 255); //this is "dirt detect"
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_1, 100, 0);
        //roomba.leds(ROOMBA_MASK_LED_3, 100, 255); //this is "dirt detect"
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_3, 100, 0);
        //roomba.leds(ROOMBA_MASK_LED_5, 100, 255); //this is dirt detect & dock
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_5, 100, 0);
        //roomba.leds(ROOMBA_MASK_LED_7, 100, 255); //this is spot & dock & dirt detect
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_7, 100, 0);
        //delay(1000);
      
      
      //roomba.playSong(0); //play song number 0 / OPT Code 141 + 1 data byte
        //roomba.playSong(0); //play song number 0 / OPT Code 141 + 1 data byte
        //roomba.leds(ROOMBA_MASK_LED_NONE, 0, 0); //does something withe LEDs / OPT Code 139 + 3 data bytes
        //roomba.leds(ROOMBA_MASK_LED_NONE, 100, 100); // this is the "clean LED"
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_NONE, 100, 0); // this is the "clean LED"
        
        //roomba.leds(ROOMBA_MASK_LED_PLAY, 255, 255); // this is the "clean LED"
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_PLAY, 255, 0);
        
        //roomba.leds(ROOMBA_MASK_LED_4, 100, 255); //this is "dirt detect" 
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_4, 100, 0);
      
        //roomba.leds(ROOMBA_MASK_LED_6, 100, 255);  // this is the "clean LED"
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_6, 100, 0);
        
        //roomba.leds(ROOMBA_MASK_LED_ADVANCE, 100, 255); //this is "!"
        //delay(1000);
        //roomba.leds(ROOMBA_MASK_LED_ADVANCE, 100, 0);
        //delay(1000);
        
      
      posted in My Project
      vorowski
      vorowski
    • RE: Mysensor-ing a Roomba vacuum cleaner.

      I also went down the road with Ir as my main application would be "start cleaning"...but I never got the room a to react with my IR diods....

      posted in My Project
      vorowski
      vorowski
    • RE: Mysensor-ing a Roomba vacuum cleaner.

      Done that as a proof of concept. Can Post the sketch later. Main challenge in my opinion is what you so with Hardware. Having a breadboard (or eben a box) on top of The roomba does not have a high waf....😃

      posted in My Project
      vorowski
      vorowski
    • RE: Parameters and settings

      I usually get parameters from gateway during startup - then you can influence certain values through gateway and no need to change sketch.....

      posted in Development
      vorowski
      vorowski
    • RE: mqtt via cloud

      Up......

      posted in My Project
      vorowski
      vorowski
    • mqtt via cloud

      Hi,

      I habe at The moment:
      Running fhem installation with mysensors (wifi gateway) on rpi
      Mosquitto running on same rpi

      What I would like to achieve:
      EspMqttGateway in a totally different location
      Connection to cloudmqtt (similar) which sends sensor data to my existing fhem installation via my local mosquitto broker

      Anyone has something similar running, any thought on this?

      W

      posted in My Project
      vorowski
      vorowski