Navigation

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

    Oleg Greengo

    @Oleg Greengo

    4
    Reputation
    9
    Posts
    696
    Profile views
    0
    Followers
    1
    Following
    Joined Last Online
    Website devicter.ru Location Russia, Novosibirsk

    Oleg Greengo Follow

    Best posts made by Oleg Greengo

    • RE: devDuino Sensor Node V1.3 (ATmega 328)

      I will add all the information will understand only how to do it right on your site. Thank you.

      posted in OpenHardware.io
      Oleg Greengo
      Oleg Greengo
    • RE: DevDuino v2.2 with EEPROM

      Try it this way

      #include <SPI.h>
      #include <MySensor.h>
      #include <MyTransportNRF24.h>
      #include <Vcc.h>

      const float VccMin = 2.00.6; // Minimum expected Vcc level, in Volts. Example for 2xAA Alkaline.
      const float VccMax = 2.0
      1.5; // Maximum expected Vcc level, in Volts. Example for 2xAA Alkaline.
      const float VccCorrection = 3.07/3.04; // Measured Vcc by multimeter divided by reported Vcc

      Vcc vcc(VccCorrection);

      int TEMP_SENSE_PIN = A3; // select the input pin for the battery sense point
      float TEMP_SENSE_OFFSET = -0.01;

      #define CHILD_ID_TEMP 0

      //MySensor gw (8,7);
      MyTransportNRF24 transport(7, 6);
      MySensor gw(transport);

      posted in Hardware
      Oleg Greengo
      Oleg Greengo

    Latest posts made by Oleg Greengo

    • RE: [SOLVED] Wifi gateway crashing ~20min

      Hello everybody.
      Today I started testing a bundle of ESP - MQTT version lib Mysensors 2.2.0 | 0x020200FF | final
      I ran the stress test and after 5 minutes of requests, the ESP drops down.

      I changed 3 times all equipment
      As MQTT, I used different services, but the result is always the same.

      Is this the problem in the chip ESP8266?

      This problem was associated with sockets on ESP and was voiced a year and a half ago, but it seems that neither has changed.

      Maybe I missed something, if there are answers, please tell me how to fix this error.

      58002998 Sending message on topic: gateway-1870439-out/2/0/1/0/2
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      58008004 TSF:MSG:READ,2-2-0,s=1,c=2,t=38,pt=0,l=0,sg=0:
      58008009 Sending message on topic: gateway-1870439-out/2/1/2/0/38
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      58013017 TSF:MSG:SEND,0-0-2-2,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:220
      ***************
      58013024 TSF:MSG:READ,2-2-0,s=1,c=1,t=39,pt=7,l=5,sg=0:2.99
      58013030 Sending message on topic: gateway-1870439-out/2/1/1/0/39
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      58018037 TSF:MSG:READ,2-2-0,s=1,c=1,t=38,pt=7,l=5,sg=0:220
      58018042 TSF:MSG:ACK
      58018044 Sending message on topic: gateway-1870439-out/2/1/1/1/38
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      LmacRxBlk:1
      IP: 192.168.0.15
      58023051 Attempting MQTT connection...
      58023400 MQTT connected
      
      posted in Troubleshooting
      Oleg Greengo
      Oleg Greengo
    • RE: 💬 Building a WiFi Gateway using ESP8266

      Colleagues, tell me.
      can I make it so that hosts register on the gateway only if I press a button on the gateway?

      Perhaps there is an example?

      posted in Announcements
      Oleg Greengo
      Oleg Greengo
    • RE: Error compiling for Arduino / Energy Monitor Shield

      @Christian-Wilhelm

      #include <Time.h>
      #include <LCD5110_Graph_SPI.h>

      add them to your library
      C:\Program Files\Arduino\libraries

      posted in Troubleshooting
      Oleg Greengo
      Oleg Greengo
    • RE: Error compiling for Arduino / Energy Monitor Shield

      @Christian-Wilhelm
      try this sketch

      
      /*
      This sketch is for a Energy Monitor v 1.0 
      http://www.elecrow.com/cooperated-designers/devicter/energy-monitor-shield-p-835.html
      
      and MySensors 2.0
      https://www.mysensors.org/
      
       modified
       17 Oct 2016
       by greengo
       */
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      
      #define MY_NODE_ID       AUTO
      
      #define SKETCH_NAME "Energy Monitor v1.0"
      #define SKETCH_VERSION "2.0.0"
      
      // Enable repeater functionality for this node
      #define MY_REPEATER_FEATURE
      
      #define MY_RF24_CHANNEL 76
      
      // Connected we have to move CE/CSN pins for NRF radio
      #define MY_RF24_CE_PIN   7
      #define MY_RF24_CS_PIN   8
      
      #include <SPI.h>
      #include <MySensors.h>
      #include "EmonLib.h"
      #include <Time.h>
      #include <LCD5110_Graph_SPI.h>
      
      LCD5110 myGLCD(5,6,3);
      //extern unsigned char SmallFont[];
      extern uint8_t SmallFont[];
      
      #define WINDOW 15
      
      // How many milli seconds between each measurement
      #define MEASURE_INTERVAL    1000 //for 1 sec
      
      // FORCE_TRANSMIT_INTERVAL, this number of times of wakeup, the sensor is forced to report all values to the controller
      #define FORCE_TRANSMIT_INTERVAL 600 //every 10 min
      
      unsigned long SLEEP_TIME = 1000; // Sleep time between reads (in milliseconds)
      
      int TEMP_TRANSMIT_THRESHOLD = 0; //~3-5 Watt
      
      #define CHILD_ID_POWER 0
      #define CHILD_ID_FLOATING_CUR_SENSOR 1 //floating sensor
      
      EnergyMonitor emon;
      
      unsigned long CHECK_TIME = millis();
      
      MyMessage IrmsMsg(CHILD_ID_POWER, V_WATT);
      MyMessage kWhMsg(CHILD_ID_POWER, V_KWH);
      MyMessage FloatingMsg(CHILD_ID_FLOATING_CUR_SENSOR, V_VAR1);
      
      // Global settings
      int measureCount = 0;
      boolean transmission_occured = false;
      
      boolean timeReceived = false;
      unsigned long lastUpdate = 0, lastRequest = 0;
      
      // Storage of old measurements
      double realWatt = 0;
      float realkWt = 0;
      double Irms;
      float lastIrms = 0;
      int Floating;
      float PMin = 99;
      float PMax = 0;
      
      int stateFloating = 0;
      
      long wattsum  = 0;
      long wattsumS = 0;
      //int seconds   = 0;
      double wh     = 0;
      double kwh    = 0;
      double whS    = 0;
      double kwhS   = 0;
      
      void setup()  
      { 
       double cIrms = 0;  
         emon.current(0, 11.0);        // Current: input pin, calibration.
      
       double Irms[WINDOW];   
               Irms[0] = emon.calcIrms(1480); // первое значение при измерении явно "кривое"
        //    Serial.println("calculate delta");
            for (int i=0; i<WINDOW; i++) {
              Irms[i] = emon.calcIrms(1480);
           cIrms = cIrms + Irms[i];
              delay(100);      
            } 
            
      sendPowerMeasurements(true);
        wait(500);
        
        //request Time
        requestTime();
        
        myGLCD.InitLCD();
        myGLCD.setFont(SmallFont);
      }
      
      void presentation()  
      {   
      // Send the sketch version information to the gateway and Controller
        
        sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_POWER, S_POWER, "POWER");
      //present(CHILD_ID_POWER_COUNTER, S_CUSTOM, "COUNTER");
        present(CHILD_ID_FLOATING_CUR_SENSOR, S_CUSTOM, "Float");
      }
      
      // This is called when a new time value was received
      void receiveTime(unsigned long time) {
        Serial.print("Time value received: ");
        Serial.println(time);
        // Ok, set incoming time
        setTime(time);
        timeReceived = true;
      }
      
      void loop()      
      {       
         unsigned long now = millis();
      
        // If no time has been received yet, request it every 10 second from controller
        // When time has been received, request update every hour
        if ((!timeReceived && now - lastRequest > (unsigned long)10 * 1000)
            || (timeReceived && now - lastRequest > (unsigned long)60 * 1000 * 60)) {
          // Request time from controller.
          Serial.println("Requesting time");
          Serial.println("Time now: ");
          Serial.println(timeReceived);
          wait(300);
          requestTime();
          lastRequest = now;
        }
        //*********************************
         
         displayUpdate();
         
        int HH = hour();
        int MM = minute();
        int SS = second();
         
        unsigned long NOW_TIME = millis();
        
        if(NOW_TIME - CHECK_TIME >= SLEEP_TIME)
        { 
        measureCount ++;
        
          double Irms = emon.calcIrms(1480);  // Calculate Irms only
          realWatt  = (emon.Irms * 220);  // Extract Real Power into variable
          long watt = Irms * 220.0;
          realkWt   = (Irms * 0.220);
      
          wattsum = wattsum + watt;
          wattsumS = wattsumS + watt;
          //   seconds++;
      
      /*
          Serial.print("    Real TIME   =    ");
          Serial.print(hour());
          Serial.print(" : ");
          Serial.print(minute());
          Serial.println();
      */
          // hours KW reading
          if ( (MM >= 59) & (SS >= 59)) {
            wh = wh + wattsum / 3600;
            kwh = wh / 1000;
            send(kWhMsg.set(kwh, 4)); // Send kwh value to gw
      
            wattsum = 0;
            wh = 0;
            //   seconds = 0;
            // end of hourly KW reading
          }
        
          // fixing minimum and maximum values for Nokia
        if ( realkWt > PMax) PMax = realkWt;
        if ( realkWt < PMin &&  realkWt > 0.05) PMin = realkWt;   
        
        
        bool forceTransmit = false;
        transmission_occured = false;
       
        
        if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
          forceTransmit = true; 
          measureCount = 0;
         
            send(kWhMsg.set(kwh, 4)); // Send kwh value to gw 
          
        }
           sendPowerMeasurements(forceTransmit);
         
       // Serial.print(" measureCount: ");
       // Serial.println(measureCount); 
       // Serial.print(" ");
        
             CHECK_TIME = NOW_TIME;
           } 
        }
      
      void sendPowerMeasurements(bool force)
      {
        bool tx = force;       
        
       // Set relay to last known state (using eeprom storage)
        TEMP_TRANSMIT_THRESHOLD = loadState(CHILD_ID_FLOATING_CUR_SENSOR);
        Floating = TEMP_TRANSMIT_THRESHOLD;
      
        //  Serial.print("TEMP_TRANSMIT_THRESHOLD: ");Serial.println(TEMP_TRANSMIT_THRESHOLD);
      
        float diffIrms = abs(lastIrms - realWatt);
      
        //  Serial.print(F("IrmsDiff :"));Serial.println(diffIrms);
      
        if (diffIrms > TEMP_TRANSMIT_THRESHOLD) tx = true;
      
        if (tx) {
          measureCount = 0;
      
          //   Serial.print("Watt: ");Serial.println(realWatt);
        
          send(IrmsMsg.set(realWatt, 1));
      
          lastIrms = realWatt;
          transmission_occured = true;
        }
      /*
        //  Serial.print("seconds : "); Serial.println(seconds);
        Serial.print(" ***************** ");
        Serial.print("wh : "); Serial.println(wh);
        Serial.print(" ");
        Serial.print("kwhS : "); Serial.println(kwhS, 4);
        Serial.print(" ***************** ");
        Serial.print("wattsum : "); Serial.println(wattsum);
        Serial.print(" ");
        Serial.print("wattsumS : "); Serial.println(wattsumS);
        Serial.print(" ");
        Serial.print("Irms : "); Serial.println(Irms, 4);
        Serial.print(" ");
        Serial.print("kwh : "); Serial.println(kwh, 4);
        Serial.println(" ");
        Serial.print("Watt: "); Serial.println(realWatt);
        Serial.println(" ");
        Serial.print("realkWt : ");Serial.println(realkWt);
      */  
      }  
        // LCD Nokia 
       void displayUpdate()
       {
      // myGLCD.clrScr();
        
       char tbuf[8];
       char sbuf[12];
          
          dtostrf(realWatt,5,2,tbuf);
          sprintf(sbuf, " %s Watt", tbuf);
          myGLCD.print(sbuf, 20, 0);   //от края, высота 
          myGLCD.print("PWR:", 0, 0);   //от края, высота  
            
          dtostrf(Irms,5,2,tbuf);
          sprintf(sbuf, " %s Amp", tbuf);
          myGLCD.print(sbuf, 20, 10);   //от края, высота 
          myGLCD.print("IRM:", 0, 10);   //от края, высота 
          
          dtostrf(PMin,5,2,tbuf);
          sprintf(sbuf, " %s kWt", tbuf);
          myGLCD.print(sbuf, 20, 20);   //от края, высота 
          myGLCD.print("MiN:", 0, 20);   //от края, высота 
          
          dtostrf(PMax,5,2,tbuf);
          sprintf(sbuf, " %s kWt", tbuf);
          myGLCD.print(sbuf, 20, 30);   //от края, высота 
          myGLCD.print("MaX:", 0, 30);   //от края, высота 
          
          dtostrf(Floating,5,2,tbuf);
          sprintf(sbuf, " %s Watt", tbuf);
          myGLCD.print(sbuf, 20, 40);   //от края, высота 
          myGLCD.print("flt:", 0, 40);   //от края, высота 
          
          myGLCD.update();     
      }
      //*********************************************
       void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.isAck()) {
           Serial.println("This is an ack from gateway");
        }
      
        if (message.type == V_VAR1) {
           // Change state
           stateFloating = message.getInt();
       
           // Store state in eeprom
           saveState(CHILD_ID_FLOATING_CUR_SENSOR, stateFloating);
          
           // Write some debug info
           Serial.print("Incoming change for sensor:");
           Serial.print(message.sensor);
           Serial.print(", Delta =: ");
           Serial.println(message.getInt());
         //  Serial.print(", New status: ");
         //  Serial.println(message.getBool());
         } 
       }   ```
      posted in Troubleshooting
      Oleg Greengo
      Oleg Greengo
    • RE: devDuino Sensor Node V1.3 (ATmega 328)

      yes of course, today I will publish many of their projects, be sure to find something 🙂

      posted in OpenHardware.io
      Oleg Greengo
      Oleg Greengo
    • RE: devDuino Sensor Node V1.3 (ATmega 328)

      I will add all the information will understand only how to do it right on your site. Thank you.

      posted in OpenHardware.io
      Oleg Greengo
      Oleg Greengo
    • RE: devDuino Sensor Node V1.3 (ATmega 328)

      I am the designer of the entire product line
      Currently we sell the board from 2013 to seeed

      posted in OpenHardware.io
      Oleg Greengo
      Oleg Greengo
    • RE: DevDuino v2.2 with EEPROM

      Here is the code works with devDuino v2.2
      It shows how all of the sensors on board (via com port)
      and also makes it possible to (expect) to download the firmware over the air. (for example through MYSController)

      /*
      This sketch is for a devDuino SN v2.2 with the support OTA http://www.seeedstudio.com/wiki/DevDuino_Sensor_Node_V2.2_(ATmega_328)
      and MySensors 1.5
      
      For testing all the equipment, press the button D4 when a voltage is applied.
      
      This sketch is a modification of code written
      Version 1.3 - Thomas Bowman Mørch
      for sensor Sensebender Micro
      http://www.mysensors.org/hardware/micro
      
       modified
       18 December 2015
       by greengo
       */
      
      #include <MySensor.h>
      #include <SPI.h>
      #include "utility/SPIFlash.h"
      #include <EEPROM.h>  
      #include <sha204_lib_return_codes.h>
      #include <sha204_library.h>
      
      // Define a static node address, remove if you want auto address assignment
      //#define NODE_ADDRESS   2
      
      #define RELEASE "0.01"
      
      #define TEST_PIN          4 // Button D4
      #define TEMP_SENSE_PIN   A3 // Input pin for the Temp sensor MCP9700
      #define LED_PIN           9  // LED 
      #define ATSHA204_PIN     A2 // ATSHA204A 
      
      const int sha204Pin = ATSHA204_PIN;
      atsha204Class sha204(sha204Pin);
      
      SPIFlash flash(8, 0x1F65);
      
      MyTransportNRF24 transport(7, 6);
      MySensor gw(transport); 
      
      // the setup function runs once when you press reset or power the board
      void setup() {
       
        // initialize digital pin 9 as an output.
        pinMode(LED_PIN, OUTPUT); 
        
        Serial.begin(115200);
        Serial.print(F("devDuino V2.2"));
        Serial.println(RELEASE);
        Serial.flush(); 
       
       // First check if we should boot into test mode
      
        pinMode(TEST_PIN,INPUT);
        digitalWrite(TEST_PIN, HIGH); // Enable pullup
        if (!digitalRead(TEST_PIN)) testMode();
        
        // Make sure that ATSHA204 is not floating
        pinMode(ATSHA204_PIN, INPUT);
        digitalWrite(ATSHA204_PIN, HIGH);
       
        digitalWrite(LED_PIN, HIGH); 
        
      #ifdef NODE_ADDRESS
        gw.begin(NULL, NODE_ADDRESS, false);
      #else
        gw.begin(NULL,AUTO,false);
      #endif  
        
        digitalWrite(LED_PIN, LOW);
        
        Serial.flush();
        Serial.println(F(" - Online!"));
        
        gw.sendSketchInfo("devDuino SN V2.2", RELEASE);   
        
      }
      
      // the loop function runs over and over again forever
      void loop() {
        
        gw.process();
        
      }
      
      /****************************************************
       *
       * Verify all peripherals, and signal via the LED if any problems.
       *
       ****************************************************/
      void testMode()
      {
        uint8_t rx_buffer[SHA204_RSP_SIZE_MAX];
        uint8_t ret_code;
        byte tests = 0;
        
        digitalWrite(LED_PIN, HIGH); // Turn on LED.
        Serial.println(F(" - TestMode"));
        Serial.println(F("Testing peripherals!"));
        Serial.flush();
        Serial.print(F("-> MCP9700 : ")); 
        Serial.flush();
        
        if (analogRead (TEMP_SENSE_PIN),HIGH ) 
        {
          Serial.println(F("ok!"));
          tests ++;
        }
        else
        {
          Serial.println(F("failed!"));
        }
        Serial.flush();
      
        Serial.print(F("-> Flash : "));
        Serial.flush();
        if (flash.initialize())
        {
          Serial.println(F("ok!"));
          tests ++;
        }
        else
        {
          Serial.println(F("failed!"));
        }
        Serial.flush();
      
        
        Serial.print(F("-> SHA204 : "));
        ret_code = sha204.sha204c_wakeup(rx_buffer);
        Serial.flush();
        if (ret_code != SHA204_SUCCESS)
        {
          Serial.print(F("Failed to wake device. Response: ")); Serial.println(ret_code, HEX);
        }
        Serial.flush();
        if (ret_code == SHA204_SUCCESS)
        {
          ret_code = sha204.getSerialNumber(rx_buffer);
          if (ret_code != SHA204_SUCCESS)
          {
            Serial.print(F("Failed to obtain device serial number. Response: ")); Serial.println(ret_code, HEX);
          }
          else
          {
            Serial.print(F("Ok (serial : "));
            for (int i=0; i<9; i++)
            {
              if (rx_buffer[i] < 0x10)
              {
                Serial.print('0'); // Because Serial.print does not 0-pad HEX
              }
              Serial.print(rx_buffer[i], HEX);
            }
            Serial.println(")");
            tests ++;
          }
      
        }
        Serial.flush();
      
        Serial.println(F("Test finished"));
        
        if (tests == 3) 
        {
          Serial.println(F("Selftest ok!"));
          while (1) // Blink OK pattern!
          {
            digitalWrite(LED_PIN, HIGH);
            delay(200);
            digitalWrite(LED_PIN, LOW);
            delay(200);
          }
        }
        else 
        {
          Serial.println(F("----> Selftest failed!"));
          while (1) // Blink FAILED pattern! Rappidly blinking..
          {
          }
        }  
      }
      
      
      posted in Hardware
      Oleg Greengo
      Oleg Greengo
    • RE: DevDuino v2.2 with EEPROM

      Try it this way

      #include <SPI.h>
      #include <MySensor.h>
      #include <MyTransportNRF24.h>
      #include <Vcc.h>

      const float VccMin = 2.00.6; // Minimum expected Vcc level, in Volts. Example for 2xAA Alkaline.
      const float VccMax = 2.0
      1.5; // Maximum expected Vcc level, in Volts. Example for 2xAA Alkaline.
      const float VccCorrection = 3.07/3.04; // Measured Vcc by multimeter divided by reported Vcc

      Vcc vcc(VccCorrection);

      int TEMP_SENSE_PIN = A3; // select the input pin for the battery sense point
      float TEMP_SENSE_OFFSET = -0.01;

      #define CHILD_ID_TEMP 0

      //MySensor gw (8,7);
      MyTransportNRF24 transport(7, 6);
      MySensor gw(transport);

      posted in Hardware
      Oleg Greengo
      Oleg Greengo