Navigation

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

    cimba007

    @cimba007

    28
    Reputation
    127
    Posts
    754
    Profile views
    1
    Followers
    0
    Following
    Joined Last Online

    cimba007 Follow

    Best posts made by cimba007

    • RE: Cheap dirty way to send a raw-mysensors message?

      After many hours trial and error I present you .. the raw-mysensors-client!!

      MyGateway: ESP8266 + mysensorsMQTT
      MyNode: https://github.com/Miceuz/PlantWateringAlarm
      MyNode-MCU: Attiny44 (MemoryFootprint: 87% of 4KB)
      ArduinoCore: https://github.com/SpenceKonde/ATTinyCore
      ArduinoCore-PinLayout: Counterclockwise (like AttinyCore)
      Note: The default "counterclockwise"pinout is the alternate pinout shown here: https://github.com/SpenceKonde/ATTinyCore/blob/master/avr/extras/ATtiny_x4.md

      The important hint is here (http://tmrh20.github.io/RF24/ATTiny.html)

      Connect MOSI of the RF24 to PA5 of the attiny and MISO of the RF24 to PA6 of the attiny.
      CE = 8
      CSN = 7

      To get the connection done right DONT .. i mean DO NOT BECAUSE IT DOESNT FUCKING WORK connect MOSI of the RF24 to MOSI of the attiny. RF24 uses a embedded implementation of the USI-engine found on some AtTiny's.

      radio-initilisation

          radio.begin(); // Start up the radio
          radio.setDataRate(RF24_250KBPS);
          radio.setAutoAck(1); // Ensure autoACK is enabled
          radio.setRetries(15,15); // Max delay between retries & number of retries
          //radio.setPayloadSize(8);
          radio.enableDynamicPayloads();
          radio.setPALevel(RF24_PA_MAX);
          byte tx_address[] = { 0x00, 0xFC, 0xE1, 0xA8, 0xA8 };
          //byte tx_address[] = { 0xA8, 0xA8, 0xE1, 0xFC, 0x00 };
          radio.openWritingPipe(tx_address);
          radio.stopListening();
      

      Send-Function:

      void sendHumidity(uint16_t humidity)
      {
          // snprintf_P(_fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, PSTR("%s/%d/%d/%d/%d/%d"), prefix, message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type);
          // X8X22<\0><\n>!<7>7AY0;255;3;0;9;TSF:MSG:READ,50-50-0,s=55,c=1,t=7,pt=1,l=1,sg=0:65<\n>
          // 0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/50/55/1/0/7<\n>
          
          #define LAST_NODE_ID  50  // last
          #define NODE_ID       50  // sender
          #define GATEWAY_ID    0   // destination
          
                                    // version_length     // 5 bit - Length of payload // 1 bit - Signed flag // 2 bit - Protocol version
                                    // command_ack_payload // 3 bit - Payload data type // 1 bit - Is ack messsage - Indicator that this is the actual ack message. // 1 bit - Request an ack - Indicator that receiver should send an ack back. // 3 bit - Command type
          
          #define SENSOR_TYPE   7   // type S_HUM = 7
          #define SENSOR_ID     55  // sensor-id
          byte test[] = { LAST_NODE_ID, NODE_ID, GATEWAY_ID, 0b00010010, 0b01100001,  SENSOR_TYPE, SENSOR_ID, (uint8_t)(humidity & 0x00FF), (uint8_t)((humidity >> 8) & 0x00FF),  0x00 };
          radio.write(test,9);
      }
      

      I am not quite sure yet if the message-types etc. are right but I am trying to find this out. 'A' (dec 65) is the "value" of my humidity .. next step is to make this a real value ofc.

      Proof at domoticz:
      0_1499525234377_upload-22170821-6116-4d1a-a08b-c0631b3fac15

      @gohan: In the file MyConfig.h I commented this out:

      /**
       * @def MY_REGISTRATION_FEATURE
       * @brief If enabled, node has to register to gateway/controller before allowed to send sensor data.
       */
      // #define MY_REGISTRATION_FEATURE
      

      This will skip the whole hasse of registering the client properly (which I can't .. remember 87% of flash is full)

      posted in Development
      cimba007
      cimba007
    • RE: Microwave Radar Module as PIR replacement.

      @Yveaux I did some extensive testing on the FC1816 module and I thought I might drop my experience:

      http://electronics.stackexchange.com/questions/226031/pinout-of-microwave-motion-sensor-fc1816

      In the end I used an 150ohm Series resistor + ~100µF cap behind this to power the FC1816. This eliminated much of the leftover noise. If this is not enough I presented a way to lower the module amplification. In the end I deactivated the biss-trigger output alltogether and grabbed the raw signal. Doing some manual processing:

      1. take 100 reads
      2. get the stddev (statistics library)
      3. high stddev = high fluctuation in values = movement

      Take a look at my current working copy of my code for the FC1816:

      Some notes:

      I power the VCC of the FC1816 from some arduino pins. Thus I can deactivate the microwave sensor at will. This is still not recommended. If you visit the previous link you can see that the BISS has some kind of "warmup"-Period.

      I use 3,3Volt to power the NRF24, the arduino and the FC1816 and suffered no strange consequences so far.

      Get get some insight about the link quality of the NRF24 I made the function RF24_getObserverTX() accessible from user-space:

      MySensors\drivers\RF24\RF24.cpp

      uint8_t RF24_getObserveTX(void)
      {
      	return RF24_readByteRegister(OBSERVE_TX);
      }
      

      MySensors\drivers\RF24\RF24.h

      uint8_t RF24_getObserveTX(void);
      

      The Idea behind the OBSERVE_TX register is that the lower byte presents the number of retrys the NRF24 used in the last send.
      The upper 4 bits present the number of total failed packets. I suggest using (0x0F & RF24_getObserveTX()) to get a usable number 0-15 presenting the retry-count. Anything > 0 suggests a packetloss on your link. 15 most likely will mean you ran into an complete fail as the max number of retrys was exhausted.

      This number might be capped by

      // ARD, auto retry count
      #define RF24_ARC 15
      

      from the RF24.h driver-file.

      TO not run into compiling errors you might need:

      http://arduiniana.org/libraries/streaming/
      https://github.com/RobTillaart/Arduino/tree/master/libraries/Statistic

      MicrowaveRadarSensor.ino

      #include <Streaming.h>
      #include "Statistic.h"
      
      
      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * 
       * DESCRIPTION
       * Example sketch showing how to measue light level using a LM393 photo-resistor 
       * http://www.mysensors.org/build/light
       */
      
      #define MY_NODE_ID 10
      #define MY_BAUD_RATE 57600
      
      // Enable debug prints to serial monitor
      //#define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>
      #include <MySensors.h>  
      
      #define LIGHT_SENSOR_ANALOG_PIN A3
      #define MICRO_SENSOR_ANALOG_PIN A1
      
      unsigned long SLEEP_TIME = 1000; // Sleep time between reads (in milliseconds)
      
      #define CHILD_ID_LIGHT 0
      #define CHILD_ID_MICRO 0
      #define TRIPPED_THRESHOLD 50
      
      MyMessage msg_light(CHILD_ID_LIGHT, V_LIGHT_LEVEL); // 23
      MyMessage msg_micro(CHILD_ID_MICRO, V_TRIPPED);     // 16
      MyMessage msg_micro_debug(0,V_VAR1);   // 24
      MyMessage msg_obstx_debug(0,V_VAR2);   // 25
      
      void before()
      {
        // LightSensor
        pinMode(A3,INPUT_PULLUP);
        pinMode(A2,OUTPUT);
        digitalWrite(A2,LOW);  
      
        // Microwave
        pinMode(5,OUTPUT);        // VCC BISS0001
        digitalWrite(5,HIGH);
        
        pinMode(6,OUTPUT);        // Enabled
        digitalWrite(6,LOW);      // Enable
        
        pinMode(7,OUTPUT);        // GND
        digitalWrite(7,LOW);
        
        pinMode(8,OUTPUT);        // VCC Radar
        digitalWrite(8,HIGH);
      
        pinMode(A1,INPUT);        // PIR 2nd Amplification Stage
      
        // Other
      }
      void setup()
      {
       
      }
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Microwave+Light", "1.0");
      
        // Register all sensors to gateway (they will be created as child devices)
        // https://www.mysensors.org/download/serial_api_20#sensor-type
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        present(CHILD_ID_MICRO, S_MOTION);
        //present(0, S_ARDUINO_NODE);
        
      }
      
      void loop()      
      {     
        // Report VCC
        static long vcc = readVcc();
        static int vccpercent = map(vcc,1800,3280,0,100);
        sendBatteryLevel(max(min(vccpercent,100),0),false);
        Serial << "| vcc: ";
        p(F("%4d"),vcc);
        Serial << " ";
        // Required for ack
        //wait(100);
      
        // Report LightLevel
        analogRead(LIGHT_SENSOR_ANALOG_PIN);
        int lightLevel_raw = analogRead(LIGHT_SENSOR_ANALOG_PIN);
        int lightLevel = (1023-lightLevel_raw)/10.23; // as of 1023 !!
        Serial << "| light_raw: ";
        p(F("%4d"),lightLevel_raw);
        Serial << " ";
        Serial << "| light: ";
        p(F("%3d"),lightLevel);
        Serial << " ";
        send(msg_light.set(lightLevel),false);
      
        // Report WirelessLink Information
        Serial << "| observe_tx: ";
        uint8_t obstx = RF24_getObserveTX();
        p(F("%X"),obstx);
        Serial << " ";
        send(msg_obstx_debug.set(0x0F&obstx),false);
       
        // Report Microwave
        Statistic mw_s;
        mw_s.clear();
        
        delay(90);
        analogRead(MICRO_SENSOR_ANALOG_PIN);
        delay(10);
        for(int i = 0; i < 1000; i++)
        {
          mw_s.add(analogRead(MICRO_SENSOR_ANALOG_PIN));
          delay(1);
        }
        Serial << "| mw_raw: ";
        int stddev = mw_s.pop_stdev();
        p(F("%4d"),stddev);
        Serial << " ";
        
        Serial << "| mw_min: ";
        int minimum = mw_s.minimum();
        p(F("%4d"),minimum);
        Serial << " ";
      
        Serial << "| mw_max: ";
        int maximum = mw_s.maximum();
        p(F("%4d"),maximum);
        Serial << " ";
        
        Serial << "| mw: " << (stddev > TRIPPED_THRESHOLD ? "1" : "0") << " ";
        send(msg_micro_debug.set(stddev),false);
        while(!send(msg_micro.set(stddev > TRIPPED_THRESHOLD ? "1" : "0"),true))
        {
          wait(10);
        }
        
        if(isTransportOK()) 
          wait(100);
        else
          wait(1000);
        Serial << endl;
        //mysleep(500);
      
      }
      // https://forum.mysensors.org/topic/3463/m_ack_variable-or-m_set_variable/2
      void receive(const MyMessage &message) {
        if (message.isAck()) {
            Serial.print("| GW ack");
            }
      }
      

      Helper.ino

      long readVcc() {
        // Read 1.1V reference against AVcc
        // set the reference to Vcc and the measurement to the internal 1.1V reference
        #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
          ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
        #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
          ADMUX = _BV(MUX5) | _BV(MUX0);
        #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
          ADMUX = _BV(MUX3) | _BV(MUX2);
        #else
          ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
        #endif  
      
        delay(2); // Wait for Vref to settle
        ADCSRA |= _BV(ADSC); // Start conversion
        while (bit_is_set(ADCSRA,ADSC)); // measuring
      
        uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH  
        uint8_t high = ADCH; // unlocks both
      
        long result = (high<<8) | low;
      
        result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
        //result *= 1.0637;
        return result; // Vcc in millivolts
      }
      
      #include <stdarg.h>
      void p(const __FlashStringHelper *fmt, ... ){
        char buf[128]; // resulting string limited to 128 chars
        va_list args;
        va_start (args, fmt);
      #ifdef __AVR__
        vsnprintf_P(buf, sizeof(buf), (const char *)fmt, args); // progmem for AVR
      #else
        vsnprintf(buf, sizeof(buf), (const char *)fmt, args); // for the rest of the world
      #endif
        va_end(args);
        Serial.print(buf);
      }
      
      void mysleep(int SLEEP_TIME)
      {
          if(isTransportOK()){
            Serial << "| wait ";
            wait(25);
            Serial << "| zZz > ";
      
            sleep(SLEEP_TIME);
            Serial << "| < zZz " << endl;
          } 
          else {
            wait(1000);
          }
      }
      
      posted in Hardware
      cimba007
      cimba007
    • RE: Microwave Radar Module as PIR replacement.

      All things from my previous post regarding the wiring are still needed:

      Here is a stripped down example on how to use the FC1816 Microwave Sensor. You need the following library:

      https://github.com/RobTillaart/Arduino/tree/master/libraries/Statistic

      #include "Statistic.h"
      
      #define MICRO_SENSOR_ANALOG_PIN A1
      
      void setup()
      {
        
        Serial.begin(57600);
        Serial.print("begin");
        
        // Microwave
        pinMode(5,OUTPUT);        // VCC BISS0001
        digitalWrite(5,HIGH);
        
        pinMode(6,OUTPUT);        // Enabled
        digitalWrite(6,LOW);      // DISABLE PLEASE!
        
        pinMode(7,OUTPUT);        // GND
        digitalWrite(7,LOW);
      
        pinMode(A1,INPUT);        // PIR 2nd amplification stage
      
        pinMode(A0,OUTPUT);       // UPD microwave generator
        digitalWrite(A0,HIGH);
      
      }
      
      void loop()      
      {     
        // Report Microwave
        static Statistic mw_s;
        static uint16_t stdev_sum = 0;
        //mw_s.clear();
      
        //digitalWrite(8,HIGH);
        //delay(100);
        analogRead(MICRO_SENSOR_ANALOG_PIN);
        uint16_t reading;
        for(int i = 0; i < 200; i++)
        {
          reading = analogRead(MICRO_SENSOR_ANALOG_PIN);
          mw_s.add(reading);
          //Serial.println(reading);
          //Serial.flush();
          //delay(50);
          //LowPower.powerDown(SLEEP_60MS, ADC_ON, BOD_OFF);  
          //delay(1);
        }
        Serial.print(mw_s.minimum());   Serial.print(",");
        Serial.print(mw_s.average());   Serial.print(",");
        Serial.print(mw_s.maximum());   Serial.print(",");
        Serial.print(mw_s.pop_stdev()); Serial.print(",");
        stdev_sum += mw_s.pop_stdev();
        Serial.print(stdev_sum); //Serial.print(",");
        Serial.println();
        stdev_sum *= 0.9;
        mw_s.clear();
      }
      

      I just had the idea to sum up the std-dev and decrease it by 10% every round. Thus the code is less prone to peaks.

      0_1471429474464_upload-9c26c9f3-6ccd-4aaf-9bcc-797ad4c03be4

      stdev_sum is the lower dark blue line which can now be much easier compared to a threshold.

      Some measurement with my µCurrent-Gold:

      Unmodified code as above, power LED removed from ProMini @ 8Mhz internal osci with LDO desoldered
      4,8mA

      I tried to put the FC1816 into sleep by disable the power to the Microwave generator but this doesn't work.
      I modified the fuses for 8Mhz with 0ms wakeup delay for stabelizing the oscillator. No risk no phun 😉

      The most practical solution I got to replace a PIR (still nothing as close as a PIR ;-ö)

      1530µA

      with this code:

      Note that the radar generator just can't be disable as it needs 10-15seconds to stabelize after power up

      #include <LowPower.h>
      
      #include "Statistic.h"
      
      #define MICRO_SENSOR_ANALOG_PIN A1
      
      void setup()
      {
        
        Serial.begin(57600);
        Serial.print("begin");
        
        // Microwave
        pinMode(5,OUTPUT);        // VCC BISS0001
        digitalWrite(5,HIGH);
        
        pinMode(6,OUTPUT);        // Enabled
        digitalWrite(6,LOW);      // DISABLE PLEASE!
        
        pinMode(7,OUTPUT);        // GND
        digitalWrite(7,LOW);
      
        pinMode(A1,INPUT);        // PIR 2nd amplification stage
      
        pinMode(A0,OUTPUT);       // UPD microwave generator
        digitalWrite(A0,HIGH);
      
      }
      
      void loop()      
      {     
        // Report Microwave
        static Statistic mw_s;
        static uint16_t stdev_sum = 0;
        //mw_s.clear();
      
        
        //delay(100);
        analogRead(MICRO_SENSOR_ANALOG_PIN);
        uint16_t reading;
        for(int i = 0; i < 10; i++)
        {
          LowPower.powerDown(SLEEP_15Ms, ADC_ON, BOD_OFF);  
          reading = analogRead(MICRO_SENSOR_ANALOG_PIN);
          mw_s.add(reading);
          //Serial.println(reading);
          //Serial.flush();
          //delay(50);
          LowPower.powerDown(SLEEP_15Ms, ADC_ON, BOD_OFF);  
          //delay(1);
        }
        Serial.print(mw_s.minimum());   Serial.print(",");
        Serial.print(mw_s.average());   Serial.print(",");
        Serial.print(mw_s.maximum());   Serial.print(",");
        Serial.print(mw_s.pop_stdev()); Serial.print(",");
        stdev_sum += mw_s.pop_stdev();
        Serial.print(stdev_sum); //Serial.print(",");
        Serial.println();
        Serial.flush();
        stdev_sum *= 0.9;
        mw_s.clear();
        
      }
      
      posted in Hardware
      cimba007
      cimba007
    • New Homepage design

      I find the huge gap between the title and the #Post very .. annonying. Now I have to move my had from totally left of my screen to totally right to read the latest post for each topic.

      0_1473707200319_upload-e392565b-9a45-4b00-a1c2-c708d567fbb6

      posted in General Discussion
      cimba007
      cimba007
    • RE: Microwave Radar Module as PIR replacement.

      Currently I don't plan to make a library .. a library implies that the sensor is very easy to use .. plug in + import library.

      The FC1816 is not such a sensor.

      • Needs Voltage-Supply filter (RC Section)
      • Need separate cable to grab the signal at the 2nd amplification stage
      • Need potentiometer to lower the amplification
      • Is very prone to random noise (in fact even entering RF24 or ATMEGA328 low power mode might increase noise floor a lot)

      Using a "simple to use" library and not getting the expected result of an "easy"-sensor would be very disappointing. For now I would say this is an advanced sensor with some pitfalls.

      I update this thread with my findings to hopefully make everybodys life a bit easyer if you want to tinker with the FC1816 although you now know it is a little beast 😉

      If you need any help just ask here and I will support you the best I can.

      posted in Hardware
      cimba007
      cimba007
    • RE: low power designe

      One addition:

      If you power the Arduino directly (e.g. 2x AA = ~3,00V max) you can use ( http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/ ). This will ofc. not work if you power your setup via VoltageRegulator.

      In addition to mfalkvidd's link have alook at https://www.mysensors.org/download/sensor_api_20#sleeping

      It describes how to use the sleep function to put the Arduino+Radio in sleep mode.

      posted in Feature Requests
      cimba007
      cimba007
    • RE: Watchdog on 2.0

      Have you tried to enable #define MY_DEBUG and have a Serial terminal opened all the time?

      Maybe you can get some clues on where the sketch "hangs up"

      posted in General Discussion
      cimba007
      cimba007
    • RE: Microwave Radar Module as PIR replacement.

      @Yveaux From my oppinion the radar modules are not suited for battery usage. Their drain something like 3-5mA and are not easy to put to sleep. Remember the warm-up period of the BISS. It seems to be like 10-15seconds.

      The plots are from another sketch, not the one I posted but using them is pretty straight forward.

      In my sketch have a look at these parts:

        Serial << "| mw_min: ";
        int minimum = mw_s.minimum();
        p(F("%4d"),minimum);
        Serial << " ";
      

      To use the arduino plotting all you ahve to do is send a string like this:

      0,10,534,123 .. whatever .. beware that no other serial output should happen if you want to use the arduino build-in plotting. Using the streaming library ( http://arduiniana.org/libraries/streaming/ ) it all boils down to a single line:

      Serial << mw_s.minimum() << "," << mw_s.maximum() << "," << mw_s.pop_stdev() << endl;
      

      In addition to the power consumption my approach requires sampling the analog input for a whole second .. or the more the better.

      This might be improved if you can prevent the FC1816 from retriggering itself. I had some serious problems as during the "inhibitor" period the analogOutput from the 2nd amplification stage was quite high often instantly retrigger the biss-output after the inhibition period ended.

      One solution might be this:

      Try this if you want to look down this approch:

      • Power the FC1816 VCC and UDP through an RC-Section (100Ohm Resistor and after that (on the side of the FC1816) an capacitory ~100-220µF)
      • Replace amplification resistor from 105 to eg. 154 (lowering the amplification)

      To find the best value I used an variable resistor parallel to the 105-Ohms SMD-Resistor

      But .. don't forget the benefits of *he microwave sensor. You can mount it straight to a door and it would detect persons in front of the door without them noticing. For this reason I try to build an "Alarm-node" that can be hidden inside the house. Later I might improve the FC1816 with some aluminium foil for shielding as suggested earlier.

      I would suggest using an PIR if you need a battery powered node. Have a look at ( http://kavacky.lv/bypassing-sen-08630-pir-motion-sensors-voltage-regulator-to-work-with-3-3-v ). Some PIRs have a Regulator which might not be suited if you are running on battery using 3,3Volt.

      posted in Hardware
      cimba007
      cimba007
    • RE: New internal message types

      Just for the sake of linking the issue:

      https://github.com/mysensors/MySensors/issues/581

      janchrillesen created this issue in mysensors/MySensors

      open New internal message types #581

      posted in Feature Requests
      cimba007
      cimba007
    • RE: New Homepage design

      @Anticimex

      You just made a point .. ever wondered why books are not printed in landscape? Because moving the eys from the right most side to the left most sides is a hassle and stressfull.

      @hek

      Point 1: I really like the idea of having the forum and main site menu united.

      Now the important stuff is also split. Categories, unread .. and most popular on the left .. search and notifications on the right .. why not move all to the same side?

      Point 2: I like the left menu. Nothing to comlain here.

      Point 3:

      0_1473709725733_upload-4d44163d-44d7-409e-a946-d3237e951a05

      Switching between the "starting page" and the "forum" now looks like a mayor break in the design flow

      0_1473709774978_upload-7106b808-c93e-445d-bf98-e9bdd35873a5

      PS: The main page design is much more flexible with different sizes. If the monitor is smaller .. just take from the free space (left and right) .. if the monitor is bigger .. well .. some more free space .. nice.

      But with the forum it is totally different. Pinning the content to the left and right space gives a different user experience depening on your resolution.

      posted in General Discussion
      cimba007
      cimba007

    Latest posts made by cimba007

    • RE: Cheap dirty way to send a raw-mysensors message?

      Its not "that" bad .. the Attiny44A is compatible with Arduino thanks to https://github.com/SpenceKonde/ATTinyCore

      For now I got Humidity and Voltage(VCC) running up fine.

      posted in Development
      cimba007
      cimba007
    • RE: Cheap dirty way to send a raw-mysensors message?

      From time to time I run into this bug .. not sure if this is related:

      0;255;3;0;9;TSM:READY:NWD REQ<\n>
      0;255;3;0;9;TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:<\n>
      Fatal exception 28(LoadProhibitedCause):<\n>
      epc1=0x40202704, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000003, depc=0x00000000<\n>
      <\r><\n>
      
      posted in Development
      cimba007
      cimba007
    • RE: Cheap dirty way to send a raw-mysensors message?

      I might have run into a bug in the calculation of message length.

      In my handcrafted packet I use this as the 4thy byte send:

      0b10000001

      So to craft this I looked at MyMessage.h which showed me this:

      uint8_t version_length;		 // 2 bit - Protocol version
      		                 // 1 bit - Signed flag
      		                 // 5 bit - Length of payload
      

      So from my understanding:

      Protocol Version = 2 => 0b10
      Signed Flag = 0 => 0b0
      Length of Payload = 1 = 0b00001

      Which results in 0b10 0 00001 = 0b10000001

      But I get this error:

      LEN,8!=23
      

      So .. where might this come from?

      radio.write(test,8);
      

      Mycontroller received a packet with the length of 8 but expected a packet with the length of .. 23 ?!

      #define mGetLength(_message) ((uint8_t)BF_GET(_message.version_length, 3, 5)) //!< Get length field
      

      Which in essential is BF_GET ..

      #define BF_GET(y, start, len)   ( ((y)>>(start)) & BIT_MASK(len) ) //!< Extract a bitfield of length 'len' starting at bit 'start' from 'y'
      

      So what is happening?

      BF_GET(0b10000001, 3, 5)   ( ((0b10000001)>>(3)) & BIT_MASK(5) ) //!< Extract a bitfield of length 'len' starting at bit 'start' 
      

      Whoops? This will throw away all the length-information!!!
      (0b10000001)>>(3)
      This should result in:
      0b11110000 & BIT_MASK5 = 0b1111000 & 0b00011111 = 0b00010000 = 16 decimal

      const uint8_t expectedMessageLength = HEADER_SIZE + (mGetSigned(_msg) ? MAX_PAYLOAD : msgLength);
      
      const uint8_t expectedMessageLength = 7+ 16); // = 23
      

      Yeah .. the lib is right .. 8 != 23 .. but the handcrafted length = 1 + header_length (7) = 8

      Am I wrong or is this a bug?

      Edit: I might have read the comments in the source code the wrong way

      posted in Development
      cimba007
      cimba007
    • RE: Cheap dirty way to send a raw-mysensors message?

      After many hours trial and error I present you .. the raw-mysensors-client!!

      MyGateway: ESP8266 + mysensorsMQTT
      MyNode: https://github.com/Miceuz/PlantWateringAlarm
      MyNode-MCU: Attiny44 (MemoryFootprint: 87% of 4KB)
      ArduinoCore: https://github.com/SpenceKonde/ATTinyCore
      ArduinoCore-PinLayout: Counterclockwise (like AttinyCore)
      Note: The default "counterclockwise"pinout is the alternate pinout shown here: https://github.com/SpenceKonde/ATTinyCore/blob/master/avr/extras/ATtiny_x4.md

      The important hint is here (http://tmrh20.github.io/RF24/ATTiny.html)

      Connect MOSI of the RF24 to PA5 of the attiny and MISO of the RF24 to PA6 of the attiny.
      CE = 8
      CSN = 7

      To get the connection done right DONT .. i mean DO NOT BECAUSE IT DOESNT FUCKING WORK connect MOSI of the RF24 to MOSI of the attiny. RF24 uses a embedded implementation of the USI-engine found on some AtTiny's.

      radio-initilisation

          radio.begin(); // Start up the radio
          radio.setDataRate(RF24_250KBPS);
          radio.setAutoAck(1); // Ensure autoACK is enabled
          radio.setRetries(15,15); // Max delay between retries & number of retries
          //radio.setPayloadSize(8);
          radio.enableDynamicPayloads();
          radio.setPALevel(RF24_PA_MAX);
          byte tx_address[] = { 0x00, 0xFC, 0xE1, 0xA8, 0xA8 };
          //byte tx_address[] = { 0xA8, 0xA8, 0xE1, 0xFC, 0x00 };
          radio.openWritingPipe(tx_address);
          radio.stopListening();
      

      Send-Function:

      void sendHumidity(uint16_t humidity)
      {
          // snprintf_P(_fmtBuffer, MY_GATEWAY_MAX_SEND_LENGTH, PSTR("%s/%d/%d/%d/%d/%d"), prefix, message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type);
          // X8X22<\0><\n>!<7>7AY0;255;3;0;9;TSF:MSG:READ,50-50-0,s=55,c=1,t=7,pt=1,l=1,sg=0:65<\n>
          // 0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/50/55/1/0/7<\n>
          
          #define LAST_NODE_ID  50  // last
          #define NODE_ID       50  // sender
          #define GATEWAY_ID    0   // destination
          
                                    // version_length     // 5 bit - Length of payload // 1 bit - Signed flag // 2 bit - Protocol version
                                    // command_ack_payload // 3 bit - Payload data type // 1 bit - Is ack messsage - Indicator that this is the actual ack message. // 1 bit - Request an ack - Indicator that receiver should send an ack back. // 3 bit - Command type
          
          #define SENSOR_TYPE   7   // type S_HUM = 7
          #define SENSOR_ID     55  // sensor-id
          byte test[] = { LAST_NODE_ID, NODE_ID, GATEWAY_ID, 0b00010010, 0b01100001,  SENSOR_TYPE, SENSOR_ID, (uint8_t)(humidity & 0x00FF), (uint8_t)((humidity >> 8) & 0x00FF),  0x00 };
          radio.write(test,9);
      }
      

      I am not quite sure yet if the message-types etc. are right but I am trying to find this out. 'A' (dec 65) is the "value" of my humidity .. next step is to make this a real value ofc.

      Proof at domoticz:
      0_1499525234377_upload-22170821-6116-4d1a-a08b-c0631b3fac15

      @gohan: In the file MyConfig.h I commented this out:

      /**
       * @def MY_REGISTRATION_FEATURE
       * @brief If enabled, node has to register to gateway/controller before allowed to send sensor data.
       */
      // #define MY_REGISTRATION_FEATURE
      

      This will skip the whole hasse of registering the client properly (which I can't .. remember 87% of flash is full)

      posted in Development
      cimba007
      cimba007
    • RE: Cheap dirty way to send a raw-mysensors message?

      @gohan Thanks for your response. The problem is that I already have 5 "chirps" and just later came up with the idea of adding nrf24 to them. I might try to add a "relay" node which will listen for "normal" rf24 packets and then send them to my gateway using the mysensors library.

      posted in Development
      cimba007
      cimba007
    • Cheap dirty way to send a raw-mysensors message?

      Hello,

      is it possible to "inject" a sensor-value into the gateway by hand-crafting a data packet?

      I recently got some of these little guys (https://wemakethings.net/chirp/)

      Now my idea was to slap a NRF24 on the ISP header (+2 extra pins for CE and CSN).

      So far so good .. now I want to craft a simple packet to get data to my gateways ..

      This is what I got so far but my gateway is not picking up anything.

          radio.begin(); // Start up the radio
          radio.setDataRate(RF24_250KBPS);
          radio.setAutoAck(1); // Ensure autoACK is enabled
          radio.setRetries(15,15); // Max delay between retries & number of retries
          byte station_address[] = { 0x00, 0xFC, 0xE1, 0xA8, 0xA8 };
          //byte station_address[] = { 0xA8, 0xA8, 0xE1, 0xFC, 0x00 };
          radio.openWritingPipe(station_address); // Write to device address 0x00,0xFC,0xE1,0xA8,0xA8
          radio.stopListening();
          byte test[] = { 250, 250, 0, 0b10000001 /* version_length */, 0b00100001,  7 /* S_HUM */ , 1 /* V_HUM */, 123};
          radio.write(test,8);
      

      And no .. I can't cram the mysensors library on the ATTINY44.

      I am currently happe that I got the basic chirp functunality for measuring the humidity of the soil, attiny debug serial and nrf24 all running on 4k of flash.

      Der Sketch verwendet **4046 Bytes (98%)** des Programmspeicherplatzes. Das Maximum sind 4096 Bytes.
      Globale Variablen verwenden 150 Bytes (58%) des dynamischen Speichers, 106 Bytes für lokale Variablen verbleiben. Das Maximum sind 256 Bytes.
      

      If anybody know if this is even possible I would like to hear from you.

      Best regards Marc

      posted in Development
      cimba007
      cimba007
    • RE: Which are the *best* NRF24L01+ modules?

      @NeverDie: In addition to using RF24_PA_MIN I power most of my nodes from 2x AA Alkaline Batteries .. so they have 2.2V - 3,0V VCC. This might contribute to my pretty good reception.

      Earlier nodes used 3,3V LDO in connection with lithium-ion batteries. So I can't say what really improved my reception the most ... lowering the voltage or putting the RF24_PA_MIN.

      posted in Hardware
      cimba007
      cimba007
    • RE: Which are the *best* NRF24L01+ modules?

      Just to add my 2cent .. I mainly use the LNA+PA ones (cheap from ebay) and complained some time for their "bad" performance.

      Just recently I noticed they are quite nice but .. RF24_PA_MIN is your friend! I got nearly zero packet-loss ~20m (one wall between) with RF24_PA_MIN. This might just be a subjective opinion but as they only cost 2-3$ a piece they are a good option (at least for me).

      Getting "genuin" chips for a reasonable price is very difficulty in germany.

      posted in Hardware
      cimba007
      cimba007
    • RE: Distance / Time measure and clock tuning

      At least in theory .. how much power does the ultrasonic-part consume and/or do you switch it off between measurements?

      posted in Development
      cimba007
      cimba007
    • RE: Where do you place your sensors or how do you hide them (case)?

      19 days ago .. I hope i dont wake the dead .. on my latest projects I bagen using this nice stuff:

      http://www.hornbach.de/shop/Hartschaumplatte-3x250x500-mm-schwarz/3888008/artikel.html0_1483553174213_IMG_20170104_185826.jpg

      posted in Enclosures / 3D Printing
      cimba007
      cimba007