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. My Project
  3. nRF5 action!

nRF5 action!

Scheduled Pinned Locked Moved My Project
1.9k Posts 49 Posters 630.8k Views 44 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.
  • T Offline
    T Offline
    Toyman
    wrote on last edited by
    #501

    Given new Arduino Primo contains a buzzer connected to nrf52, we might expect tone() function to be compatible with nrf52 very soon

    https://www.arduino.cc/en/uploads/Main/ARDUINO_PRIMO-V022_SCH.pdf

    1 Reply Last reply
    0
    • NeverDieN NeverDie

      Quantization error on the hwCpuVoltage() function appears to about 14 millivolts, which is a nice little improvement over the atmega328p. Measurement accuracy appears to be well within those bounds.

      Next step is to measure voltage on an analog pin using an AnalogRead. Not sure if the reference voltage is Vcc (as it typically is with the atmega328p) or something else for those measurements.

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

      @NeverDie said in nRF5 Bluetooth action!:

      Quantization error on the hwCpuVoltage() function appears to about 14 millivolts, which is a nice little improvement over the atmega328p. Measurement accuracy appears to be well within those bounds.

      Next step is to measure voltage on an analog pin using an AnalogRead. Not sure if the reference voltage is Vcc (as it typically is with the atmega328p) or something else for those measurements.

      Strangely, if I do, say, analogRead(A4) on the nRF52832, all I get back is a 10-bit number, not a 12-bit number. i.e. the number never exceeds 1023. That can't be right. Should I be using a different function call to get the full 12 bits on the nRF52832?

      mfalkviddM 1 Reply Last reply
      0
      • NeverDieN NeverDie

        @NeverDie said in nRF5 Bluetooth action!:

        Quantization error on the hwCpuVoltage() function appears to about 14 millivolts, which is a nice little improvement over the atmega328p. Measurement accuracy appears to be well within those bounds.

        Next step is to measure voltage on an analog pin using an AnalogRead. Not sure if the reference voltage is Vcc (as it typically is with the atmega328p) or something else for those measurements.

        Strangely, if I do, say, analogRead(A4) on the nRF52832, all I get back is a 10-bit number, not a 12-bit number. i.e. the number never exceeds 1023. That can't be right. Should I be using a different function call to get the full 12 bits on the nRF52832?

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

        @NeverDie looks like you need to call analogReadResolution first https://github.com/sandeepmistry/arduino-nRF5/blob/425e719af8d85b543def01e49a6ef4048525dc59/cores/nRF5/wiring_analog.h#L74

        NeverDieN 1 Reply Last reply
        1
        • mfalkviddM mfalkvidd

          @NeverDie looks like you need to call analogReadResolution first https://github.com/sandeepmistry/arduino-nRF5/blob/425e719af8d85b543def01e49a6ef4048525dc59/cores/nRF5/wiring_analog.h#L74

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

          @mfalkvidd said in nRF5 Bluetooth action!:

          @NeverDie looks like you need to call analogReadResolution first https://github.com/sandeepmistry/arduino-nRF5/blob/425e719af8d85b543def01e49a6ef4048525dc59/cores/nRF5/wiring_analog.h#L74

          Thanks! That did the trick. Calling analogReadResolution(12) once in Setup() routine, I now get back a 12-bit number (i.e. up to 4095) thereafter when I do an analogRead(...). :)

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

            So, just did the experiment, and here are the results. Supplying 3.3v to the Ebyte Module, a voltage of 3.0 volts on A4 yields an analogRead(A4) of 4095. Less voltage on A4 yields a lower number.

            So, generalizing, I suspect that the reference voltage for analogRead() is Vcc-0.3.

            So, you either know Vcc, because of a voltage regulator or something, or else you must call hwCpuVoltage() to get what it is. Then, subtract 0.3v from that, and that's the reference voltage which corresponds to an analogRead() return value of 4095.

            :)

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

              I just did a quick and dirty measurement on the current consumption of the nRF52832 Ebyte module during sleep, and it measured 10 milliamps. I measured it using a uCurrent Gold. That's very high current for most battery powered applications. Can someone else here please measure it also and either confirm or refute?

              I invoked sleep with this from the mocksensors sketch:

              	wait(SLEEP_TIME); //sleep a bit
              

              Perhaps there's a way to invoke a deeper sleep than that where less current is drawn?

              rmtuckerR 1 Reply Last reply
              0
              • NeverDieN NeverDie

                I just did a quick and dirty measurement on the current consumption of the nRF52832 Ebyte module during sleep, and it measured 10 milliamps. I measured it using a uCurrent Gold. That's very high current for most battery powered applications. Can someone else here please measure it also and either confirm or refute?

                I invoked sleep with this from the mocksensors sketch:

                	wait(SLEEP_TIME); //sleep a bit
                

                Perhaps there's a way to invoke a deeper sleep than that where less current is drawn?

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

                @NeverDie
                Try

                sleep(60000); // Sleeps for a minute in deep sleep
                
                NeverDieN 1 Reply Last reply
                1
                • rmtuckerR rmtucker

                  @NeverDie
                  Try

                  sleep(60000); // Sleeps for a minute in deep sleep
                  
                  NeverDieN Offline
                  NeverDieN Offline
                  NeverDie
                  Hero Member
                  wrote on last edited by NeverDie
                  #508

                  @rmtucker said in nRF5 Bluetooth action!:

                  sleep(60000); // Sleeps for a minute in deep sleep

                  Thanks! That's a big improvement. I'm now reading 51uA. I did the measurements on the Ebyte nRF52832 module, powering it at 3.3v.

                  However, to be frank, that's still rather high compared to, say, an atmega328p with a RFM69 radio, which can have a combined sleep current of less than 1uA.

                  Is there anything more that can be done to lower the sleep current further?

                  rmtuckerR 1 Reply Last reply
                  0
                  • NeverDieN NeverDie

                    @rmtucker said in nRF5 Bluetooth action!:

                    sleep(60000); // Sleeps for a minute in deep sleep

                    Thanks! That's a big improvement. I'm now reading 51uA. I did the measurements on the Ebyte nRF52832 module, powering it at 3.3v.

                    However, to be frank, that's still rather high compared to, say, an atmega328p with a RFM69 radio, which can have a combined sleep current of less than 1uA.

                    Is there anything more that can be done to lower the sleep current further?

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

                    @NeverDie

                    Is that a bare board with nothing connected (Not even serial)?

                    NeverDieN 1 Reply Last reply
                    0
                    • rmtuckerR rmtucker

                      @NeverDie

                      Is that a bare board with nothing connected (Not even serial)?

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

                      @rmtucker said in nRF5 Bluetooth action!:

                      @NeverDie

                      Is that a bare board with nothing connected (Not even serial)?

                      Yes. It's the bare Ebyte nRF52832 module. The only connections are Vcc and GND.

                      rmtuckerR 1 Reply Last reply
                      0
                      • NeverDieN NeverDie

                        @rmtucker said in nRF5 Bluetooth action!:

                        @NeverDie

                        Is that a bare board with nothing connected (Not even serial)?

                        Yes. It's the bare Ebyte nRF52832 module. The only connections are Vcc and GND.

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

                        @NeverDie

                        Theoretically it should be around 1.9uA

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

                          Interestingly, I just now tried the same measurement with one of these nRF52832 modules instead of the Ebyte module:
                          https://www.aliexpress.com/item/nRF52832-Bluetooth-4-1-BLE-Module-M4-Transparent-Transmission-SMA-512K-FLASH-64K-RAM-pass-through/32798522093.html?spm=a2g0s.9042311.0.0.KKA3PF
                          and during sleep it measured 6uA. Quite a bit lower!

                          Anyone know of a module which tests even lower than that?

                          Nca78N 1 Reply Last reply
                          0
                          • NeverDieN NeverDie

                            Interestingly, I just now tried the same measurement with one of these nRF52832 modules instead of the Ebyte module:
                            https://www.aliexpress.com/item/nRF52832-Bluetooth-4-1-BLE-Module-M4-Transparent-Transmission-SMA-512K-FLASH-64K-RAM-pass-through/32798522093.html?spm=a2g0s.9042311.0.0.KKA3PF
                            and during sleep it measured 6uA. Quite a bit lower!

                            Anyone know of a module which tests even lower than that?

                            Nca78N Offline
                            Nca78N Offline
                            Nca78
                            Hardware Contributor
                            wrote on last edited by
                            #513

                            @NeverDie said in nRF5 Bluetooth action!:

                            Interestingly, I just now tried the same measurement with one of these nRF52832 modules instead of the Ebyte module:
                            https://www.aliexpress.com/item/nRF52832-Bluetooth-4-1-BLE-Module-M4-Transparent-Transmission-SMA-512K-FLASH-64K-RAM-pass-through/32798522093.html?spm=a2g0s.9042311.0.0.KKA3PF
                            and during sleep it measured 6uA. Quite a bit lower!

                            Anyone know of a module which tests even lower than that?

                            Did you use the same board definition in the IDE and the same script ?

                            NeverDieN 1 Reply Last reply
                            0
                            • Nca78N Nca78

                              @NeverDie said in nRF5 Bluetooth action!:

                              Interestingly, I just now tried the same measurement with one of these nRF52832 modules instead of the Ebyte module:
                              https://www.aliexpress.com/item/nRF52832-Bluetooth-4-1-BLE-Module-M4-Transparent-Transmission-SMA-512K-FLASH-64K-RAM-pass-through/32798522093.html?spm=a2g0s.9042311.0.0.KKA3PF
                              and during sleep it measured 6uA. Quite a bit lower!

                              Anyone know of a module which tests even lower than that?

                              Did you use the same board definition in the IDE and the same script ?

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

                              @Nca78 said in nRF5 Bluetooth action!:

                              Did you use the same board definition in the IDE and the same script ?

                              Yes.

                              rmtuckerR 1 Reply Last reply
                              0
                              • NeverDieN NeverDie

                                @Nca78 said in nRF5 Bluetooth action!:

                                Did you use the same board definition in the IDE and the same script ?

                                Yes.

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

                                @NeverDie
                                Have you tried sleep and wait for an external interrupt instead of sleep and wake on timer?
                                Just in case it is the lfxtl that is causing the problem.

                                NeverDieN 1 Reply Last reply
                                0
                                • rmtuckerR rmtucker

                                  @NeverDie
                                  Have you tried sleep and wait for an external interrupt instead of sleep and wake on timer?
                                  Just in case it is the lfxtl that is causing the problem.

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

                                  @rmtucker said in nRF5 Bluetooth action!:

                                  @NeverDie
                                  Have you tried sleep and wait for an external interrupt instead of sleep and wake on timer?
                                  Just in case it is the lfxtl that is causing the problem.

                                  Haven't tried that yet. Is there a library functional call for that, or do I need to start addressing the registers directly? With this new mpu, I feel like I'm learning to walk all over again.

                                  rmtuckerR 1 Reply Last reply
                                  0
                                  • NeverDieN NeverDie

                                    @rmtucker said in nRF5 Bluetooth action!:

                                    @NeverDie
                                    Have you tried sleep and wait for an external interrupt instead of sleep and wake on timer?
                                    Just in case it is the lfxtl that is causing the problem.

                                    Haven't tried that yet. Is there a library functional call for that, or do I need to start addressing the registers directly? With this new mpu, I feel like I'm learning to walk all over again.

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

                                    @NeverDie

                                    Try

                                    sleep(digitalPinToInterrupt(10), FALLING,0);
                                    
                                    NeverDieN 1 Reply Last reply
                                    0
                                    • rmtuckerR rmtucker

                                      @NeverDie

                                      Try

                                      sleep(digitalPinToInterrupt(10), FALLING,0);
                                      
                                      NeverDieN Offline
                                      NeverDieN Offline
                                      NeverDie
                                      Hero Member
                                      wrote on last edited by NeverDie
                                      #518

                                      @rmtucker said in nRF5 Bluetooth action!:

                                      @NeverDie

                                      Try

                                      sleep(digitalPinToInterrupt(10), FALLING,0);
                                      

                                      Unexpected result: using that as the sleep invocation, the infor-link module measures at 14ua while sleeping. i.e. worse, not better, compared to the 6ua measured earlier.

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

                                        Looks as though the infor-link is using an A620N crystal:
                                        0_1501938448961_infor-link_foto1.jpg
                                        I tried to see if I could find a datasheet for it, in the hope of learning what its current consumption is (or, at least, should be). Unfortunately, though, I couldn't find a datasheet for an A620N.

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

                                          Maybe it doesn't matter, because in looking at the actual module I received, it appears to use a different XTAL anyway: A649N.
                                          0_1501940457248_inforlink1.jpg

                                          0_1501940347295_inforlink2.jpg

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


                                          1

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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