Navigation

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

    Matt

    @Matt

    24
    Reputation
    64
    Posts
    877
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Matt Follow

    Best posts made by Matt

    • 433mhz transmitter

      Its kinda kludgy (of course- I made it!) but it works. As usual full of bits pinched from elsewhere....
      I am using this to control 4 effergy wall outlets. I already have mains switching ability but it's made by me and I am nervous about fire, so I figured this was a good compromise.
      I have some cheap 433 transmitters and receivers. Used the RCSwitch library to capture the codes. I have only got one switch functional at the moment but to add the rest is trivial. My coding Im sure is crap but it works.
      I have soldered a wee wire to the transmitter 12CM long and have no issues with range. I like the 'repeat command x times' function in the RCSwitch library, kinda makes not having feedback a non issue.

      // Enable debug prints to serial monitor
      //#define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Enable repeater functionality for this node
      // #define MY_REPEATER_FEATURE
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <RCSwitch.h>
      
      #define NUMBER_OF_PLUGS 4 // Total number of attached plugs
      
      #define CODE_1On 1290271
      #define CODE_1Off 1290263
      #define CODE_2On 1290267
      #define CODE_2Off 1290259
      #define CODE_3On 1290269
      #define CODE_3Off 1290261
      #define CODE_4On 1290270
      #define CODE_4Off 1290262
      
      RCSwitch mySwitch = RCSwitch();
      
      void setup() {
        mySwitch.enableTransmit(4);
        mySwitch.setRepeatTransmit(15);
      }
      
      void presentation()  
      {   
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("433mhz switch", "1.0");
      
        for (int sensor=1 ; sensor<=NUMBER_OF_PLUGS;sensor++) {
          // Register all sensors to gw (they will be created as child devices)
          present(sensor, S_LIGHT);
        }
      }
      
      
      void loop() 
      {
        
      }
      
      void receive(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
        int incomingLightState =  message.getBool(); 
        int incomingOutlet = message.sensor;
        
        Serial.print("Outlet #: ");
        Serial.println(message.sensor);
        Serial.print("Command: ");
        Serial.println(message.getBool());
       
       if (incomingOutlet==1) {
       if (incomingLightState==1) {
          // Turn on  socket 1
          Serial.println("Turn on Socket 1");
       mySwitch.send(CODE_1On, 24); // These codes are unique to each outlet
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 1
       Serial.println("Turn off Socket 1");
      mySwitch.send(CODE_1Off, 24);
      delay(50); 
       }
       }
       if (incomingOutlet==2) {
       if (incomingLightState==1) {
          // Turn on  socket 2
          Serial.println("Turn on Socket 2");
      mySwitch.send(CODE_2On, 24);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 2
       Serial.println("Turn off Socket 2");
      mySwitch.send(CODE_2Off, 24);
      delay(50); 
       }
       }
       if (incomingOutlet==3) {
       if (incomingLightState==1) {
          // Turn on  socket 3
          Serial.println("Turn on Socket 3");
      mySwitch.send(CODE_3On, 24);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 3
       Serial.println("Turn off Socket 3");
      mySwitch.send(CODE_3Off, 24);
      delay(50); 
       }
       }
       if (incomingOutlet==4) {
       if (incomingLightState==1) {
          // Turn on  socket 4
          Serial.println("Turn on Socket 4");
       mySwitch.send(CODE_4On, 24);
       delay(50); 
       }
       if (incomingLightState==0)  {
          // Turn off socket 4
       Serial.println("Turn off Socket 4");
      mySwitch.send(CODE_4Off, 24);
      delay(50); 
       }
       }
        }
       delay(50);
      }
      
      
      posted in My Project
      Matt
      Matt
    • RE: Your workshop :)

      OK here's mine.
      0_1462611008576_WS.jpg

      posted in General Discussion
      Matt
      Matt
    • RE: LM393 as pulse powermeter sensor, swap out 'photodiode'

      OK so rather than wait for shipping from China I went to my local Jaycar and got one of these LDRs. If the link gets broken its a cadmium sulphine LDR with a rise time of 50ms and decay of 40ms.
      Works like a charm. Because its flat I can tape it directly to the LED in my power meter, covering the whole thing with black tape to ensure no ambient light problems. Two pinholes in the tape and the LDR leads go right through no probs. I have some thin wires going to the LM393 unit (so minimal weight on the LDR/Tape itself) and I guess the comparator in there is good enough to pick up the change in resistance on the LED pulses.
      So if you wind up with one of these units I recommend swapping the photodiode with a high spec LDR and soldering some leads from the module to the LDR to facilitate accurate fixing to the meters LED. I used two bits off an old length of ribbon cable (IDE HDD type stuff).

      posted in Hardware
      Matt
      Matt
    • RE: Your workshop :)

      @Samuel235 yeah the Dolmar leaks, I think its a design feature. Problem is I live with three drunken monkeys who are entropy impersonated, as such I cant keep anything inside if I want to find it again.

      posted in General Discussion
      Matt
      Matt
    • RE: Compile error for Pro Mini 5,5v 168

      @mfalkvidd woohoo! Time to resurrect some old nodes 😃
      Thanks for this...

      posted in Bug Reports
      Matt
      Matt
    • RE: 💬 Easy/Newbie PCB for MySensors

      @sundberg84 Hiya yep found it, starts with your post 30th June 2016.
      To be honest its a bit over my head, inductors. ferrite beads etc. A picture of what to solder where would help.
      I did try to 0.1uf cap across OUT and GND but the things still only work for a minute then go silent.
      I will desolder existing booster then add a jumper from vin to vout to see how stable they are with a good solid battery supply.
      If they are reliable I will order some more boosters, but it seems a bit hit and miss as to reliability...
      Unless someone can post a pic or explain (for dummies) how to filter the booster effectively?
      I should pull out my scope, which involves tidying my workbench, not a task I undertake lightly....

      Thanks,
      Matt

      posted in OpenHardware.io
      Matt
      Matt
    • RE: NRF24L01+PA+LNA wiring question

      @parachutesj
      Couple of things - get yourself a cheap multimeter. Indispensable and pretty important piece of kit when you are doing this kind of stuff, will save you frying stuff and help with trouble shooting.
      The PA+LNA version needs around 120 milli amps at peak power (from memory) some of the duinos cant supply this.
      And use the caps as suggested in the wiring guide for the NRF modules on this site.
      Cheers,
      Matt

      posted in Hardware
      Matt
      Matt
    • RE: 433mhz transmitter

      Thanks Boots. One thing I noticed was that three out of five of the receivers I bought did not work. If fact one heated up real quick. So buy a few cos QC in China is pants.

      posted in My Project
      Matt
      Matt
    • RE: 💬 Easy/Newbie PCB for MySensors

      @sundberg84 thanks, that is how I have soldered the 0.1uF cap but it hasnt improved things.
      I was hoping @alexsh1 would be happy to chip in here and show me how to solder the 220uf cap and 3.3uH choke?

      posted in OpenHardware.io
      Matt
      Matt
    • RE: 💬 Building a Raspberry Pi Gateway

      @mfalkvidd OK thanks for your reply.
      Have set up the -d parameter in mysgw.servie and am waiting for it to fall over again.
      If I catch it I will post syslog.
      Thanks,
      Matt

      posted in Announcements
      Matt
      Matt

    Latest posts made by Matt

    • RE: Domotiocz + Rain gauge

      @sundberg84
      Thankyou very much for your reply.
      It seems strange that domoticz would only accept 1mm pulses I wonder if this has changed... In any case it should be easy to save the 'lost' volume and add it to the next bucket in code...
      The internal pullup is switched on in code so reed switch pin won't be floating. Will have a fiddle round with your code today.
      Will also try to calibrate by gauge today will be easy to see max tipping speed and can adjust wait times accordingly...
      Thanks again,
      Matt

      posted in Domoticz
      Matt
      Matt
    • RE: Domotiocz + Rain gauge

      @sundberg84 sorry I know this is an old thread but hoping you can remember how you wrote this code.I have changed it to suit MYS 2.1 as below. I have also added battery level as a separate child ID so I can watch performance over time. Aside from these simple changes the code is all yours from the start of this post. It is built on v8 of your board, controller/GW is latest domoticz beta running on a PI2 using NRFs.
      I have a couple of questions though. I am curious as to why bucketSize needs to be 1, 0.5, 0.25, 0.2 or 0.1 as per your comments and I suspect that when I calibrate my gauge it wont be any of these.
      I am testing at the moment without the gauge. When I earth D3 it actually reports as TWO bucket tips and the volume goes up by 0.5 twice. I dont think this is a bounce issue due to the many wait(1000) functions in your code. Would you know why this is? I have tried changing CHANGE to FALLING in the sleep function. I have a simple reed switch gague.
      Which leads to my third question. Are all the wait times necessary? Could they be much less? I wonder if I will miss bucket tips because of these during heavy rain...
      Many many thanks,
      Matt

      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      #define MY_RADIO_NRF24
      #define MY_RF24_PA_LEVEL RF24_PA_LOW
      #define MY_RF24_DATARATE RF24_250KBPS
      
      
      #include <MySensors.h>  
      
      // Running this in Domoticz stable version 2.5 will not work - upgrade to beta.
      
      #define DIGITAL_INPUT_SENSOR 3                  // The reed switch you attached.  (Only 2 and 3 generates interrupt!)
      #define INTERRUPT DIGITAL_INPUT_SENSOR-2        // Usually the interrupt = pin -2 (on uno/nano anyway)
      
      #define CHILD_ID 1                              // Id of the sensor child
      #define CHILD_ID_BAT 2                          // Id of BAT
      #define SKETCH_NAME "Rain Gauge"                // Change to a fancy name you like
      #define SKETCH_VERSION "1.1"                    // Your version
      
      unsigned long SLEEP_TIME = 18*60000;            // Sleep time (in milliseconds).
      //unsigned long SLEEP_TIME = 20000;             // use this instead for debug
      
      float hwRainVolume = 0;                         // Current rainvolume calculated in hardware.
      int hwPulseCounter = 0;                         // Pulsecount recieved from GW
      float fullCounter = 0;                           // Counts when to send counter
      float bucketSize = 0.5;                           // Bucketsize mm, needs to be 1, 0.5, 0.25, 0.2 or 0.1
      boolean pcReceived = false;                     // If we have recieved the pulscount from GW or not 
      boolean reedState;                              // Current state the reedswitch is in
      boolean oldReedState;                           // Old state (last state) of the reedswitch
      unsigned long lastSend =0;                      // Time we last tried to fetch counter.
      
      MyMessage volumeMsg(CHILD_ID,V_RAIN);
      MyMessage lastCounterMsg(CHILD_ID,V_VAR1);
      MyMessage msgBat(CHILD_ID_BAT, V_VOLTAGE);
      
      //=========================
      // BATTERY VOLTAGE DIVIDER SETUP
      // 1M, 470K divider across battery and using internal ADC ref of 1.1V
      // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
      // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
      // 3.44/1023 = Volts per bit = 0.003363075
      #define VBAT_PER_BITS 0.003363075  
      #define VMIN 1.9                                  //  Vmin (radio Min Volt)=1.9V (564v)
      #define VMAX 3.0                                  //  Vmax = (2xAA bat)=3.0V (892v)
      int batteryPcnt = 0;                              // Calc value for battery %
      int batLoop = 0;                                  // Loop to help calc average
      int batArray[3];                                  // Array to store value for average calc.
      int BATTERY_SENSE_PIN = A0;                       // select the input pin for the battery sense point
      //=========================
      
      void presentation() {
      
        // Send the Sketch Version Information to the Gateway
        sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      
        // Register this device as Rain sensor (will not show in Domoticz until first value arrives)
        present(CHILD_ID, S_RAIN); 
        present(CHILD_ID_BAT, S_MULTIMETER);      
      }
      
      
      void setup()  
      {  
                                                       // use the 1.1 V internal reference
        analogReference(INTERNAL);                     // For battery sensing
        
        pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP);   // sets the reed sensor digital pin as input
      
        reedState = digitalRead(DIGITAL_INPUT_SENSOR); // Read what state the reedswitch is in
        oldReedState = reedState;                      // Set startup position for reedswitch 
        
        Serial.println("Startup completed");
        delay(500);                                    // Allow time for radio if power used as reset
      }
      
      void loop()     
      { 
      unsigned long currentTime = millis();
      
          //See if we have the counter/pulse from Domoticz - and ask for it if we dont.
          if (!pcReceived && (currentTime - lastSend > 5000)) {      
            request(CHILD_ID, V_VAR1);
            lastSend=currentTime;
            return;
          }
          if (!pcReceived) {
            return;
          }
          
      //Read if the bucket tipped over
      reedState = digitalRead(DIGITAL_INPUT_SENSOR);
      boolean tipped = oldReedState != reedState; 
      
          //BUCKET TIPS!
          if (tipped==true) {
          Serial.println("The bucket has tipped over...");
          oldReedState = reedState;
          hwRainVolume = hwRainVolume + bucketSize;
          send(volumeMsg.set((float)hwRainVolume,1));
          wait(1000);
          fullCounter = fullCounter + bucketSize;
      
            //Count so we send the counter for every 1mm
            if(fullCounter >= 1){
            hwPulseCounter++;
            send(lastCounterMsg.set(hwPulseCounter));
            wait(1000);
            fullCounter = 0;
            }
            
          }
          
          if (tipped==false) {
      
           //No bucket tipped over last sleep-period, check battery then...
           batM(); 
          }
      
      lastSend=currentTime;
      sleep(INTERRUPT, FALLING, SLEEP_TIME); 
      //The interupt can be CHANGE or FALLING depending on how you wired the hardware.
      }
      
      //Read if we have a incoming message.
      void receive(const MyMessage &msg) {
          if (msg.type==V_VAR1) {
          hwPulseCounter = msg.getULong();
          hwRainVolume = hwPulseCounter;
          pcReceived = true;
          Serial.print("Received last pulse count from gw: ");
          Serial.println(hwPulseCounter);   
          }
      }
      
      void batM(){  //The battery calculations
        
         delay(500);
         // Battery monitoring reading
         int sensorValue = analogRead(BATTERY_SENSE_PIN);    
         delay(500);
         
         // Calculate the battery in %
         float Vbat  = sensorValue * VBAT_PER_BITS;
         int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
         Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");  
         
         // Add it to array so we get an average of 3 (3x20min)
         batArray[batLoop] = batteryPcnt;
        
         if (batLoop > 1) {  
           batteryPcnt = (batArray[0] + batArray[1] + batArray[2]);
           batteryPcnt = batteryPcnt / 3;
       
         if (batteryPcnt > 100) {
           batteryPcnt=100;
       }
       
           Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %");
             sendBatteryLevel(batteryPcnt);
             send(msgBat.set(Vbat, 4));
             batLoop = 0;
             
           //Sends 1 per hour as a heartbeat.
           send(volumeMsg.set((float)hwRainVolume,1));   
           send(lastCounterMsg.set(hwPulseCounter));
           }
           else 
           {
           batLoop++;
           }
      }```
      posted in Domoticz
      Matt
      Matt
    • RE: 💬 Building a Raspberry Pi Gateway

      @mfalkvidd Thankyou. Stable for now. Not sure if they are even genuine modules so... Can reach outside to my glasshouse even on low power setting.
      If it starts playing up again I'll add verbose logging and have another look.

      posted in Announcements
      Matt
      Matt
    • RE: 💬 Building a Raspberry Pi Gateway

      @mfalkvidd OK have attached the logfiles below.
      No clues that I can see. At 1502 the NRF goes quiet. I have tried a different pi2, different NRF (PA/LNA) and am currently running the NRF off of 5V from the PI through one of those $1.00 regulator adapter things with built in caps and such. Have also tried different PSUs including a 2A one.
      Only thing I can think left to try is reducing the power output in case the high output of the radio module is inducing transients in the cables...
      Am kinda stumped here. I have an arduino NRF gateway that I will try via USB if low power does not work. I have tried setting up MYSGW as LAN and USB via ./configure but the same thing happens each time.
      One thought just came to me, I AM using the pin15 IRQ option on the NRF now that is still experimental?
      So next time will try without IRQ and low power...

      Any help/suggestions greatly appreciated.
      FYI I have had domoticz running on a lubuntu netbook with USB arduino NRF gateway that has been rock solid. Am trying the get a workable PI solution though, for myself and my father in law but not workable as yet sadly...

      At 15:02:34 you can see the last incoming node message after that the only MYSGW activity is the PING thing... which seems to happen every 10S or so. This goes on for an hour after that with no more incomings. I have ~12 sensors around the place including a power meter one which reports every minute.

      15:02:29 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
      Aug  5 15:02:33 raspberrypi mysgw: TSF:MSG:READ,23-23-0,s=1,c=1,t=0,pt=7,l=5,sg=0:18.0
      Aug  5 15:02:33 raspberrypi mysgw: TSF:MSG:READ,23-23-0,s=0,c=1,t=1,pt=7,l=5,sg=0:21.0
      Aug  5 15:02:34 raspberrypi mysgw: TSF:MSG:READ,23-23-0,s=255,c=3,t=0,pt=1,l=1,sg=0:68
      Aug  5 15:02:34 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
      Aug  5 15:02:36 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
      Aug  5 15:02:37 raspberrypi mysgw: TSF:MSG:READ,41-7-0,s=0,c=1,t=0,pt=7,l=5,sg=0:11.6
      Aug  5 15:02:41 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
      Aug  5 15:02:46 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
      Aug  5 15:02:50 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
      Aug  5 15:02:56 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
      Aug  5 15:02:57 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
      Aug  5 15:03:06 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
      Aug  5 15:03:06 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
      Aug  5 15:03:13 raspberrypi dhcpcd[734]: wlan0: Router Advertisement from fe80::260:64ff:fed7:f613
      Aug  5 15:03:16 raspberrypi mysgw: Client 0: 0;0;3;0;18;PING
      

      Also FWIW to log from domoticz below. Ignore FANFLAG thats just a blockly flag I use...

      2017-08-05 15:01:18.936 (GW) General/Voltage (FanIntakeV)
      2017-08-05 15:02:04.935 (GW) General/kWh (Meter)
      2017-08-05 15:02:33.940 (GW) Temp + Humidity (Mitch2)
      2017-08-05 15:02:33.945 (GW) Temp + Humidity (Mitch2)
      2017-08-05 15:02:37.941 (GW) Temp (MBR Fan)
      2017-08-05 15:50:02.678 Set UserVariable FanFlag = 1
      2017-08-05 15:51:02.693 Set UserVariable FanFlag = 1
      2017-08-05 15:52:02.703 Set UserVariable FanFlag = 1
      2017-08-05 15:53:02.710 Set UserVariable FanFlag = 1
      2017-08-05 15:54:00.037 Set UserVariable FanFlag = 1
      

      Thanks,
      Matt

      posted in Announcements
      Matt
      Matt
    • RE: 💬 Building a Raspberry Pi Gateway

      @mfalkvidd OK thanks for your reply.
      Have set up the -d parameter in mysgw.servie and am waiting for it to fall over again.
      If I catch it I will post syslog.
      Thanks,
      Matt

      posted in Announcements
      Matt
      Matt
    • RE: 💬 Building a Raspberry Pi Gateway

      Hi guys couple of questions, apologies if they have been covered elsewhere.
      I am running latest dev branches of domoticz and MYS on a pi2.
      At random times it seems the NRF24L01+ LNA/PA goes down, or MYS goes down and domotics stops receiving signals from all of the nodes at the same time. I have the interrupt feature enabled.
      I have set the option under domoticz/hardware/data timeout to restart if no data received in five minutes but I dont think this is an ideal solution, and have yet to find out if this domoticz feature actually works in my scenario.
      Any idea what causes this? I found an old thread over on the domoticz/mysensors forum but no answers there. I am using a new sd card class 10.
      What I want to do is try out the different MYS builds on domoticz ie MQTT and SERIAL as well as ethernet which I am currently running. However I'm not sure how to stop the current MYS service and completely clean up the current build to start from scratch... I have tried just re entering the ./configure commands then 'make' but this does not seem to work.
      Many thanks,
      Matt

      posted in Announcements
      Matt
      Matt
    • RE: Compile error for Pro Mini 5,5v 168

      @mfalkvidd woohoo! Time to resurrect some old nodes 😃
      Thanks for this...

      posted in Bug Reports
      Matt
      Matt
    • RE: 💬 Easy/Newbie PCB for MySensors

      Had further problems with intermittent sends. Sometimes on initial presentation it only sends the sketch name and not version number. Also sends are infrequent up to six hours apart. When it does send it often only sends one child_id when there are three to send.
      Previously I thought this was most likely an issue with a noisy boost converter. However I just tried replacing the 4.7uf cap on the radio with a 47uf one. Problem solved!
      Matt

      posted in OpenHardware.io
      Matt
      Matt
    • RE: 💬 Easy/Newbie PCB for MySensors

      @Matt said:

      @ferro ooh hey, didn't know that... Will have a go. Thanks!

      Nup, didn't work. Must have killed them somehow by removing the regulator. Have a third one running just fine, minus the LED.... Oh well.

      posted in OpenHardware.io
      Matt
      Matt
    • RE: 💬 Easy/Newbie PCB for MySensors

      @ferro ooh hey, didn't know that... Will have a go. Thanks!

      posted in OpenHardware.io
      Matt
      Matt