Navigation

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

    nizoo91

    @nizoo91

    9
    Reputation
    21
    Posts
    294
    Profile views
    0
    Followers
    5
    Following
    Joined Last Online

    nizoo91 Follow

    Best posts made by nizoo91

    • RE: OpenHAB 2.5 MySensors Serial Gateway - How to install

      @flipflap3 said in OpenHAB 2.4 MySensors Serial Gateway - How to install:

      feature:install openhab-transport-serial

      can you please add

      "feature:install esh-io-transport-mqtt"
      

      to the tutorial it is required to get it to work even in Serial 🙂

      posted in OpenHAB
      nizoo91
      nizoo91
    • RE: NRF24L01+ on SPI1, TFT on SPI0

      For anyone interested in something similar, you have to specify the following when using ./configre..

      --spi-driver=SPIDEV
      

      I added the above and it worked like a charm!

      For some reason, my TFT disables both SPI0 & SPI1, which took me sometime to figure out on how re-enable it! once that was done, it was a piece of cake!

      complete command:

      sudo ./configure --my-gateway=serial --my-debug=enable --my-serial-is-pty --my-serial-groupname=tty --my-transport=rf24 --my-rf24-channel=76 --my-rf24-ce-pin=37 --my-rf24-cs-pin=29 --spi-spidev-device=/dev/spidev1.0 --spi-driver=SPIDEV
      
      posted in Hardware
      nizoo91
      nizoo91
    • RE: Temp-Monitoring using OpenHab, MQTT, Pi 3 & Uno

      Wohoo got it to finally work 🙂

      not using MQTT but via serial gateway which is good enough for now 🙂

      posted in Troubleshooting
      nizoo91
      nizoo91
    • RE: NRF24L01+ on SPI1, TFT on SPI0

      @monte said in NRF24L01+ on SPI1, TFT on SPI0:

      he pins are: SPI1 CS0

      While the link you have provided is true and it may work, (I have not tested that method) you can simply do the following which is much easier:

      //cs0_pin=5 is GPIO pin, which is PIN 29

      dtoverlay=spi1-1cs,cs0_pin=5
      

      you can basically pick whichever pin you want as long as you tell MySensors which pin you are using when you run the ./configure using:

      --my-rf24-cs-pin=29
      
      posted in Hardware
      nizoo91
      nizoo91
    • RE: Temp-Monitoring using OpenHab, MQTT, Pi 3 & Uno

      @mfalkvidd, @bgunnarb & @waspie

      Thank you for the help guys, to be honest I felt fairly out dated because I wasn't able to get it working first try! as usually I am a tech guru, and I am able to just get things working the way I want fairly easily!

      Anyhow, I will keep digging and see what I can do! I definitely need to get my head around it, but also need to get this up and running for my school project, as this will be my project for end of the semester! and will be using it in our family Restaurant after 🙂 and yes, free food for everyone that helps me out haha 😉

      Will report back with any questions 🙂

      @waspie I would love to make it as simple as possible for the school project purposes, so I can get it done and take my time tinkering later on with MQTT and everything else, but I absolutely need a working device to present within 2 months 🙂

      Cheers

      posted in Troubleshooting
      nizoo91
      nizoo91

    Latest posts made by nizoo91

    • RE: Sending custom value to move DC motor a specific # of degrees

      @nagelc said in Sending custom value to move DC motor a specific # of degrees:

      Yes. This looks good. Dropped it in the parser here: https://www.mysensors.org/build/parser
      Looks like V_VAR1 is being sent with value 55.
      I think the code I posted above should get it from the incoming message and assign to target. If not, then I am not sure what is the problem. Perhaps someone that has worked more with V_VAR can respond?

      Actually I finally got it to work! and yes indeed, it was using your code!!! 🙂
      I don't know what I was doing before, but I tried your code previously but didn't work, and the only way to read the value was using : target = message.getString(); for some reason..

      But I changed quite a few things in the code, and now when I tried your code again, it actually worked!

      Dude thank you, you are a hero! I will post the final version once I polish up the code in case anyone else needs to do a similar thing!

      posted in Development
      nizoo91
      nizoo91
    • RE: Sending custom value to move DC motor a specific # of degrees

      @nizoo91 said in Sending custom value to move DC motor a specific # of degrees:

      Yah tried to find examples on the forums with no luck unfortunately 😕

      I am able to receive & send the last value from/to OpenHAB
      However I am unable to convert the payload to = target... that is the only missing piece I think..

      this is from my debug log

      183728 TSF:MSG:READ,0-0-1,s=6,c=1,t=24,pt=0,l=2,sg=0:55
      183735 TSF:MSG:SEND,1-1-0-0,s=6,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
      
      posted in Development
      nizoo91
      nizoo91
    • RE: Sending custom value to move DC motor a specific # of degrees

      Yah tried to find examples on the forums with no luck unfortunately 😕

      I am able to receive & send the last value from/to OpenHAB, however I am unable to convert the payload to = target... that is the only missing piece I think..

      this is from my debug log

      183728 TSF:MSG:READ,0-0-1,s=6,c=1,t=24,pt=0,l=2,sg=0:55
      183735 TSF:MSG:SEND,1-1-0-0,s=6,c=2,t=24,pt=0,l=0,sg=0,ft=0,st=OK:
      
      posted in Development
      nizoo91
      nizoo91
    • RE: Sending custom value to move DC motor a specific # of degrees

      Any idea on how I can do this guys? 🙂

      I basically need whatever value I receive from V_VAR1 to = target

      I am receiving the values I send from OpenHAB, but at the moment it does nothing because I don't know how to define this 😕

      Please correct me if I am wrong but it should look something like this in the void loop() no?
      if V_VAR1 value is updated
      then V_VAR1 value = target
      then run loop..

      Just don't know how to do it in programming language 🙂 any help would be appreciated 🙂

      posted in Development
      nizoo91
      nizoo91
    • Sending custom value to move DC motor a specific # of degrees

      Hello everyone,

      On to a new project, I have a DC motor with an encoder that I would like to control from OpenHAB, would appreciate some help in directing me to the right place, as I have not been able to find any solutions on my own yet 😕

      Basically I need to send a custom degree value from OpenHAB to the Node, and the motor should move that many degrees, store the value and display "current" position in degrees would be ideal. (the value I sent last)

      I was able to move the motor using the code below, if placed within void receive(const MyMessage &message) however it would not stop the motor at the right degree... so clearly I was doing something wrong 😕

      Right now the bellow code will move the motor to "target" which is set at 360 on the sketch

      // 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>
      #define CHILD_ID 6
      
      
      MyMessage message(CHILD_ID, S_CUSTOM);
      
      #define total 7560                     //x4 pulses per rotation.
      #define target 360
      #define motorSpeed 125                 //Change speed of the motor. 125 to 135 is optimal speed for perfect stops
      long degree;
      long pulses;                              //Output pulses.
      int encoderA = 3;
      int encoderB = 2;
      const int pwm = 5;                      //Power of motor.
      const int dir = 6;
      const int dir2 = 7;                      //Direction of the motor.
      int pulsesChanged = 5;
      #define degree pulses/21                   // total / 360 = total ticks per degree of shaft rotation
      
      void setup() 
      {
        Serial.begin(115200);
        pinMode(pwm, OUTPUT);
        pinMode(dir, OUTPUT);
        pinMode(dir2, OUTPUT);
        analogWrite(pwm, 0);                     //Make sure the motor in reset mode.
        digitalWrite(dir, HIGH);
        digitalWrite(dir2, HIGH);
        pinMode(encoderA, INPUT);
        pinMode(encoderB, INPUT);
        delay(50);
        attachInterrupt(0, A_CHANGE, CHANGE);
        attachInterrupt(1, B_CHANGE, CHANGE);
      }
      
      void presentation()  
      { 
        sendSketchInfo("Program", "1.0");
        present(CHILD_ID, S_CUSTOM);
      }
      
      void loop() 
      {
          if(degree==target){
          analogWrite(pwm,0);
          digitalWrite(dir,HIGH);
          digitalWrite(dir2,HIGH);
          delay(500);
          //saveState(message.sensor, message.getBool());
          //request(CHILD_ID, V_VAR1);
          return;
          
        }
        else{
          if (degree>target){
            analogWrite(pwm,motorSpeed);
            digitalWrite(dir,LOW);
            digitalWrite(dir2,HIGH);
            //saveState(message.sensor, message.getBool());
            //request(CHILD_ID, V_VAR1);
      
            
          }
          else if(degree<target){
            analogWrite(pwm,motorSpeed);
            digitalWrite(dir,HIGH);
            digitalWrite(dir2,LOW);
            //saveState(message.sensor, message.getBool());
            //request(CHILD_ID, V_VAR1);
          }
        }
        if (pulsesChanged != 0) {
          pulsesChanged = 0;
          Serial.println(degree);
        }
      }
      
      void receive(const MyMessage &message) {
            saveState(message.sensor, message.getBool());
            request(CHILD_ID, V_VAR1);
      
      }
      
      void A_CHANGE(){
        if( digitalRead(encoderB) == 0 ) {
          if ( digitalRead(encoderA) == 0 ) {
            // A fell, B is low
            pulses--; // moving reverse
          } else {
            // A rose, B is low
            pulses++; // moving forward
          }
        }else {
          if ( digitalRead(encoderA) == 0 ) {
            // B fell, A is high
            pulses++; // moving reverse
          } else {
            // B rose, A is high
            pulses--; // moving forward
          }
        }
        pulsesChanged = 1;
      }
      
      void B_CHANGE(){
        if ( digitalRead(encoderA) == 0 ) {
          if ( digitalRead(encoderB) == 0 ) {
            // B fell, A is low
            pulses++; // moving forward
          } else {
            // B rose, A is low
            pulses--; // moving reverse
          }
       } else {
          if ( digitalRead(encoderB) == 0 ) {
            // B fell, A is high
            pulses--; // moving reverse
          } else {
            // B rose, A is high
            pulses++; // moving forward
          }
        }
        pulsesChanged = 1;
      }```
      posted in Development
      nizoo91
      nizoo91
    • RE: NRF24L01+ on SPI1, TFT on SPI0

      @monte said in NRF24L01+ on SPI1, TFT on SPI0:

      @nizoo91 that's nice, but i didn't found this method. Thanks for the tip! It is definitely easier to do this way 🙂
      But my main point was to help someone who will try to compile mysgw for SPI1 and it won't work, because picture he refered to was wrong... I may be stupid, but i spent whole day figuring that out 🙂

      For sure 🙂 trust me I have been there and done that, spent days trying to figure something out and to find out it was the simplest thing to solve hahah

      Anyhow, checkout this site for any pin reference you need. I found it to be very accurate 😉

      https://pinout.xyz/pinout/spi

      posted in Hardware
      nizoo91
      nizoo91
    • RE: NRF24L01+ on SPI1, TFT on SPI0

      @monte said in NRF24L01+ on SPI1, TFT on SPI0:

      he pins are: SPI1 CS0

      While the link you have provided is true and it may work, (I have not tested that method) you can simply do the following which is much easier:

      //cs0_pin=5 is GPIO pin, which is PIN 29

      dtoverlay=spi1-1cs,cs0_pin=5
      

      you can basically pick whichever pin you want as long as you tell MySensors which pin you are using when you run the ./configure using:

      --my-rf24-cs-pin=29
      
      posted in Hardware
      nizoo91
      nizoo91
    • RE: NRF24L01+ on SPI1, TFT on SPI0

      For anyone interested in something similar, you have to specify the following when using ./configre..

      --spi-driver=SPIDEV
      

      I added the above and it worked like a charm!

      For some reason, my TFT disables both SPI0 & SPI1, which took me sometime to figure out on how re-enable it! once that was done, it was a piece of cake!

      complete command:

      sudo ./configure --my-gateway=serial --my-debug=enable --my-serial-is-pty --my-serial-groupname=tty --my-transport=rf24 --my-rf24-channel=76 --my-rf24-ce-pin=37 --my-rf24-cs-pin=29 --spi-spidev-device=/dev/spidev1.0 --spi-driver=SPIDEV
      
      posted in Hardware
      nizoo91
      nizoo91
    • RE: NRF24L01+ on SPI1, TFT on SPI0

      @mfalkvidd Thank you for that, however I am still having issues trying to run the NRF24 from SPI1, I tried replacing the NRF24 as well but still didn't work 😕

      Ls /dev/ shows: spidev1.0

      This is what I added to /boot/config.txt
      Because the default is GPIO 18 (Pin12) which is being used by the TFT.

      # Enable audio (loads snd_bcm2835) (the below is added by the TFT setup)
      dtparam=audio=on
      dtoverlay=mhs35
      hdmi_force_hotplug=1
      hdmi_group=2
      hdmi_mode=1
      hdmi_mode=87
      hdmi_cvt 480 320 60 6 0 0 0
      hdmi_drive=2
      
      
      #below are things I added: 
      #disable bluetooth, not sure why I did this.. 
      dtoverlay=pi3-disable-bt
      
      #enabled spi1 with 1cs pin (default is BCM18, therefor I moved it to BCM 5 / PIN 29)
      dtoverlay=spi1-1cs,cs0_pin=5
      

      This is the line I am using now:

      sudo ./configure --my-gateway=serial --my-debug=enable --my-serial-is-pty --my-serial-groupname=tty --my-transport=rf24 --my-rf24-channel=76 --my-rf24-ce-pin=37 --my-rf24-cs-pin=29 --spi-spidev-device=/dev/spidev1.0
      
      [SECTION] Detecting target machine.
        [OK] machine detected: SoC=BCM2837, Type=rpi3, CPU=armv7l.
      [SECTION] Detecting SPI driver.
        [OK] SPI driver detected:BCM.
      [SECTION] Gateway configuration.
        [OK] Type: serial.
        [OK] Transport: rf24.
        [OK] Signing: Disabled.
        [OK] Encryption: Disabled.
        [OK] CPPFLAGS: -DMY_RADIO_RF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DSPI_SPIDEV_DEVICE="/dev/spidev1.0" -DMY_RF24_CS_PIN=29 -DMY_RF24_CE_PIN=37 -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_GROUPNAME="tty" -DMY_LINUX_SERIAL_IS_PTY
      [SECTION] Detecting init system.
        [OK] Init system detected: systemd.
      [SECTION] Saving configuration.
        [OK] Saved.
      [SECTION] Cleaning previous builds.
        [OK] Finished.
      
      • Getting the following after installing:
      pi@raspberrypi:~/MySensors $ sudo ./bin/mysgw
      Mar 11 04:11:02 INFO  Starting gateway...
      Mar 11 04:11:02 INFO  Protocol version - 2.3.1
      Mar 11 04:11:02 DEBUG Serial port /dev/ttyUSB0 (115200 baud) created
      Mar 11 04:11:02 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,REL=255,VER=2.3.1
      Mar 11 04:11:02 DEBUG TSF:LRT:OK
      Mar 11 04:11:02 DEBUG TSM:INIT
      Mar 11 04:11:02 DEBUG TSF:WUR:MS=0
      Mar 11 04:11:02 DEBUG !TSM:INIT:TSP FAIL
      Mar 11 04:11:02 DEBUG TSM:FAIL:CNT=1
      Mar 11 04:11:02 DEBUG TSM:FAIL:DIS
      Mar 11 04:11:02 DEBUG TSF:TDI:TSL
      Mar 11 04:11:12 DEBUG TSM:FAIL:RE-INIT
      Mar 11 04:11:12 DEBUG TSM:INIT
      Mar 11 04:11:12 DEBUG !TSM:INIT:TSP FAIL
      Mar 11 04:11:12 DEBUG TSM:FAIL:CNT=2
      Mar 11 04:11:12 DEBUG TSM:FAIL:DIS
      Mar 11 04:11:12 DEBUG TSF:TDI:TSL
      

      any additional suggestions?

      posted in Hardware
      nizoo91
      nizoo91
    • NRF24L01+ on SPI1, TFT on SPI0

      Hello guys,

      MySensors + Openhab + Serial = DONE and I can almost do it with my eyes closed now hahaha thanks to the forums!

      however I need to use the SPI1 for the NRF24L01 and leave the main SPI for a Touch Display (MHS Series 3.5" from KUMAN>Amazon)

      I have got it to work, after battling it a little bit, and for some reason it disables SPI when you load the damn thing 😕

      https://github.com/goodtft/LCD-show.git

      sudo ./MHS35-show
      

      but I was able to re-enable the SPI by de-compiling the overlay file "mhs35.dtbo" enable SPI then compile again..

      ls /dev/ gives me the following

      autofs           fuse       loop1             mqueue              ram14    serial1    tty14  tty27  tty4   tty52  tty8       vcs2   vcsm
      block            gpiochip0  loop2             net                 ram15    shm        tty15  tty28  tty40  tty53  tty9       vcs3   vhci
      btrfs-control    gpiochip1  loop3             network_latency     ram2     snd        tty16  tty29  tty41  tty54  ttyAMA0    vcs4   watchdog
      bus              gpiochip2  loop4             network_throughput  ram3     spidev1.0  tty17  tty3   tty42  tty55  ttyprintk  vcs5   watchdog0
      cachefiles       gpiomem    loop5             null                ram4     stderr     tty18  tty30  tty43  tty56  ttyS0      vcs6   zero
      char             hidraw0    loop6             ppp                 ram5     stdin      tty19  tty31  tty44  tty57  uhid       vcs7
      console          hidraw1    loop7             ptmx                ram6     stdout     tty2   tty32  tty45  tty58  uinput     vcsa
      cpu_dma_latency  hwrng      loop-control      pts                 ram7     tty        tty20  tty33  tty46  tty59  urandom    vcsa1
      cuse             i2c-1      mapper            ram0                ram8     tty0       tty21  tty34  tty47  tty6   usb        vcsa2
      disk             initctl    mem               ram1                ram9     tty1       tty22  tty35  tty48  tty60  vchiq      vcsa3
      fb0              input      memory_bandwidth  ram10               random   tty10      tty23  tty36  tty49  tty61  vcio       vcsa4
      fb1              kmsg       mmcblk0           ram11               raw      tty11      tty24  tty37  tty5   tty62  vc-mem     vcsa5
      fd               log        mmcblk0p1         ram12               rfkill   tty12      tty25  tty38  tty50  tty63  vcs        vcsa6
      full             loop0      mmcblk0p2         ram13               serial0  tty13      tty26  tty39  tty51  tty7   vcs1       vcsa7
      

      I do see "spidev1.0" which is a good thing, however I don't see "tty/USB0" like I used to when installing MySensors 😕

      Tutorials I followed :
      Double SPI Radio Raspberry Pi
      OpenHAB 2.4 MySensors Serial Gateway - How to install (only did MySensors portion)

      with the following "edited" ./configure line

      sudo ./configure --my-gateway=serial --my-debug=enable --my-signing-debug --my-serial-is-pty --my-serial-groupname=tty --my-transport=rf24 --my-rf24-channel=76 --my-rf24-ce-pin=37 --my-rf24-cs-pin=36
      
      • Getting the following from MySensors...
      pi@raspberrypi:~/MySensors $ sudo ./bin/mysgw
      Mar 10 10:51:16 INFO  Starting gateway...
      Mar 10 10:51:16 INFO  Protocol version - 2.3.1
      Mar 10 10:51:16 DEBUG Serial port /dev/ttyUSB0 (115200 baud) created
      Mar 10 10:51:16 DEBUG MCO:BGN:INIT GW,CP=RNNGL---,REL=255,VER=2.3.1
      Mar 10 10:51:16 DEBUG TSF:LRT:OK
      Mar 10 10:51:16 DEBUG TSM:INIT
      Mar 10 10:51:16 DEBUG TSF:WUR:MS=0
      Mar 10 10:51:16 DEBUG !TSM:INIT:TSP FAIL
      Mar 10 10:51:16 DEBUG TSM:FAIL:CNT=1
      Mar 10 10:51:16 DEBUG TSM:FAIL:DIS
      Mar 10 10:51:16 DEBUG TSF:TDI:TSL
      
      • mini-display stopped booting to desktop and the last line is:

      [ ]Starting Load/Save RF Kill Switch Status

      Any suggestions to where I can start? don't I need to define which pins are used for MISO, MOSI & CLK? I am using the "alternate" pins described as per the picture on MySensors:
      alt text

      posted in Hardware
      nizoo91
      nizoo91