Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here

Changing I2C address of RTC

Home Forums Mayfly Data Logger Changing I2C address of RTC

Tagged: ,

Viewing 2 reply threads
  • Author
    Posts
    • #14455
      ehazard
      Participant

      Hello. I’m currently working on trying to take measurements from a CO2 sensor (k30) using my Mayfly data logger (version 0.5b). The sensor is an analog and I’m using the I2C port connected to the SDA and SCL pins on the Mayfly.

      The sensor comes preprogrammed with the hexadecimal address 0x68. After quite a bit of testing to attempt to get the sensor working, I realized that the RTC on the Mayfly is an I2C chip with the hexadecimal address 0x68––the same as my sensor.

      Obviously if I had another microcontroller, I would rewrite the address for my CO2 sensor. However, I only have a Mayfly on hand, so it’s impossible for me to change the address of the sensor while the microcontroller can’t distinguish between the sensor and the RTC.

      My question is whether or not it’s at all possible to change the RTC chip address using I2C commands. Any advice is greatly appreciated!

    • #14457
      Sara Damiano
      Moderator

      The address of the DS3231 isn’t changeable – it’s permanently set when the chip is manufactured.  Is there any other way your sensor can communicate?  Does it have a physical addressing method?  Many I2C sensors have an “addr” pin that you can set to be high or low to change the address.  Can it communicate via SPI or UART so you can use one of those to change the address?

    • #14459
      Shannon Hicks
      Participant

      I just read through various manuals and datasheets for the K30 sensor, and it is technically possible to change the I2C address of the sensor, but it’s not easy so I wouldn’t suggest it. But the manual says the board also does serial UART output so you can just follow their example code for Arduino UART to modify it for working with the Mayfly’s correct pins and it should work. You’ll also want to power the board from the switched 5V output pin of the Mayfly since it needs 5v at 300ma to operate, which is a lot. If you run the board continuously, the aux supply regulator on the Mayfly will probably get a little warm and if you’re running this on a battery, it’ll drain pretty quickly. Is this going to be powered continuously by a benchtop supply or a battery?

Viewing 2 reply threads
  • You must be logged in to reply to this topic.