Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. How do I get multiple different mock barometers?

How do I get multiple different mock barometers?

Scheduled Pinned Locked Moved Development
53 Posts 6 Posters 8.0k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gohanG gohan

    It's big because it has all the code to simulate almost all sensors 😀

    mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by
    #35

    @gohan yes. And that is a terrible way to teach.

    1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #36

      all-in :D

      1 Reply Last reply
      0
      • rejoe2R rejoe2

        This wait() can also help to avoid packet losses due to insufficient power supply when using nRF24.

        NeverDieN Offline
        NeverDieN Offline
        NeverDie
        Hero Member
        wrote on last edited by NeverDie
        #37

        @rejoe2 said in How do I get multiple different mock barometers?:

        This wait() can also help to avoid packet losses due to insufficient power supply when using nRF24.

        You mean it needs extra time for the auxiliary cap to recharge? If so, surely we can find a better way to power the radio module that doesn't require taking a breather between packets....

        I don't remember how it works with the nRF24L01, but on the RFM69, there's only one buffer for both sending and receiving, so you have to empty the receive buffer before you either send or receive another packet.

        mfalkviddM 1 Reply Last reply
        0
        • NeverDieN NeverDie

          @rejoe2 said in How do I get multiple different mock barometers?:

          This wait() can also help to avoid packet losses due to insufficient power supply when using nRF24.

          You mean it needs extra time for the auxiliary cap to recharge? If so, surely we can find a better way to power the radio module that doesn't require taking a breather between packets....

          I don't remember how it works with the nRF24L01, but on the RFM69, there's only one buffer for both sending and receiving, so you have to empty the receive buffer before you either send or receive another packet.

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #38

          @NeverDie a discussion on that topic is underway in https://github.com/mysensors/MySensors/issues/892

          NeverDieN 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            @NeverDie a discussion on that topic is underway in https://github.com/mysensors/MySensors/issues/892

            NeverDieN Offline
            NeverDieN Offline
            NeverDie
            Hero Member
            wrote on last edited by NeverDie
            #39

            @mfalkvidd
            In that case the nRF52832 should be faster at emptying the buffer, since it doesn't have to rely on the slower SPI bus. And from what I gather, it can also do DMA's, which could speed things up even further.

            mfalkviddM 1 Reply Last reply
            0
            • NeverDieN NeverDie

              @mfalkvidd
              In that case the nRF52832 should be faster at emptying the buffer, since it doesn't have to rely on the slower SPI bus. And from what I gather, it can also do DMA's, which could speed things up even further.

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #40

              @NeverDie for a node I think the bottleneck is the speed of the air transfer. Sending a message takes about 1ms at the default setting of 250kbps. But a busy gateway might benefit from the higher processing speeds on nRF52832.

              NeverDieN 1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @NeverDie for a node I think the bottleneck is the speed of the air transfer. Sending a message takes about 1ms at the default setting of 250kbps. But a busy gateway might benefit from the higher processing speeds on nRF52832.

                NeverDieN Offline
                NeverDieN Offline
                NeverDie
                Hero Member
                wrote on last edited by NeverDie
                #41

                @mfalkvidd said in How do I get multiple different mock barometers?:

                @NeverDie for a node I think the bottleneck is the speed of the air transfer. Sending a message takes about 1ms at the default setting of 250kbps. But a busy gateway might benefit from the higher processing speeds on nRF52832.

                Does it default to 250kbps to compensate for the range problems that the nRF24L01 has? I'm planning to bump mine up to 2mbps if at all possible. That might save appreciably on battery life.

                1 Reply Last reply
                0
                • NeverDieN Offline
                  NeverDieN Offline
                  NeverDie
                  Hero Member
                  wrote on last edited by
                  #42

                  I suppose the

                  wait(long_wait)
                  

                  isn't so bad a power drain if it's actually sleeping rather than busy-waiting for 500ms.

                  1 Reply Last reply
                  0
                  • rmtuckerR rmtucker

                    @NeverDie

                    Here is a little sketch that compiles on the NRF5.

                    // Enable debug prints to serial monitor
                    //#define MY_DEBUG
                    
                    // Enable and select radio type attached
                    #define MY_RADIO_NRF5_ESB
                    
                    /**
                       @def MY_NRF5_ESB_PA_LEVEL
                       @brief Default nRF5 PA level. Override in sketch if needed.
                    
                       - NRF5_PA_MIN = -40dBm
                       - NRF5_PA_LOW = -16dBm
                       - NRF5_PA_HIGH = 0dBm
                       - NRF5_PA_MAX = 4dBm
                    */
                    #define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX)
                    
                    #define MY_NRF5_ESB_CHANNEL (76)
                    
                    #define MY_NRF5_ESB_MODE (NRF5_250KBPS)
                    
                    #define MY_NODE_ID 10
                    #define VOLTAGE     0
                    #include <MySensors.h>
                    
                    float vcc = (hwCPUVoltage() / 1000.0);
                    
                    MyMessage VoltageMsg(VOLTAGE, V_VOLTAGE);
                    
                    void presentation()
                    {
                      sendSketchInfo("General sensor", "1.0");
                      present(VOLTAGE, S_MULTIMETER);
                    }
                    
                    
                    void setup() {
                    //  Serial.begin(115200);
                    //  while (!Serial) ; // wait for Arduino Serial Monitor
                    }
                    
                    void loop() {
                      send(VoltageMsg.set(vcc, 3));
                    //  Serial.print(F("Voltage = "));
                    //  Serial.print(vcc, 3);
                    //  Serial.println(F("v"));
                      sleep(60000);
                    }
                    
                    
                    NeverDieN Offline
                    NeverDieN Offline
                    NeverDie
                    Hero Member
                    wrote on last edited by NeverDie
                    #43

                    @rmtucker said in How do I get multiple different mock barometers?:

                    #define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX)

                    #define MY_NRF5_ESB_CHANNEL (76)

                    #define MY_NRF5_ESB_MODE (NRF5_250KBPS)

                    Just now noticing that your definitions:

                    #define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX)
                    
                    #define MY_NRF5_ESB_CHANNEL (76)
                    
                    #define MY_NRF5_ESB_MODE (NRF5_250KBPS)
                    

                    can also be set in myconfig.h.

                    Strangely, myconfig.h defaults to max Tx power on the nrf52, but not max Tx power on the nrf24. Not sure why, especially since, if anything, the nRF24 needs it more.

                    So, I just now changed myconfig.h to put everything at max Tx power and 2mbps ota datarate. A lot of the nrf24 fake chips don't even run at 250kbps.

                    rmtuckerR 1 Reply Last reply
                    0
                    • gohanG Offline
                      gohanG Offline
                      gohan
                      Mod
                      wrote on last edited by
                      #44

                      Do mean the fake chips need to run at higher datarate?

                      NeverDieN 1 Reply Last reply
                      0
                      • NeverDieN NeverDie

                        @rmtucker said in How do I get multiple different mock barometers?:

                        #define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX)

                        #define MY_NRF5_ESB_CHANNEL (76)

                        #define MY_NRF5_ESB_MODE (NRF5_250KBPS)

                        Just now noticing that your definitions:

                        #define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX)
                        
                        #define MY_NRF5_ESB_CHANNEL (76)
                        
                        #define MY_NRF5_ESB_MODE (NRF5_250KBPS)
                        

                        can also be set in myconfig.h.

                        Strangely, myconfig.h defaults to max Tx power on the nrf52, but not max Tx power on the nrf24. Not sure why, especially since, if anything, the nRF24 needs it more.

                        So, I just now changed myconfig.h to put everything at max Tx power and 2mbps ota datarate. A lot of the nrf24 fake chips don't even run at 250kbps.

                        rmtuckerR Offline
                        rmtuckerR Offline
                        rmtucker
                        wrote on last edited by
                        #45

                        @NeverDie
                        Ye i just like all the settings at the beginning of my sketches etc,it reminds me if i have changed channel number etc.

                        1 Reply Last reply
                        0
                        • gohanG gohan

                          Do mean the fake chips need to run at higher datarate?

                          NeverDieN Offline
                          NeverDieN Offline
                          NeverDie
                          Hero Member
                          wrote on last edited by
                          #46

                          @gohan said in How do I get multiple different mock barometers?:

                          Do mean the fake chips need to run at higher datarate?

                          All the fakes I've encountered can handle 1mbps and 2mbps.

                          1 Reply Last reply
                          0
                          • NeverDieN Offline
                            NeverDieN Offline
                            NeverDie
                            Hero Member
                            wrote on last edited by
                            #47

                            Not sure why, but by upgrading to 2mbps datarate from the previous default of just 250kbps, I'm able to reduce LONG_WAIT to 0 without incurring packet losses. Go figure.

                            1 Reply Last reply
                            0
                            • NeverDieN Offline
                              NeverDieN Offline
                              NeverDie
                              Hero Member
                              wrote on last edited by
                              #48

                              For the SHORT_WAIT, 10ms seems adequate on an nRF52832. Not sure where it hangs if the SHORT_WAIT is reduced too much lower than that though.

                              gohanG 1 Reply Last reply
                              0
                              • NeverDieN NeverDie

                                For the SHORT_WAIT, 10ms seems adequate on an nRF52832. Not sure where it hangs if the SHORT_WAIT is reduced too much lower than that though.

                                gohanG Offline
                                gohanG Offline
                                gohan
                                Mod
                                wrote on last edited by
                                #49

                                @NeverDie my question was if thay handle higher speeds better than the lowest since you said "A lot of the nrf24 fake chips don't even run at 250kbps"

                                NeverDieN 1 Reply Last reply
                                0
                                • gohanG gohan

                                  @NeverDie my question was if thay handle higher speeds better than the lowest since you said "A lot of the nrf24 fake chips don't even run at 250kbps"

                                  NeverDieN Offline
                                  NeverDieN Offline
                                  NeverDie
                                  Hero Member
                                  wrote on last edited by
                                  #50

                                  @gohan said in How do I get multiple different mock barometers?:

                                  @NeverDie my question was if thay handle higher speeds better than the lowest since you said "A lot of the nrf24 fake chips don't even run at 250kbps"

                                  I'm not understanding your question.

                                  1 Reply Last reply
                                  0
                                  • NeverDieN Offline
                                    NeverDieN Offline
                                    NeverDie
                                    Hero Member
                                    wrote on last edited by
                                    #51

                                    What does it mean when the Domoticz log looks like this?

                                    2017-08-11 08:11:20.670 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:24.053 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:24.068 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:27.454 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:27.470 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:30.870 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:30.887 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:34.245 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:34.260 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:37.650 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:37.666 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:41.036 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:41.051 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:44.375 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:44.391 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:47.800 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:47.816 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:51.185 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:51.200 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:54.583 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:54.599 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:11:58.005 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:11:58.021 MySensors: Node: 1, Sketch Version: v0.5
                                    2017-08-11 08:12:01.384 MySensors: Node: 1, Sketch Name: MockMySensors
                                    2017-08-11 08:12:01.401 MySensors: Node: 1, Sketch Version: v0.5

                                    Plainly, it's caught in a loop of some kind and never receives the sensor values.

                                    1 Reply Last reply
                                    0
                                    • NeverDieN Offline
                                      NeverDieN Offline
                                      NeverDie
                                      Hero Member
                                      wrote on last edited by
                                      #52

                                      For some reason, downgrading from 2mbps back down to 250kbps solved the above problem.

                                      1 Reply Last reply
                                      0
                                      • NeverDieN Offline
                                        NeverDieN Offline
                                        NeverDie
                                        Hero Member
                                        wrote on last edited by
                                        #53

                                        Fortunately, 1mbps seems to work, even if 2mbps doesn't.

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        13

                                        Online

                                        11.7k

                                        Users

                                        11.2k

                                        Topics

                                        113.1k

                                        Posts


                                        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • MySensors
                                        • OpenHardware.io
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular