Navigation

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

    bsmtdweller

    @bsmtdweller

    6
    Reputation
    15
    Posts
    4
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    bsmtdweller Follow

    Best posts made by bsmtdweller

    • RE: Help with multiple servos

      I finally got it!! Staring me in the face the whole time! Forgetting the arrays portion, because I still can't figure that out with multiple servos and messages.

      My problem was that in the void receive 'if' conditions, I needed to specify from which child ID - right, we knew that part - but I ALSO needed to add the child ID conditional statement to ALL the 'else if' statements!

      Thanks to everyone for their help!!

      posted in Troubleshooting
      bsmtdweller
      bsmtdweller
    • RE: Pi 4 ethernet gateway with NRF24L01 + PA and LNA & Domoticz

      @mfalkvidd Thanks for your help! I wasn't utilizing the debug feature on the node (I had to uncomment it), but once I had that at my disposal, it was helpful to know the gateway radio was either not receiving, not acknowledging, or both. The radios I bought were the cheapest ones on amazon from a Chinese seller under the "brand" of "SongHe". The chip might be a valid (yet cloned) nrf24l01+ chip, but everything else about these boards screams fake-clone - not even any markings to identify the pins. Once I pulled one of my other radios out of another project and plugged it all in, voila - it works!! I was so happy! Thanks again!

      posted in My Project
      bsmtdweller
      bsmtdweller
    • RE: Help with multiple servos

      Hi @mfalkvidd - thanks! That definitely makes it more fun! I set it up without resistors as the voltages produced on the servo pins are millivolts (hopefully not enough to burn an led). I'm re-working the code again with some arrays and will hopefully be able to report back with success😬

      posted in Troubleshooting
      bsmtdweller
      bsmtdweller
    • RE: Pi 4 ethernet gateway with NRF24L01 + PA and LNA & Domoticz

      @bsmtdweller Update to this mystery:

      1. I added a 1micro farad tantalum cap right at the RX radio, which initially did not start working, but after a few minutes, did start working. Observing the radios communicate for about an hour, the RX radio would work normally for a period, then fail - not ack sending radio, then go back to working. These observations lend real credibility that these radios are RIDICULOUSLY sensitive to their power supply - at least in this use case. (my RX radio is the nrf24l01+ PA + LNA with added 470 micro farad electrolytic cap after the regulator and now the tantalum cap at the board)

      2. I dont know if it is factoring into these symptoms, but it may -- I'm not using the IRQ pin, which seems to play a vital role in the radio's sleep behavior and therefor power consumption (at least as it relates to the charging of the caps) which might explain the intermittent successes. Later I will add the IRQ wire into the mix.

      3. Being honest - I have been banging my head against the wall with this and wanted to give up on it many times! But perseverance does pay off -- so any of you newcomers (like me) reading this -- dont give up!!

      posted in My Project
      bsmtdweller
      bsmtdweller
    • RE: Pi 4 ethernet gateway with NRF24L01 + PA and LNA & Domoticz

      @mfalkvidd Thank you very much! So, this whole thing is a bit wonky! But when I stopped the gw and started it again, the new sensor was picked up! What the hell. They are both being recognized by the controller now, although there are still some strange behaviors happening. But now that I have the gateway log at my disposal, I have the ability to utilize the log parser and get a better understanding of what is going on.

      Thanks again @mfalkvidd, you the man! I'm sure you will hear more from me soon!

      posted in My Project
      bsmtdweller
      bsmtdweller

    Latest posts made by bsmtdweller

    • RE: Help with multiple servos

      I finally got it!! Staring me in the face the whole time! Forgetting the arrays portion, because I still can't figure that out with multiple servos and messages.

      My problem was that in the void receive 'if' conditions, I needed to specify from which child ID - right, we knew that part - but I ALSO needed to add the child ID conditional statement to ALL the 'else if' statements!

      Thanks to everyone for their help!!

      posted in Troubleshooting
      bsmtdweller
      bsmtdweller
    • RE: Help with multiple servos

      Hi @mfalkvidd - thanks! That definitely makes it more fun! I set it up without resistors as the voltages produced on the servo pins are millivolts (hopefully not enough to burn an led). I'm re-working the code again with some arrays and will hopefully be able to report back with success😬

      posted in Troubleshooting
      bsmtdweller
      bsmtdweller
    • RE: Help with multiple servos

      Thanks @Nca78! Thats exactly it! But how? I dug through the messages.h and found a "getSensor()" command. Prior to discovering that, I went through and re-wrote the code with no arrays hoping that it would simplify my understanding of whats going on. The new code is below. I feel it is close, but I'm still missing something - when a command is received all three servo pins respond, so while I think I have the root of the problem identified I'm struggling with syntax to make it work properly.

      Also thanks to @skywatch for chiming in - I was reading through his 2019 topic with @mfalkvidd - which seems applicable too regarding formatting the 'void receive' function. With such a jumbled, non-array-simplified code, my next step was to try and put chunks together in a separate function and then combine that into the void receive function. My gut tells me that won't help and I better get a more thorough understanding of simplifying with arrays first!

      Another question - I read somewhere that in order to accurately test this, there needs to be physical servos connected? My project where I have the servos installed, it out in the shop, far away from my computer -- so I've been simply testing the output of the pins with my voltmeter during this preliminary testing.

      Heres the non-array written code:

      #define MY_DEBUG
      #define MY_RF24_CE_PIN 49
      #define MY_RF24_CS_PIN 53
      #define MY_RF24_IRQ_PIN 2
      #define MY_RF24_PA_LEVEL RF24_PA_LOW
      // Enable and select radio type attached
      #define MY_RADIO_RF24
      //#define MY_RADIO_RFM69
      
      #include <MySensors.h>
      #include <Servo.h>
      
      #define SERVO_MIN 0
      #define SERVO_MAX 180
      #define DETACH_DELAY 900
      #define CHILD_ID1  13
      #define CHILD_ID2  14
      #define CHILD_ID3  15
      Servo servos1;
      Servo servos2;
      Servo servos3;
      #define servoPin1  39
      #define servoPin2  40
      #define servoPin3  41
      
      MyMessage msg1(CHILD_ID1, V_DIMMER);
      MyMessage msg2(CHILD_ID2, V_DIMMER);
      MyMessage msg3(CHILD_ID3, V_DIMMER);
      
      unsigned long timeOfLastChange = 0;
      bool attachedServo = false;
      
      
      void setup()
      {
        // Request last servo state at startup
      
        request(CHILD_ID1, V_DIMMER);
        request(CHILD_ID2, V_DIMMER);
        request(CHILD_ID3, V_DIMMER);
      
      
      }
      
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Servo", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
      
        present(CHILD_ID1, S_COVER);
        present(CHILD_ID2, S_COVER);
        present(CHILD_ID3, S_COVER);
      }
      
      
      void loop()
      {
      
        if (attachedServo && millis() - timeOfLastChange > DETACH_DELAY) {
          servos1.detach();
          servos2.detach();
          servos3.detach();
          attachedServo = false;
      
        }
      }
      
      void receive(const MyMessage &message) {
        Serial.println("   This is the Id of the Message     ");
        Serial.println(message.getSensor());
      
      
        if (message.type == V_DIMMER && message.getSensor() == CHILD_ID1) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
          servos1.attach(servoPin1);
          int val = message.getInt();
          servos1.write(SERVO_MAX + (SERVO_MIN - SERVO_MAX) / 100 * val); // sets the servo position 0-180
          // Write some debug info
          Serial.print("Servo changed. new state: ");
          Serial.println(val);
        } else if (message.type == V_UP) {
          Serial.println("Servo UP command");
          servos1.write(SERVO_MIN);
          send(msg1.set(100));
        } else if (message.type == V_DOWN) {
          Serial.println("Servo DOWN command");
          servos1.write(SERVO_MAX);
          send(msg1.set(0));
        } else if (message.type == V_STOP) {
          Serial.println("Servo STOP command");
          servos1.detach();
          attachedServo = false;
        }
      
        if (message.type == V_DIMMER && message.getSensor() == CHILD_ID2) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
          servos2.attach(servoPin2);
          int val = message.getInt();
          servos2.write(SERVO_MAX + (SERVO_MIN - SERVO_MAX) / 100 * val); // sets the servo position 0-180
          // Write some debug info
          Serial.print("Servo changed. new state: ");
          Serial.println(val);
        } else if (message.type == V_UP) {
          Serial.println("Servo UP command");
          servos2.write(SERVO_MIN);
          send(msg2.set(100));
        } else if (message.type == V_DOWN) {
          Serial.println("Servo DOWN command");
          servos2.write(SERVO_MAX);
          send(msg2.set(0));
        } else if (message.type == V_STOP) {
          Serial.println("Servo STOP command");
          servos2.detach();
          attachedServo = false;
        }
      
        if (message.type == V_DIMMER && message.getSensor() == CHILD_ID3) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
          servos3.attach(servoPin3);
          int val = message.getInt();
          servos3.write(SERVO_MAX + (SERVO_MIN - SERVO_MAX) / 100 * val); // sets the servo position 0-180
          // Write some debug info
          Serial.print("Servo changed. new state: ");
          Serial.println(val);
        } else if (message.type == V_UP) {
          Serial.println("Servo UP command");
          servos3.write(SERVO_MIN);
          send(msg3.set(100));
        } else if (message.type == V_DOWN) {
          Serial.println("Servo DOWN command");
          servos3.write(SERVO_MAX);
          send(msg3.set(0));
        } else if (message.type == V_STOP) {
          Serial.println("Servo STOP command");
          servos3.detach();
          attachedServo = false;
        }
      
        timeOfLastChange = millis();
      
      
      }
      
      posted in Troubleshooting
      bsmtdweller
      bsmtdweller
    • Help with multiple servos

      I'm hoping someone can nudge me in the right direction. I'm struggling to understand how to make the servo controller sketch control multiple servos, individually. I have added 'for' loops - modeled after the "relay controller" sketch - to get the controller to see the different servos. The node and gw are communicating, and the controller (Domoticz) sees and wants to command 3 servos, but only 1 pin responds.

      I'm sure its the 'void receive' part of the code but I'm stuck trying to get the myservo.attach(?????) part right.

      Any help is greatly appreciated! Heres the sketch:

      / Enable debug prints to serial monitor
      #define MY_DEBUG 
      #define MY_RF24_CE_PIN 49
      #define MY_RF24_CS_PIN 53
      #define MY_RF24_IRQ_PIN 2
      #define MY_RF24_PA_LEVEL RF24_PA_LOW
      // Enable and select radio type attached
      #define MY_RADIO_RF24
      //#define MY_RADIO_RFM69
      
      #include <MySensors.h>
      #include <Servo.h> 
      
      #define SERVO_DIGITAL_OUT_PIN 39
      #define NUMBER_OF_SERVOS 3 
      #define SERVO_MIN 0 // Fine tune your servos min. 0-180
      #define SERVO_MAX 180  // Fine tune your servos max. 0-180
      #define DETACH_DELAY 900 // Tune this to let your movement finish before detaching the servo
      #define CHILD_ID 13   // Id of the sensor child
      MyMessage msg(CHILD_ID, V_DIMMER);
      Servo myservo;  // create servo object to control a servo 
                      // a maximum of eight servo objects can be created Sensor gw(9,10);
      unsigned long timeOfLastChange = 0;
      bool attachedServo = false;
      
      void before()
      {
        for (int sensor=1, pin=SERVO_DIGITAL_OUT_PIN; sensor<=NUMBER_OF_SERVOS; sensor++, pin++) {
          // Then set relay pins in output mode
          pinMode(pin, OUTPUT);
        }
      }
      void setup() 
      { 
        for (int sensor=1, pin=SERVO_DIGITAL_OUT_PIN; sensor<=NUMBER_OF_SERVOS; sensor++, pin++) {
        // Request last servo state at startup
        request(CHILD_ID, V_DIMMER);
        }
      } 
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Servo", "1.0");
      for (int sensor=1, pin=SERVO_DIGITAL_OUT_PIN; sensor<=NUMBER_OF_SERVOS; sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID, S_COVER);
      }
      }
      
      void loop() 
      { 
        if (attachedServo && millis() - timeOfLastChange > DETACH_DELAY) {
           myservo.detach();
           attachedServo = false;
        }
      } 
      
      void receive(const MyMessage &message) {
        myservo.attach(SERVO_DIGITAL_OUT_PIN);
        attachedServo = true;
      
        if (message.type==V_DIMMER) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
           int val = message.getInt();
           myservo.write(SERVO_MAX + (SERVO_MIN-SERVO_MAX)/100 * val); // sets the servo position 0-180
           // Write some debug info
           Serial.print("Servo changed. new state: ");
           Serial.println(val);
         } else if (message.type==V_UP) {
           Serial.println("Servo UP command");
           myservo.write(SERVO_MIN);
           send(msg.set(100));
         } else if (message.type==V_DOWN) {
           Serial.println("Servo DOWN command");
           myservo.write(SERVO_MAX); 
           send(msg.set(0));
         } else if (message.type==V_STOP) {
           Serial.println("Servo STOP command");
           myservo.detach();
           attachedServo = false;
      
         }
         timeOfLastChange = millis();
      }
      
      posted in Troubleshooting
      bsmtdweller
      bsmtdweller
    • RE: Pi 4 ethernet gateway with NRF24L01 + PA and LNA & Domoticz

      @mfalkvidd Now that I'm getting my feet wet a bit with MySensors, I would like to get your opinion on designing my first "real" project. This might be more appropriate as a new thread, but I will share my objective and follow your advice for either moving it or re-starting it somewhere else (general discussion?)

      The idea is that I have a box, consider it an incubator, where I will need to maintain 80 degrees or so and 50-60% humidity. There will be 3 computer cooling fans to circulate and bring in cool air when too warm, a 110V mini space heater to add heat when its too cool, 2 servo arms to open ventilation gates based on a schedule and if it is too warm, and a solenoid valve to control a gravity drip system (supplied by a bucket of water outside the box) to maintain the humidity. There will be a 16x2 lcd keypad shield used with a simple menu to adjust setpoints and display temp humidity at the box.

      If it were a standalone arduino project, I would be fine - or at least muddle through it to functionality, but I would like to be able to monitor and adjust temp/humidity setpoints through domoticz. The important thing is that the box not rely on the domoticz controller, but rather work with it and when the gateway is down, the program runs its course.

      So from a design perspective, do I plan to code using MySensors and squeeze in the standalone functionality, or vice versa? Also, is it easier/better to have multiple nodes for this project, or can a single node handle what will equate to 2 sensors, and 7 relays.

      Perhaps you know of some other threads that might be similar?

      Thanks so much for your input!!

      posted in My Project
      bsmtdweller
      bsmtdweller
    • RE: Pi 4 ethernet gateway with NRF24L01 + PA and LNA & Domoticz

      @mfalkvidd Thank you very much! So, this whole thing is a bit wonky! But when I stopped the gw and started it again, the new sensor was picked up! What the hell. They are both being recognized by the controller now, although there are still some strange behaviors happening. But now that I have the gateway log at my disposal, I have the ability to utilize the log parser and get a better understanding of what is going on.

      Thanks again @mfalkvidd, you the man! I'm sure you will hear more from me soon!

      posted in My Project
      bsmtdweller
      bsmtdweller
    • RE: Pi 4 ethernet gateway with NRF24L01 + PA and LNA & Domoticz

      @mfalkvidd Please forgive my newness, but I'm not sure where to do what with those instructions. I've been playing with arduino for a couple years, but this is my first go round with raspberry pi. So the configuration file is accessible how? I see it is stated that the path is /etc/mysensors.conf but how do I manipulate it? Is it from the base prompt (pi@raspberrypi:~ $ )? Or from pi@raspberrypi:~/MySensors $ .

      I entered all the commands for each type in the base prompt, then restarted the pi, but how can I view the log in the first option?

      In the second option, this is the output:

      pi@raspberrypi:~ $ tail -f /var/log/syslog
      Aug  1 14:58:04 raspberrypi kernel: [  849.334318] w1_master_driver w1_bus_master1: Attaching one wire slave 00.080000000000 crc c2
      Aug  1 14:58:04 raspberrypi kernel: [  849.345802] w1_master_driver w1_bus_master1: Family 0 for 00.080000000000.c2 is not registered.
      Aug  1 14:58:54 raspberrypi kernel: [  899.290476] v3d fec00000.v3d: MMU error from client L2T (0) at 0x3981000, pte invalid
      Aug  1 14:58:58 raspberrypi kernel: [  902.593309] w1_master_driver w1_bus_master1: Attaching one wire slave 00.880000000000 crc 4e
      Aug  1 14:58:58 raspberrypi kernel: [  902.601096] w1_master_driver w1_bus_master1: Family 0 for 00.880000000000.4e is not registered.
      Aug  1 14:58:58 raspberrypi systemd[1]: Starting Cleanup of Temporary Directories...
      Aug  1 14:58:58 raspberrypi systemd[1]: systemd-tmpfiles-clean.service: Succeeded.
      Aug  1 14:58:58 raspberrypi systemd[1]: Started Cleanup of Temporary Directories.
      Aug  1 14:59:35 raspberrypi kernel: [  940.447725] w1_master_driver w1_bus_master1: Attaching one wire slave 00.480000000000 crc 84
      Aug  1 14:59:35 raspberrypi kernel: [  940.455499] w1_master_driver w1_bus_master1: Family 0 for 00.480000000000.84 is not registered.
      Aug  1 15:00:26 raspberrypi kernel: [  991.152408] w1_master_driver w1_bus_master1: Attaching one wire slave 00.c80000000000 crc 08
      Aug  1 15:00:26 raspberrypi kernel: [  991.160465] w1_master_driver w1_bus_master1: Family 0 for 00.c80000000000.08 is not registered.
      
      
      

      And finally, the 3rd method must not have been performed properly, because it returns:

      pi@raspberrypi:~ $ cat /tmp/mysgw.pipe
      cat: /tmp/mysgw.pipe: No such file or directory
      pi@raspberrypi:~ $ 
      
      
      

      Thank you for your patience!! & Willingness to help!

      posted in My Project
      bsmtdweller
      bsmtdweller
    • RE: Pi 4 ethernet gateway with NRF24L01 + PA and LNA & Domoticz

      @mfalkvidd The radio is out in the open, I've tried holding it up and in different orientations as well as touching the rx antenna. The Domoticz log only shows the original node as connected, it doesn't see the new node. Is there a way to see more detailed output directly from the raspberry pi regarding what it happening with the gateway radio?

      posted in My Project
      bsmtdweller
      bsmtdweller
    • RE: Pi 4 ethernet gateway with NRF24L01 + PA and LNA & Domoticz

      @bsmtdweller Next challenge with this project:

      I'm trying to connect another node now, the first one is humming along with no issues at all. The new node is a arduino nano running the DHT temp sketch. Smaller NRF24 is the radio and powered by an external wall wort --> into regulator --> into a 230 mic farad cap, then a .1 mic farad tantalum --> into radio. This is the second radio I've tried and the symptoms are the same - radio sends message ok, but FPAR fails - much like when I set up the gateway radio. But the 1st node is running fine on through the gw. I've cleared the nodes eeprom, and ran the sketch that @mfalkvidd posted back in 2016 to set a new node ID. Heres a little of the output from the node. Am I supposed to be posting the output this way? or is there a better/preferred way? Thanks for the help!

      MCO:BGN:INIT NODE,CP=RNNNA---,FQ=16,REL=255,VER=2.3.2
      26 TSM:INIT
      28 TSF:WUR:MS=0
      34 TSM:INIT:TSP OK
      36 TSF:SID:OK,ID=42
      38 TSM:FPAR
      41 ?TSF:MSG:SEND,42-42-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      2050 !TSM:FPAR:NO REPLY
      2052 TSM:FPAR
      2056 ?TSF:MSG:SEND,42-42-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      4063 !TSM:FPAR:NO REPLY
      4065 TSM:FPAR
      4069 ?TSF:MSG:SEND,42-42-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      6076 !TSM:FPAR:NO REPLY
      6078 TSM:FPAR
      6082 ?TSF:MSG:SEND,42-42-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      8089 !TSM:FPAR:FAIL
      8090 TSM:FAIL:CNT=1
      
      posted in My Project
      bsmtdweller
      bsmtdweller