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.9k 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.
  • M Mike_Lemo

    @NeverDie said in nRF5 Bluetooth action!:

    At some point, I had to re-arrange the libraries though (don't remember which files or which ones) to get all this stuff working. Before that, it wasn't finding the files. Actually, I think this would be a good topic for discussion, to make sure we're all doing it the same way. If we're doing it differently, it might make cross-checking each others attempts more difficult. Also, maybe there's a better way than the brute-force way that I did it.

    If anyone has interest, I can post how my libraries are currently structured. If nothing else, it would be a starting point for discussion on what to do (or not to do).

    Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.

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

    @Mike_Lemo said in nRF5 Bluetooth action!:

    Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.

    It hasn't been easy, I'll grant you that. I get the impression d00616 probably does most of his work in Linux, and so some of the disconnect with the Windows IDE probably stems from that. Once we get the basics ironed out, though, I expect things will go more smoothly. In fact, I think we're almost there. A lot of the work for sleeping, measuring source voltage, etc., has already been done, which is far better than starting from scratch. And there's even example code, which helps tremendously.

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

      Good news! Interestingly enough, the MockMySensors sketch seems to work fine when I load it onto the Ebyte. What a relief! So, I may try hijacking that sketch to convey voltage measurements instead of the BatteryPoweredSensor sketch that mysteriously hasn't been working on my Ebyte modules.

      1 Reply Last reply
      0
      • M Mike_Lemo

        @NeverDie said in nRF5 Bluetooth action!:

        At some point, I had to re-arrange the libraries though (don't remember which files or which ones) to get all this stuff working. Before that, it wasn't finding the files. Actually, I think this would be a good topic for discussion, to make sure we're all doing it the same way. If we're doing it differently, it might make cross-checking each others attempts more difficult. Also, maybe there's a better way than the brute-force way that I did it.

        If anyone has interest, I can post how my libraries are currently structured. If nothing else, it would be a starting point for discussion on what to do (or not to do).

        Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.

        d00616D Offline
        d00616D Offline
        d00616
        Contest Winner
        wrote on last edited by
        #496

        @Mike_Lemo said in nRF5 Bluetooth action!:

        Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.

        The Nordic SDK is more complete than Arduino-nrf5 at the moment, but there is no compatibility with MySensors.

        The good news, with SDK 13 the 'Nordic Semiconductor ASA' License was changed. The old ASA was the reason for me to rewrite the complete ESB protocol. Now the license is much less restrictive. I think now the way is open to integrate SDK code into arduino-nrf5 or provide SDK based arduino-libraries.

        @NeverDie said in nRF5 Bluetooth action!:

        It hasn't been easy, I'll grant you that. I get the impression d00616 probably does most of his work in Linux, and so some of the disconnect with the Windows IDE probably stems from that.

        I can't change the way of Windows driver handling, but when there are Windows specific issues then they bust be fixed.

        M 1 Reply Last reply
        1
        • d00616D d00616

          @Mike_Lemo said in nRF5 Bluetooth action!:

          Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.

          The Nordic SDK is more complete than Arduino-nrf5 at the moment, but there is no compatibility with MySensors.

          The good news, with SDK 13 the 'Nordic Semiconductor ASA' License was changed. The old ASA was the reason for me to rewrite the complete ESB protocol. Now the license is much less restrictive. I think now the way is open to integrate SDK code into arduino-nrf5 or provide SDK based arduino-libraries.

          @NeverDie said in nRF5 Bluetooth action!:

          It hasn't been easy, I'll grant you that. I get the impression d00616 probably does most of his work in Linux, and so some of the disconnect with the Windows IDE probably stems from that.

          I can't change the way of Windows driver handling, but when there are Windows specific issues then they bust be fixed.

          M Offline
          M Offline
          Mike_Lemo
          wrote on last edited by
          #497

          @d00616 said in nRF5 Bluetooth action!:

          @Mike_Lemo said in nRF5 Bluetooth action!:

          Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.

          The Nordic SDK is more complete than Arduino-nrf5 at the moment, but there is no compatibility with MySensors.

          The good news, with SDK 13 the 'Nordic Semiconductor ASA' License was changed. The old ASA was the reason for me to rewrite the complete ESB protocol. Now the license is much less restrictive. I think now the way is open to integrate SDK code into arduino-nrf5 or provide SDK based arduino-libraries.

          .

          You mean way more complete every thing is accesable there and there is an example for everything and I didn't use my sensors anyways

          d00616D 1 Reply Last reply
          0
          • M Mike_Lemo

            @d00616 said in nRF5 Bluetooth action!:

            @Mike_Lemo said in nRF5 Bluetooth action!:

            Dunno that whole arduino BRF52832 programming thing seems too complicated just started to learn how to use the nordic SDK with eclipse until a proper solution is found.

            The Nordic SDK is more complete than Arduino-nrf5 at the moment, but there is no compatibility with MySensors.

            The good news, with SDK 13 the 'Nordic Semiconductor ASA' License was changed. The old ASA was the reason for me to rewrite the complete ESB protocol. Now the license is much less restrictive. I think now the way is open to integrate SDK code into arduino-nrf5 or provide SDK based arduino-libraries.

            .

            You mean way more complete every thing is accesable there and there is an example for everything and I didn't use my sensors anyways

            d00616D Offline
            d00616D Offline
            d00616
            Contest Winner
            wrote on last edited by
            #498

            @Mike_Lemo said in nRF5 Bluetooth action!:

            You mean way more complete every thing is accesable there and there is an example for everything and I didn't use my sensors anyways

            No. I mean if you want to use the Nordic MCU with BLE and you want to access the whole hardware without developing drivers, then the Nordic SDK is an option. For special requirements like tone() you have to develop your own routine for Arduino or SDK.

            If you want write code which is compatible with other Vendors or want use MySensors then the SDK isn't the best choice.

            The arduino-nrf5 targets to provide the Arduino language. I think this is mostly complete. MySensors brings additional support for enhanced pin output modes and the random number generator (no SoftDevice support here).

            Accessing the internal MCU hardware must be added via Arduino libraries. With the new SDK license I think it's possible to put parts of the SDK into libraries supporting Hardware which is not specified in the Arduino reference.

            If you want to develop BLE applications with portable code, there are open source implementations like http://mynewt.apache.org/ which are designed to be portable.

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

              Good news! The hwCPUVoltage() function measures the Vcc voltage on the Ebyte module in millivolts. I'm able to send that as a barometer reading using the mocksensors sketch, and it arrives all the way into Domoticz, where it is logged and graphed. So, obviously I need to streamline that a bit, but the proof of concept works. :)

              NeverDieN 1 Reply Last reply
              1
              • NeverDieN NeverDie

                Good news! The hwCPUVoltage() function measures the Vcc voltage on the Ebyte module in millivolts. I'm able to send that as a barometer reading using the mocksensors sketch, and it arrives all the way into Domoticz, where it is logged and graphed. So, obviously I need to streamline that a bit, but the proof of concept works. :)

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

                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 1 Reply Last reply
                1
                • 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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          14

                                          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