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. Hardware
  3. Radio plus sensor on the SPI bus

Radio plus sensor on the SPI bus

Scheduled Pinned Locked Moved Hardware
20 Posts 2 Posters 4.5k Views 2 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.
  • dbemowskD dbemowsk

    @Yveaux Thanks, that is what I was hoping to hear. I have not done a lot with SPI communications, so I am still learning this end of arduino. This is what I am trying to connect: https://www.digikey.com/products/en?mpart=AS5047P-TS_EK_AB&v=961

    Thanks for the quick response.

    YveauxY Offline
    YveauxY Offline
    Yveaux
    Mod
    wrote on last edited by
    #6

    @dbemowsk but I guess you mean the as5047p, correct?
    If this is for your weather station you could also just take an earth magnetic field sensor to determine the angle of rotation of a rotating magnet. Much cheaper, available as module, very sensitive, but requires a little math to get the actual angle.

    http://yveaux.blogspot.nl

    1 Reply Last reply
    0
    • dbemowskD dbemowsk

      @Yveaux which link are you referring to?

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #7

      @dbemowsk said in Radio plus sensor on the SPI bus:

      @Yveaux which link are you referring to?

      The digikey link

      http://yveaux.blogspot.nl

      1 Reply Last reply
      0
      • YveauxY Yveaux

        @dbemowsk you will be quite busy! That link gives 5473963 Results :laughing:

        dbemowskD Offline
        dbemowskD Offline
        dbemowsk
        wrote on last edited by
        #8

        @Yveaux said in Radio plus sensor on the SPI bus:

        That link gives 5473963 Results

        I am not sure where you are seeing these results. The link I posted was to a part listed on the DigiKey website.

        Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
        Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

        YveauxY 1 Reply Last reply
        0
        • dbemowskD Offline
          dbemowskD Offline
          dbemowsk
          wrote on last edited by
          #9

          it is an AS5047P magnetic rotation sensor.

          Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
          Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

          1 Reply Last reply
          0
          • dbemowskD dbemowsk

            @Yveaux said in Radio plus sensor on the SPI bus:

            That link gives 5473963 Results

            I am not sure where you are seeing these results. The link I posted was to a part listed on the DigiKey website.

            YveauxY Offline
            YveauxY Offline
            Yveaux
            Mod
            wrote on last edited by
            #10

            @dbemowsk This is what I get when clicking the link on my mobile:

            0_1499498936222_Screenshot_20170708-092412.png

            On a PC the sensor is correctly shown...

            http://yveaux.blogspot.nl

            1 Reply Last reply
            0
            • dbemowskD Offline
              dbemowskD Offline
              dbemowsk
              wrote on last edited by
              #11

              This is what I see on my machine:
              0_1499499106871_upload-8167181e-aa58-40fe-a8fa-9b1c9ad0e248

              Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
              Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

              YveauxY 1 Reply Last reply
              0
              • dbemowskD dbemowsk

                This is what I see on my machine:
                0_1499499106871_upload-8167181e-aa58-40fe-a8fa-9b1c9ad0e248

                YveauxY Offline
                YveauxY Offline
                Yveaux
                Mod
                wrote on last edited by
                #12

                @dbemowsk Digikey walks in mysterious ways... (on mobile browsers at least...)

                http://yveaux.blogspot.nl

                dbemowskD 1 Reply Last reply
                0
                • YveauxY Yveaux

                  @dbemowsk Digikey walks in mysterious ways... (on mobile browsers at least...)

                  dbemowskD Offline
                  dbemowskD Offline
                  dbemowsk
                  wrote on last edited by
                  #13

                  @Yveaux So I see.

                  This is the part I purchased though.
                  0_1499499256682_upload-a31c6af7-925d-46ff-884a-3d83ed4b8284
                  I got it on ebay with the breakout board, magnet, header connector, and the person threw in a spare chip. I am using it for my wind direction sensor for my weather station project.

                  This is a library I found for it. https://github.com/smellsofbikes/AS5047_arduino_library

                  Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                  Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                  1 Reply Last reply
                  0
                  • YveauxY Yveaux

                    @dbemowsk should work just fine.
                    Beware that when using mySensors with message queuing, the other spi device driver must use SPI transactions.

                    dbemowskD Offline
                    dbemowskD Offline
                    dbemowsk
                    wrote on last edited by
                    #14

                    @Yveaux said in Radio plus sensor on the SPI bus:

                    when using mySensors with message queuing, the other spi device driver must use SPI transactions.

                    Do you have any links to some information on using transactions?

                    Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                    Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                    YveauxY 1 Reply Last reply
                    0
                    • dbemowskD dbemowsk

                      @Yveaux said in Radio plus sensor on the SPI bus:

                      when using mySensors with message queuing, the other spi device driver must use SPI transactions.

                      Do you have any links to some information on using transactions?

                      YveauxY Offline
                      YveauxY Offline
                      Yveaux
                      Mod
                      wrote on last edited by
                      #15

                      @dbemowsk https://www.arduino.cc/en/Reference/SPI

                      Basically, SPI transfers in the driver need to be enclosed in

                      SPI.beginTransaction(...)
                      ...
                      SPI.endTransaction()
                      

                      http://yveaux.blogspot.nl

                      dbemowskD 1 Reply Last reply
                      0
                      • YveauxY Yveaux

                        @dbemowsk https://www.arduino.cc/en/Reference/SPI

                        Basically, SPI transfers in the driver need to be enclosed in

                        SPI.beginTransaction(...)
                        ...
                        SPI.endTransaction()
                        
                        dbemowskD Offline
                        dbemowskD Offline
                        dbemowsk
                        wrote on last edited by
                        #16

                        @Yveaux Sounds simple enough. Thanks for all the help.

                        Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                        Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                        1 Reply Last reply
                        0
                        • dbemowskD Offline
                          dbemowskD Offline
                          dbemowsk
                          wrote on last edited by dbemowsk
                          #17

                          So I have this set up for testing on my UNO. Uusing the library from here https://github.com/smellsofbikes/AS5047_arduino_library, this is the sample code I am running.

                          #include "AS5047.h"
                          #include <SPI.h>
                          
                          AS5047 myAS5047(10); // SS pin
                          void setup()
                          {
                            SPI.begin;
                            Serial.begin(9600);
                          }
                          
                          void loop()
                          {
                            long value;
                            value=(360*myAS5047.sensor_read())/16383;
                            Serial.print("measured value: ");
                            Serial.println(value);
                            delay(1000);
                          }
                          

                          Using the code as written, it works perfectly giving me a reading between 0 and 360 as I rotate the direction sensor. Two questions I have though.

                          First, When I migrate this over to my platform on my easy newbie board, the SS pin (defined on line 4), which as I understand is acting as a CS or chip select, should be on something other than 10 because the nRF24 is on 10 and each device should have its own CS, but if I change it to another pin on my UNO and change line 4 to match the pin that I put it on, it doesn't work. Is this because I need an SPI device on pin 10 first taking care of the SS or slave select?

                          My second question would be, how would I write this using transactions?

                          Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                          Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                          1 Reply Last reply
                          0
                          • dbemowskD Offline
                            dbemowskD Offline
                            dbemowsk
                            wrote on last edited by
                            #18

                            Comment number 7 of this post http://forum.arduino.cc/index.php/topic,19770.0.html was the basis for part of my last question.

                            Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                            Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                            YveauxY 1 Reply Last reply
                            0
                            • dbemowskD dbemowsk

                              Comment number 7 of this post http://forum.arduino.cc/index.php/topic,19770.0.html was the basis for part of my last question.

                              YveauxY Offline
                              YveauxY Offline
                              Yveaux
                              Mod
                              wrote on last edited by
                              #19

                              @dbemowsk the library you're using says 'untested' in the readme, and that looks to be true :smile:
                              The pin mode of _ss is set to input in the constructor of AS5047.cpp which doesn't seem correct. Try setting it to output and see what happens.

                              http://yveaux.blogspot.nl

                              dbemowskD 1 Reply Last reply
                              0
                              • YveauxY Yveaux

                                @dbemowsk the library you're using says 'untested' in the readme, and that looks to be true :smile:
                                The pin mode of _ss is set to input in the constructor of AS5047.cpp which doesn't seem correct. Try setting it to output and see what happens.

                                dbemowskD Offline
                                dbemowskD Offline
                                dbemowsk
                                wrote on last edited by
                                #20

                                @Yveaux Works perfect now, thanks. Now I just need to research calling this as a transaction. Just brainstorming a bit, I will most likely have a function written to grab the value from the sensorand begin and end the transaction there, but since I have never worked with transactions, I will need to research how to write the code to do that.

                                Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                                Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

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


                                23

                                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