Navigation

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

    ThomasDr

    @ThomasDr

    4
    Reputation
    27
    Posts
    639
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Location Berlin / Germany

    ThomasDr Follow

    Best posts made by ThomasDr

    • Burglary and tamper detector for door and window

      Hello,

      I develop for some time sensors for this purpose.
      And I think now I have a variant found.
      The technology is nothing special.
      I simple use a MMA8452 connect to a Mysensors Note.
      The evaluation does the Sketch.
      Here my Sketch:

      /******************************************************************************
      MMA8452Q_Basic.ino
      SFE_MMA8452Q Library Basic Example Sketch
      Jim Lindblom @ SparkFun Electronics
      Original Creation Date: June 3, 2014
      https://github.com/sparkfun/MMA8452_Accelerometer
      
      This sketch uses the SparkFun_MMA8452Q library to initialize the
      accelerometer, and stream values from it.
      
      Development environment specifics:
      	IDE: Arduino 1.0.5
      	Hardware Platform: Arduino Uno
      	
      	**Updated for Arduino 1.6.4 5/2015**
      
      This code is beerware; if you see me (or any other SparkFun employee) at the
      local, and you've found our code helpful, please buy us a round!
      
      Distributed as-is; no warranty is given.
      ******************************************************************************/
      #include <Wire.h> // Must include Wire library for I2C
      #include <SparkFun_MMA8452Q.h> // Includes the SFE_MMA8452Q library
      #include <MySensor.h>  
      #include <Vcc.h>
      
      const float VccMin   = 0.0;           // Minimum expected Vcc level, in Volts.
      const float VccMax   = 5.5;           // Maximum expected Vcc level, in Volts.
      const float VccCorrection = 5.0/5.0;  // Measured Vcc by multimeter divided by reported Vcc
      
      unsigned int countr = 0;
      float peakMax0 = -1000.0;
      float peakMax1 = -1000.0;
      float peakMax2 = -1000.0;
      unsigned long startMillis = 0;
      Vcc vcc(VccCorrection);
      
      #define CHILD_ID_BATT 0
      #define CHILD_ID_MAXX 1
      #define CHILD_ID_MAXY 2
      #define CHILD_ID_MAXZ 3
      
      MySensor gw;
      MyMessage battmsg(CHILD_ID_BATT, V_VOLTAGE);
      MyMessage maxxmsg(CHILD_ID_MAXX, V_LEVEL);
      MyMessage maxymsg(CHILD_ID_MAXY, V_LEVEL);
      MyMessage maxzmsg(CHILD_ID_MAXZ, V_LEVEL);
      
      
      MMA8452Q accel;
      
      void setup()
      {
        Serial.begin(115200);
        accel.init(SCALE_2G, ODR_800);
        gw.begin(NULL, AUTO, true);
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("MMA8452", "1.0");
      
        // Register all sensors to gateway (they will be created as child devices)
        gw.present(CHILD_ID_BATT, S_POWER);
        gw.present(CHILD_ID_MAXX, S_VIBRATION);
        gw.present(CHILD_ID_MAXY, S_VIBRATION);
        gw.present(CHILD_ID_MAXZ, S_VIBRATION);
      }
      
      void loop()
      {     
             countr = 0;
             float peakToPeak0 = 0.0;   // peak-to-peak level
             float peakToPeak1 = 0.0;   // peak-to-peak level
             float peakToPeak2 = 0.0;   // peak-to-peak level
             
             float signalMax0 = -100.0000;
             float signalMin0 = 100.0000;
             float signalMax1 = -100.0;
             float signalMin1 = 100.0;
             float signalMax2 = -100.0;
             float signalMin2 = 100.0;
           
             
             while (countr < 20)
                 {
                  gw.process();
                if (accel.available())
                   {
                    accel.read();
                    delay(2);
                    double accxx = accel.cx;
                    double accyy = accel.cy;
                    double acczz = accel.cz;
                       //--------------------------------------------------
                       if (accxx > signalMax0)
                        {
                           signalMax0 = accxx;  // save just the max levels
                        }
                       if (accxx < signalMin0)
                        {
                           signalMin0 = accxx;  // save just the min levels
                        }
                       //--------------------------------------------------
                       if (accyy > signalMax1)
                        {
                           signalMax1 = accyy;  // save just the max levels
                        }
                        
                       if (accyy < signalMin1)
                        {
                           signalMin1 = accyy;  // save just the min levels
                        }
                       //-------------------------------------------------
                       if (acczz > signalMax2)
                        {
                          signalMax2 = acczz;  // save just the max levels
                        }
                        
                       if (acczz < signalMin2)
                        {
                          signalMin2 = acczz;  // save just the min levels
                        }
                        countr = countr + 1;
                   }
               }
                   //------------------------------------------------------
                   peakToPeak0 = signalMax0 - signalMin0;
                   peakToPeak1 = signalMax1 - signalMin1;
                   peakToPeak2 = signalMax2 - signalMin2;
                   //-----------------------------------------------------
                   //------------------------------------------------------
                   if (peakToPeak0 > peakMax0)
                   {
                      peakMax0 = peakToPeak0;  // save just the max levels
                   }
                   if (peakToPeak1 > peakMax1)
                   {
                      peakMax1 = peakToPeak1;  // save just the max levels
                   }
                   if (peakToPeak2 > peakMax2)
                   {
                      peakMax2 = peakToPeak2;  // save just the max levels
                   }
                   //-----------------------------------------------------
                   
       if (millis() > startMillis)
       {
       float v = vcc.Read_Volts();
        gw.send(battmsg.set(v,2));
        gw.send(maxxmsg.set(peakMax0,4));
        gw.send(maxymsg.set(peakMax1,4));
        gw.send(maxzmsg.set(peakMax2,4));
        
       peakMax0 = -1.0;
       peakMax1 = -1.0;
       peakMax2 = -1.0;
       startMillis= millis() + 15000;
       }
       
      }
      

      Improvements and suggestions are welcome.

      regards
      Thomas

      posted in My Project
      ThomasDr
      ThomasDr
    • RE: No reconnect after power down.

      Hello,

      I think you were right, I had tried it without a cap, it worked, but it works better with cap.

      regards
      Thomas

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • RE: Error after upload new sketch.

      Hello,

      I think I have found the error.
      I use a 15sec. loop in the sketch and i thing a intern watchdog reset the Node.

      regards
      Thomas

      posted in Troubleshooting
      ThomasDr
      ThomasDr

    Latest posts made by ThomasDr

    • RE: WiFi Gateway (ESP8266) - reconnect to wifi router

      Hello,

      i try to build new Gateway for my Problem and Upload the same sketch, but the new Gateway do not connect to the router. I reminded the China NodeMCU have problems with Serial.begin and with WIFI.beginn. It need a delay after.
      I found the WIFI.begin in the "MyGatewayTransportEthernet.cpp" file and see a wait(500). See my last post wait/delay, so I changed from wait to delay and the Gateway connect.
      If you can try to change it too or change from 500 to 1000.
      But i use the 2.2.0 dev.

      regards
      Thomas

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • RE: WiFi Gateway (ESP8266) - reconnect to wifi router

      Hello,

      The NodeMCU looks like my.
      and your ESP8266 Arduino version?
      maybe there is a new version.
      What Router or Access Point do you use?

      regards
      ThomasD

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • RE: WiFi Gateway (ESP8266) - reconnect to wifi router

      @pihome Hello,

      and what type of ESP8266 you have?
      Can you try a other one?
      I have some NodeMCU V0.9 with TCP and UDP in client mode with AVM Router and Repeater.
      Without problems.

      regards
      ThomasD

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • RE: WiFi Gateway (ESP8266) - reconnect to controller

      Hello,

      there is a possibility to check the connection.
      I will test with receive command from controller to the gateway and write a timeout to reset the ESP with ESP.reset or ESP.restart.

      regards
      ThomasD

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • RE: WiFi Gateway (ESP8266) - reconnect to wifi router

      Hello,

      do you use only the Gateway Code or is there anybody else in your code?
      If you do anybody else you need delays in the code.
      I think the Arduino "delay()" not the "wait()".
      Wait do Mysensors things.
      Delay do WIFI things.

      regards
      ThomasDr

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • WiFi Gateway (ESP8266) - reconnect to controller

      Hello,

      in contrast to the topic "WiFi Gateway (ESP8266) - reconnect to Router", I have the problem with reconnecting to the controller.
      The Gateway is made of the nodeMCU V0.9 and the NRF24L01+ in TCP Client Mode.
      I try to reboot the Router, the Gateway connects easily, switch the AP, also no problem. Restart the Controller. But the Gateway does not reconnect.
      After rebooting the Gateway the connection stays immediately.
      Is there a solution for this?

      regards
      ThomasDr

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • RE: Connenct a RS485 Network to a NodeMCU Gateway?

      @rejoe2
      I'm assuming the Wifi is the best solution, but if RF868 would be better I'll look at it again.

      I also have a couple Xbee module Series 1, could you start something else?

      Perhaps also an idea add Xbee to the Mysensor API.

      regards
      ThomasD

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • RE: Connenct a RS485 Network to a NodeMCU Gateway?

      @rejoe2 said in Connenct a RS485 Network to a NodeMCU Gateway?:

      Just some guesses:

      Btw: What is your motivation to build a wired network and then connect the whole thing wirelessly to your controller? (I personally try to get rid of all RF transmissions, so this is why I use RS485 as preferred transport layer and connect the whole thing via USB...)

      Hello,

      i will build a few Sensors in the yard and i thing the best way to connect these Sensor Array to the Controller is WIFI.

      regards
      ThomasD

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • Connenct a RS485 Network to a NodeMCU Gateway?

      Hello,

      where connect the Pins DI, DE, RE, RO on the NodeMCU?
      And how do I define the pins in the sketch?

      regards
      ThomasD

      posted in Troubleshooting
      ThomasDr
      ThomasDr
    • RE: Doubt about a concept in GatewayESP8266

      Hello,

      i send a command at git, can any one test this fix?

      regards
      ThomasD

      posted in Troubleshooting
      ThomasDr
      ThomasDr