Navigation

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

    kolaf

    @kolaf

    Hero Member

    22
    Reputation
    208
    Posts
    1928
    Profile views
    4
    Followers
    1
    Following
    Joined Last Online

    kolaf Follow
    Hero Member

    Best posts made by kolaf

    • RE: Testing development branch with RF69HW is not working as it should

      I'm afraid we might be fighting two different problems. But anyway, we've made some breakthrough on my problems :-). It appears to be related to the radio having trouble to catch the entire first packet after waking from standby. It seems to work better when waking from sleep. If you check my last post in this thread https://lowpowerlab.com/forum/index.php/topic,1821.msg13160.html#msg13160 you can see what I have done to change the idle behaviour for the radio. The node is now able to process acknowledgements to all the messages it sends. There are still some issues, but for me this is a great improvement.

      Following from this I have patched my copy of the MySensors development branch with the latest RFM69 library with my small patch. I also did a small change to the RFMTransport to change when/how it sends acknowledgements to messages in transportReceive. I have run a gateway and energy meter sensor since last night (around 14 hours) and the communication has worked flawlessly for that period. This is the first in a very long time 🙂

      posted in Troubleshooting
      kolaf
      kolaf
    • Hacking a water timer

      We have a bunch of horses and we need to fill the water troughs several times a day. Trouble is, we sometimes forget to turn off the water which results in 100 m² of wet wood shavings that have to be shovelled out and replaced. In an effort to fix this I bought a water timer from our local cheap things shop. Unfortunately this was designed to water plants with the only possible settings on, off, and turn on for X minutes every Y hours. It was cheap, though, so I bought it thinking that I could hack it. It turned out that I was not able to control the motor inside the unit directly, but I could manipulate the input signals for the on-board microprocessor. By using a relay and shorting two different circuits I could turn the water on and off digitally 🙂

      Add a button, a LED, some environmental sensors because why not?, And of course the radio module and we have something fun that works.

      Each press of the button adds one minutes to the "on" time. As long as this time is greater than zero keep the water running, and shut it off when the timer expires. Every 15 seconds the LED blinks to indicate the number of remaining minutes of on time. Long press the button to reset the time and shut off the water. The state of the switch and the time remaining is relayed to domoticz as a light switch and a distance sensor (the closest match I could find). The light switch can of course also be triggered from domoticz, giving us multiple options for turning on and off the water. Turning on the water from the computer simply sets the timer to 10 minutes to ensure that it will be automatically shut off at some point.

      It doesn't look great, but it's solves a real problem 🙂
      photo

      posted in My Project
      kolaf
      kolaf
    • Tolerate radio failure

      One on my sensors is mounted quite far away with spotty radio coverage. This means that the sensor will not always boot correctly since it is not able to reach the Gateway (apparently the sensor hangs on initialisation while trying to initiate a connection with the Gateway). A radio connection is not critical for me since I have a local interface on the sensor to actuate it and display readings. However, this feature prevents the sensor from operating locally. Is there a way to instruct the library to give up if the initial radio communication fails and work in some kind of "off-line" mode?

      posted in General Discussion
      kolaf
      kolaf
    • RE: Testing development branch with RF69HW is not working as it should

      Weird, I'm curious to hear what you find.

      I have a thread on going at the lowpower forum trying to figure out my own problems: https://lowpowerlab.com/forum/index.php/topic,1821.0.html

      For my part the problem is clearly unrelated to MySensors, but I find it difficult to believe that it is a hardware problem when it affects so many devices (unless it is an age thing or I managed to break them all at once).

      posted in Troubleshooting
      kolaf
      kolaf
    • Minding the robot

      In the belief that not everything has to be overcomplicated (ref my other post about hacking a water timer), let me share my most recent project with you.

      I have a robotic lawnmower that covers a pretty complicated lawn of about 3500 m². Being only a simple robot it tends to get stuck here and there, and sometimes it has to take the long way home with too little fuel. In these cases it would be good to get a notification so that I could go out and look for him when he gets stuck, but be pretty confident that he is working correctly otherwise.

      Enter my sensor.

      It is nothing fancy, simply a reed switch connected to the interrupt pin (number three) on my moteino and a battery pack. The magnets for the switch is mounted on the lawnmower. Domoticz now knows when he is home and when he is out. Knowing how long he usually works for I can now easily set up an alarm which fires whenever he has been away too long (which means that he is probably stuck, or God forbid, stolen).

      Again, it is nothing fancy, but it works :-). I hope you guys forgive me for my casings and wiring. I am much more a software guy than a hardware guy, and it shows 🙂
      Reed switch

      posted in My Project
      kolaf
      kolaf
    • RE: Which gateway to choose Serial, Ethernet or MQTT?

      I guess it mostly depends on what you have available and where you want to place the Gateway. With the serial option you have to have the Gateway quite close to your computer, while with the ethernet option you can have them further apart.

      On the other hand, the ethernet option can be more expensive than the serial option since you need an ethernet adapter for the gateway.

      For my part I'm quite happy using the serial Gateway together with OpenHAB (earlier) and now testing it with Domoticz without any problems.

      posted in General Discussion
      kolaf
      kolaf
    • Porting MySensors to work with the RadioHead library

      Hi guys,

      I have received my Moteinos and anarduinos with RFM69HW radios. The anarduino webpage recommends a radio library called RadioHead which supports multiple radio tips and provides a common API for communication. http://www.airspayce.com/mikem/arduino/RadioHead/

      It even supports quite complex things such as mesh networks. It currently supports the following radios:

      • RH_RF22 Works with Hope-RF RF22B and RF23B based transceivers, and compatible chips and modules, including the RFM22B transceiver module. Supports GFSK, FSK and OOK. Access to other chip features such as on-chip temperature measurement, analog-digital converter, transmitter power control etc is also provided.
      • RH_RF69 Works with Hope-RF RF69B based radio modules, such as the RFM69 module, (as used on the excellent Moteino and Moteino-USB boards from LowPowerLab http://lowpowerlab.com/moteino/) and compatible chips and modules such as RFM69W, RFM69HW, RFM69CW, RFM69HCW (Semtech SX1231, SX1231H). Also works with Anarduino MiniWireless -CW and -HW boards http://www.anarduino.com/miniwireless/ including the marvellous high powered MinWireless-HW (with 20dBm output for excelent range). Supports GFSK, FSK.
      • RH_NRF24 Works with Nordic nRF24 based 2.4GHz radio modules, such as nRF24L01 and others. Also works with Hope-RF RFM73 and compatible devices (such as BK2423). nRF24L01 and RFM73 can interoperate with each other.
      • RH_NRF905 Works with Nordic nRF905 based 433/868/915 MHz radio modules.
      • RH_RF95 Works with Semtech SX1276/77/78 and HopeRF RFM95/96/97/98 and other similar LoRa capable radios. Supports Long Range (LoRa) with spread spectrum frequency hopping, large payloads etc. FSK/GFSK/OOK modes are not (yet) supported.
      • RH_ASK Works with a range of inexpensive ASK (amplitude shift keying) RF transceivers such as RX-B1 (also known as ST-RX04-ASK) receiver; TX-C1 transmitter and DR3100 transceiver; FS1000A/XY-MK-5V transceiver; HopeRF RFM83C / RFM85. Supports ASK (OOK).
      • RH_Serial Works with RS232, RS422, RS485, RS488 and other point-to-point and multidropped serial connections, or with TTL serial UARTs such as those on Arduino and many other processors, or with data radios with a serial port interface. RH_Serial23 provides packetization and error detection over any hardware or virtual serial connection.
      • RH_TCP For use with simulated sketches compiled and running on Linux. Works with tools/etherSimulator.pl to pass messages between simulated sketches, allowing testing of Manager classes on Linux and without need for real radios or other transport hardware.
        ``

      Seeing as the radio that is currently supported by MySensors is also supported by RadioHead I was wondering if anyone was interested in helping me porting MySensors to work with the RadioHead library. This will greatly increase the versatility of the MySensors library and magically allow it to work with a range of different radios :-).

      I have briefly looked at the MySensors source code and it looks like most of the changes have to be done in MySensors.h and .cpp files.

      I am willing to take a stab at it, but as everyone else I am limited on time. Still, it looks like it should not be a very difficult task. As discussed in another thread, it should be sufficient either to subclass the new radio library and replace a bunch of function calls, or drop the subclassing altogether and simply use the radio library as a regular included library.

      The obvious difficulty comes soon as MySensors requires a function that is not available in the new radio library. However, seeing as MySensors is a pretty high-level library, and the API support from radioHead seems quite good, I suspect it should be possible to get around any such problems.

      Anyway, I'm thinking of creating a branch of the library and spending a few hours trying to port it and get some basic functionality to work. Is anyone else is any value in this it would be great to have some help 🙂

      posted in Development
      kolaf
      kolaf
    • RE: RFM69 wireless

      @Fwessels I'm glad to see that someone else also finds that transceiver interesting. The source code in the repository is fully usable and up-to-date as a version 1.4+ something (I believe). Still, be aware that this will probably not become an official version since work is ongoing to figure out what is the best way of supporting multiple link layers.

      Nevertheless, feel free to use the code in that repository. You can look at the serial gateway to see how a sensor is initiated. Everything is identical to the official 1.4 version except for the initialisation phase where you define the radio driver. You also need to include the Radiohead library in your Arduino installation. Depending on which radio version you have you will have to tweak some of the initialisation parameters (power and frequency). The MQTTgateway has not been ported to work with the Radiohead library, so this is not working in my repository.

      Let me know how it goes, and you should keep an eye on the Radiohead topic in the developers forum to see how this develops.

      posted in Hardware
      kolaf
      kolaf
    • Multiple interrupts

      Hi guys,

      I previously posted a question regarding how to use multiple interrupts on my Arduino together with my RF 69 radio. The suggestion was to use pinChangeInt, but I couldn't exactly get it to work.i decided to pick this up again today, and I found this new library which appears to supersede it, called EnableInterrupt.

      https://github.com/GreyGnome/EnableInterrupt

      At first it did not work since it apparently had some kind of conflict with the radio library which relies on interrupt 0, and possibly also something in the mysensors framework related to sleeping, I guess? Anyway, since I didn't needed to handle the external interrupts, just the pinChangeInt, I was able to modify the header file to remove the clashing definitions.

      I finally have a working sensor that can cover multiple buttons and reed switches through interrupts. This means it can sleep most of the time, but still wake and act immediately if something changes 🙂

      posted in General Discussion
      kolaf
      kolaf
    • RE: The best way to connect to OpenHAB

      For the record there is also this initiative where a smart guy has created a Python Web application to interface between the serial connection and openhab. He has even built in the functionality for handling node IDs.

      https://github.com/wbcode/ham

      It seems like there are three quite usable options for interfacing with openhab:

      1. The MQTT gateway
      2. Using the serial binding in openhab
      3. Using the python openhab gateway.

      The serial binding seems the best option for quick prototyping with its low implementation cost (no additional software) and high flexibility. One of the two other options seems to be a better long-term choice since they will be easier to manage on the configuration size as the network grows, I think. I like the concept behind the python gateway, but using the httpbinding to communicate with it seems a bit cumbersome. Ideally I would like to see this incorporated as an openhab binding, but I do not think it is possible to do the node ID assignment this way since the binding should be stateless.

      This leaves the MQTT solution which leverages technology that seems to grow in popularity. An additional benefit is that the author of the software is still around the forums as opposed to the case with the python gateway. The downside is that the item configurations seems a bit complex (at least to me), it is much easier to understand the serial binding or HTTP binding usage.

      It is a tough choice.

      posted in OpenHAB
      kolaf
      kolaf

    Latest posts made by kolaf

    • RE: Tolerate radio failure

      Thanks for the suggestion, this is so far I have come as well. That is, I will use a regular moteino connected to a raspberry pi that I connect to the network in the barn. If I give it a separate network ID it should not be in conflict with what I use inside my house, and I believe that domoticz should have no issues with to different mysensors gateways connected. Lucky I installed broadband in my barn just last week 🙂

      posted in General Discussion
      kolaf
      kolaf
    • RE: Gateway freezes again

      @DavidZH i have thought the same, but that software is an very simple script. Still, you might be right.

      posted in Troubleshooting
      kolaf
      kolaf
    • Gateway freezes again

      Hi,

      I upgraded my gateway to the release version 2.0 using a moteino with a rfm69 radio attached. After one or two days the gateway stops responding. It is connected by a 20 cm USB cable directly to my computer. On the computer side I am running the latest version of domoticz which pings the Gateway every 10 seconds or so. since I have issues with connecting to many serial devices I am running it through a serial-socket Gateway script (python) that forwards all data from the socket to the serial port and vice versa. A usual sequence looks like this:

      Received socket: 0;0;3;0;18;PING
      Received serial: 0;255;3;0;22;23458138
      Received serial: 0;255;3;0;9;TSP:SANCHK:OK
      

      When things stop workingit continues sending pings to the Gateway, but no response is received, nor any other messages. It is usually resolved by reconnecting to the serial port, but sometimes I need to physically unplug the device to reset it. Have anyone else experienced such stability issues?

      posted in Troubleshooting
      kolaf
      kolaf
    • Tolerate radio failure

      One on my sensors is mounted quite far away with spotty radio coverage. This means that the sensor will not always boot correctly since it is not able to reach the Gateway (apparently the sensor hangs on initialisation while trying to initiate a connection with the Gateway). A radio connection is not critical for me since I have a local interface on the sensor to actuate it and display readings. However, this feature prevents the sensor from operating locally. Is there a way to instruct the library to give up if the initial radio communication fails and work in some kind of "off-line" mode?

      posted in General Discussion
      kolaf
      kolaf
    • RE: Trouble sleeping

      I have a generic multi meter, but I was not able to measure the current with this. I'm not sure why, I put it between the battery and the final connection terminal of the battery compartment.

      posted in General Discussion
      kolaf
      kolaf
    • RE: Trouble sleeping

      I am not getting frequent reports, so if you are right that means that sleep is working as you suggest. I believe the weather shield is not drawing much power, it is simply a collection of a temperature and humidity sensor, a barometric pressure sensor, and a battery voltage reading circuit which is switched off when not used. More information about this shield is here: http://lowpowerlab.com/blog/2015/01/30/weathershield-is-here/.

      posted in General Discussion
      kolaf
      kolaf
    • Trouble sleeping

      Hi guys,

      I have a battery-powered moteino with the RFM96 radio and a WeatherShield attached for environment measurements (and for hardware simplicity). I am powering everything from 3 1.5 V AA cells in series.

      The node sleeps for 900000 seconds after reading the various sensor measurements from the board (temperature, humidity, pressure, and battery level). I set the node up last night and it lasted for around seven hours before the battery ran out. Apparently it appears not to be sleeping as it should. What am I doing wrong? Sketch is included below.

      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_RFM69
      #define MY_IS_RFM69HW
      #define MY_RFM69_FREQUENCY   RF69_868MHZ
      
      #include <SPI.h>
      #include <MySensors.h>
      
      #include <DHT.h>
      #include <SFE_BMP180.h>    //get it here: https://github.com/LowPowerLab/SFE_BMP180
      #include <SI7021.h>        //get it here: https://github.com/LowPowerLab/SI7021
      #include <Wire.h>
      
      #define REPORT_INTERVAL 900000
      #define ALTITUDE 220
      
      
      #define CHILD_TEMPERATURE 1
      #define CHILD_HUMIDITY 2
      #define CHILD_PRESSURE 3
      #define CHILD_POWER 4
      
      SI7021 sensor;
      SFE_BMP180 pressure;
      int BATTERY_SENSE_PIN  = A7;  // select the input pin for the battery sense point
      char *weather[] = {"stable", "sunny", "cloudy", "unstable", "thunderstorm", "unknown"};
      int minutes;
      float pressureSamples[180];
      int minuteCount = 0;
      bool firstRound = true;
      float pressureAvg[7];
      float dP_dt;
      
      MyMessage temperatureMessage(CHILD_TEMPERATURE, V_TEMP);
      MyMessage humidityMessage(CHILD_HUMIDITY, V_HUM);
      MyMessage pressureMessage(CHILD_PRESSURE, V_PRESSURE);
      MyMessage forecastMsg(CHILD_PRESSURE, V_FORECAST);
      MyMessage powerMessage(CHILD_POWER, V_VOLTAGE);
      
      bool changed = false;
      float lastPressure = -1;
      float lastTemperature = -1;
      float lastHumidity = -1;
      int lastForecast = -1;
      float lastBattery = -1;
      void setup()
      {
        // use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
        analogReference(INTERNAL1V1);
      #else
        analogReference(INTERNAL);
      #endif
        sensor.begin();
        if (pressure.begin())
          Serial.println("BMP180 init success");
        else
        {
          // Oops, something went wrong, this is usually a connection problem,
          // see the comments at the top of this sketch for the proper connections.
      
          Serial.println("BMP180 init fail\n\n");
          //while(1); // Pause forever.
        }
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Outdoors environment", "2.0");
      
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_TEMPERATURE, S_TEMP);
        delay(250);
        present(CHILD_HUMIDITY, S_HUM);
        delay(250);
        present(CHILD_PRESSURE, S_BARO);
        delay(250);
        present(CHILD_POWER, S_POWER);
      
      }
      
      void loop()
      {
        changed = false;
        float temperature = sensor.getCelsiusHundredths() / 100;
        int humidity = sensor.getHumidityPercent();
        if (lastTemperature != temperature) {
          changed = true;
          lastTemperature = temperature;
        }
        if (lastHumidity != humidity) {
          changed = true;
          lastHumidity = humidity;
        }
      
        pinMode(A3, OUTPUT);
        digitalWrite(A3, LOW);
        lastBattery = analogRead(A7) / 10;
        pinMode(A3, INPUT);
      #ifdef MY_DEBUG
        float batteryV  = lastBattery * 0.003363075 * 10;
        Serial.print("Battery Voltage: ");
        Serial.print(batteryV);
        Serial.println(" V");
      
        Serial.print("Battery percent: ");
        Serial.print(lastBattery);
        Serial.println(" %");
      #endif
      
        char status;
        double T, P, p0, a;
        status = pressure.startTemperature();
        if (status != 0)
        {
          // Wait for the measurement to complete:
          delay(status);
      
          // Retrieve the completed temperature measurement:
          // Note that the measurement is stored in the variable T.
          // Function returns 1 if successful, 0 if failure.
      
          status = pressure.getTemperature(T);
          if (status != 0) {
      
            status = pressure.startPressure(3);
            if (status != 0)
            {
              delay(status);
              status = pressure.getPressure(P, T);
              if (status != 0)
              {
                p0 = pressure.sealevel(P, ALTITUDE); // we're at 1655 meters (Boulder, CO)
                int forecast = 5;//sample(p0);
                if (lastPressure != p0) {
                  changed = true;
                  lastPressure = p0;
                  Serial.print("relative (sea-level) pressure: ");
                  Serial.print(p0, 2);
                  Serial.print(" mb, ");
                }
                if (lastForecast != forecast) {
                  changed = true;
                  lastForecast = forecast;
                }
              }
              else Serial.println("error retrieving pressure measurement\n");
            }
            else Serial.println("error starting pressure measurement\n");
          }
          else Serial.println("error retrieving temperature measurement\n");
        }
        else Serial.println("error starting temperature measurement\n");
      
        if (changed) {
          send(temperatureMessage.set(lastTemperature, 1));
          send(pressureMessage.set(lastPressure, 1));
          send(humidityMessage.set(lastHumidity, 1));
          sendBatteryLevel( lastBattery);
          if (lastForecast > -1)
            send(forecastMsg.set(weather[lastForecast]));
        }
        sleep(REPORT_INTERVAL);
      }
      posted in General Discussion
      kolaf
      kolaf
    • RE: openHAB 2.0 binding

      Hello again.

      As a temporary fix I found a simple TCP/serial Gateway Python snippet that handles the connection to the serial mysensors device and provides a TCP interface to openhab. Switching the binding of aggression from serial to socket and having it connected to this software gateway removes the core dump issue. This confirms my suspicions that the issues are with the serial port library.

      It works okay as a workaround until someone figure something out 🙂

      If anyone else is having issues with the serial connection, this is the by then snippet I found and used:

      https://github.com/pyserial/pyserial/blob/master/examples/tcp_serial_redirect.py

      posted in OpenHAB
      kolaf
      kolaf
    • RE: openHAB 2.0 binding

      After a full computer crash (overheated CPU, CPU fan stopped working) I'm trying to set everything up on a new computer. Using the latest openhab2 beta 3 I'm having issues with using this binding. Specifically, whenever I add my standard thing configuration I get a buffer overflow in openhab which results in a core dump.

      I have downloaded latest binding from the link at github, but that did not affect it. In addition to this binding I am using the zwave binding and rfxcom binding. All three connect to devices through serial ports, although I I'm not sure if they do it in the same way.

      You may recall that I have had trouble using these three bindings together earlier, but for some reason things worked out and it has worked quite reliably since then.

      I'm not sure which information from the system crash is useful, but if there is anything I can send you to help you figure out what happens, let me know. Also, I realise that this problem might not be related directly with mysensors, but maybe with the serial library used (I saw a reference to NVJavaSeria in the stack trace after the crash.

      posted in OpenHAB
      kolaf
      kolaf
    • RE: RFM69 moteino serial gateway freezes

      @mfalkvidd The cable had some kind of repeater on it, and my rfxtrx433 has worked perfectly all the time, even with the MS gateway connected, so I thought the MS gateway should work also ☺️

      posted in Troubleshooting
      kolaf
      kolaf