Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    GY-87 micropython library

    Scheduled Pinned Locked Moved Discussion
    micropythongy-80lopy4
    32 Posts 4 Posters 5.2k Views 4 Watching
    Loading More Posts
    • 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
      tttadam @Elizar
      last edited by tttadam

      @elizar yes I meant paralel sorry. English is not my first language. I know the teory, but I never used more tahn one I2C sensor. But GY-87 has more pins than Vcc, gnd, scl and sda.

      E 1 Reply Last reply Reply Quote 0
      • E Offline
        Elizar @tttadam
        last edited by

        @tttadam Just have a look at http://www.techmonkeybusiness.com/the-gy87-combined-sensor-test-sketch.html for wiring.

        Yes, there are some more pins but you probably don't need them for a start.

        T 1 Reply Last reply Reply Quote 1
        • T Offline
          tttadam @Elizar
          last edited by

          @elizar Thank you, I think the wiring is okay, but I am not sure.
          This is what I2C scan returs: [64, 104, 119]
          64 for is the si7021 sensor for sure.
          But, GY-80 has 3 sensor as far as I know, but the there is only 2 additional on shows up at the scan, 104 and 119.
          print(si7021.readRH(), si7021.readTemp()) is working fine.
          Now, I need to find a micropython library, can you recommend me one?
          Thank you,
          Ádám,

          robert-hhR 2 Replies Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @tttadam
            last edited by

            @tttadam 119 is the address of the BMP180. I have a driver for that at https://github.com/robert-hh/BMP085_BMP180. Do not be confused that the file is called bmp085.py. It cintains the classes for both devices. In fact, they behave identical.

            1 Reply Last reply Reply Quote 1
            • robert-hhR Offline
              robert-hh @tttadam
              last edited by

              @tttadam 104 should be the address of the MPU6050 device,
              The hmc5883l device address is told to be 30 decimal. If the SI7021 is also connected, you should get four I2C addresses.
              So when connecting the GY-87, you should see that. By the way, the title of your post says GY-80, but you link to the GY87.

              T 2 Replies Last reply Reply Quote 1
              • T Offline
                tttadam @robert-hh
                last edited by

                @robert-hh I took some picture of the wiring.
                Sorry for the confusion, I will fix the title. The sensor what I have is GY-87. This is where I bought it.

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tttadam @robert-hh
                  last edited by

                  @robert-hh Thank you for the library, it is working fine! :)
                  I am checking out something fo MPU6050
                  But I am still not sure where is the third sensor. mybe the gy87 is damaged?

                  robert-hhR 1 Reply Last reply Reply Quote 0
                  • robert-hhR Offline
                    robert-hh @tttadam
                    last edited by

                    @tttadam I looked for MPU6050 libraries. What I found is for RasPi, but it should be easy to adapt them by replacing the calls for I2C send and receive.
                    About the third sensor HMC5883L. Acording to the data sheet there is no enable pin. The DRDY signal could come from that chip. You should check whether you init the I2C bust at a baudrate <= 400000, because that is the max rate mentioned in the data sheet.

                    T 1 Reply Last reply Reply Quote 0
                    • T Offline
                      tttadam @robert-hh
                      last edited by tttadam

                      @robert-hh
                      First of all sorry for the long delay.
                      I just checked, and seems like no, the last sensor didn't show up on i2c.scan()
                      I checked the documentation and the MPU6050 is has some kind of mode/option, where it's connected to other I2c devices, and gather data from them. Maybe the compass is connected to the mpu6050?

                      >>> from machine import I2C
                      >>> i2c = I2C(0, I2C.MASTER, baudrate=400000)
                      >>> i2c.scan()
                      [64, 104, 119]
                      >>>
                      
                      robert-hhR 1 Reply Last reply Reply Quote 0
                      • robert-hhR Offline
                        robert-hh @tttadam
                        last edited by

                        @tttadam I justz received a sample of the board that you have linked. Three observations:

                        • the HMC5883 does not show up in the i2c.scan(), even if the address is ping'ed.
                        • the bmp180 returns nonsense-values.
                        • the pull-up resistor values on the board are pretty low,
                          effectively 1.1kOhm. I will look tonight into the signals with an oscilloscope to verify the signal quality.

                        So all-in-all, the board might just be crap.

                        T 1 Reply Last reply Reply Quote 1
                        • T Offline
                          tttadam @robert-hh
                          last edited by

                          @robert-hh ohhh, I didn't even thought about that. But could be. Can you recommend some other sensor?
                          pytrack has built-in gyro. what i need pressure, and compass.
                          (The weather ballon will have a camera, and when it took a picture, I would like to know the direction)

                          robert-hhR 1 Reply Last reply Reply Quote 0
                          • robert-hhR Offline
                            robert-hh @tttadam
                            last edited by

                            @tttadam So, looking at the device and the wiring it seems clear why the HMC5883 is not visible in the scan: it is connected to the MBU6050 slave interface. Still, according to the MPU6050 data sheet, it should be visible, because at start-up the MPU6050 connects the main I2C interface to the aux interface.
                            The I2C signals are fine.

                            However, on the board I have the BMP180 is broken. The temperature sensor always returns 229.3°C. At least that helped me to find a signed/unsigned bug in my driver.

                            T 1 Reply Last reply Reply Quote 0
                            • T Offline
                              tttadam @robert-hh
                              last edited by

                              @robert-hh said in GY-87 micropython library:

                              BMP180

                              I just checked the bmp18. It's seems something off with the altitude...
                              (1028 is the current QNH in Budapest)

                              >>> bmp.sealevel = 1028
                              >>> bmp.altitude
                              51.46274
                              >>> bmp.pressure
                              1021.34
                              >>> bmp.temperature
                              24.2
                              >>> si7021.readTemp()
                              22.92749
                              >>> my_gps.altitude
                              120.3
                              

                              So you have any guess how Can I get the compass data?

                              robert-hhR 2 Replies Last reply Reply Quote 0
                              • robert-hhR Offline
                                robert-hh @tttadam
                                last edited by

                                @tttadam The altitude is calculated from the actual pressure and what you enter as sea level pressure, roughly 8.5m/hPa. You can see it in the python script.
                                The compass chip should be available when the I2C-bus is set to pass-through. I'm trying it at the moment.

                                1 Reply Last reply Reply Quote 0
                                • robert-hhR Offline
                                  robert-hh @tttadam
                                  last edited by

                                  @tttadam So I found a way to talk to the compass, with the following sequence:

                                  from machine import I2C
                                  i2c=I2C()
                                  i2c.writeto_mem(104, 107, 128) # reset MPU6050
                                  i2c.writeto_mem(104, 107, 0) # disable sleep
                                  i2c.writeto_mem(104, 55, 2)   # enable I2C passthru
                                  i2c.scan()
                                  

                                  The scan should show you another I2C address. In my case it is 13, which deviates from the HMV5883 data sheet.

                                  T 1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    tttadam @robert-hh
                                    last edited by

                                    @robert-hh It's working for me too! :)
                                    Awsome! :)
                                    Now I just need to find a correct library for it.
                                    I will start with this

                                    Can you give me some explonation what happend?
                                    What your overall expression of the board?

                                    robert-hhR 1 Reply Last reply Reply Quote 0
                                    • robert-hhR Offline
                                      robert-hh @tttadam
                                      last edited by

                                      @tttadam When you do the i2c.scan(), which address is reported for the HMC5883? It puzzles me that my device reports 13 instead of 30, which is the address in all examples.
                                      Besides that, I have the impression that in normal operation the HMC5883 is controlled by the MCU6050 for its own purpose. So you might get the information you need through the MCU6050.
                                      If you ask me about what I did to find that way: I looked at the circuit, read the data sheets and looked at some code examples for the MCU6050.

                                      T 1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        tttadam @robert-hh
                                        last edited by

                                        @robert-hh

                                        This is what I see. So same for me.

                                        >>> from machine import I2C
                                        >>> i2c = I2C(1)
                                        >>> i2c.scan()
                                        [64, 104, 119]
                                        >>> i2c.writeto_mem(104, 107, 128) # reset MPU6050
                                        >>> i2c.writeto_mem(104, 107, 0) # disable sleep
                                        >>> i2c.writeto_mem(104, 55, 2)   # enable I2C passthru
                                        >>> i2c.scan()
                                        [13, 64, 104, 119]
                                        >>>
                                        
                                        
                                        robert-hhR 3 Replies Last reply Reply Quote 0
                                        • robert-hhR Offline
                                          robert-hh @tttadam
                                          last edited by

                                          @tttadam So let's see if that is a bug or an intended address trabslation (but why?)

                                          1 Reply Last reply Reply Quote 0
                                          • robert-hhR Offline
                                            robert-hh @tttadam
                                            last edited by

                                            @tttadam A short google search gave an answer:
                                            The chip in the board is not a HMC5883, but a QMC5883. See https://github.com/nodemcu/nodemcu-firmware/issues/2187
                                            The QMC5883 server for the same purpose, but has different programming interface.

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 2 / 2
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom