Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

RTC Pi and Orange Pi Zero 2: I2C Activation

655 Views - Created 24/04/2023

24/04/2023

Posted by:
grblake

grblake Avatar

Greetings.

I purchased the RTC Pi for my Orange Pi Zero 2 based on the list showing compatibility.

https://www.abelectronics.co.uk/p/70/rtc-pi

When mounting the board, it has to be inverted as the RTC is normal Raspberry Pi pinout (Pin 1 on the Left) versus the Orange Pi (Pin 1 on the right). When I poll the I2C for I2C0 and I2C1, it gives me an error. I looked for ways to activate I2C0 and 1 and implemented those. So far, nothing. The RTC Pi is on pins 3 and 5 (I2C0, I2C1). I still cannot get the Pi to open the I2C bus so I can see the RTC (Address 68).

Has anyone successfully adapted the RTC Pi yet?

Thanks in Advance.

24/04/2023

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hi

We have only tested our boards on the Orange Pi Plus2, Orange Pi One and Orange Pi PC, but as they work on those versions of the Orange Pi, they should work on the OPZ2. I just tried setting up an Orange Pi One on the latest version of Armbian, and it appears that Orange Pi has changed the way you enable I2C since I last tested our boards. After some searching, I found this blog post https://www.sigmdel.ca/michel/ha/opi/opipc2_i2c_en.html which details how to enable the I2C port.

There is a command called armbian-config which you can use to enable the I2C port. Run "sudo armbian-config", select "System (System and security settings)" then "Hardware (Toggle hardware configuration)", and mark i2c0 for installation. Select save and reboot your Orange Pi.

On the Orange Pi One, the I2C bus used on pins 3 and 5 of the GPIO header is I2C0, and according to the documentation for the OPZ2 it also uses I2C0 for those pins. Once the Orange Pi has rebooted check if the RTC Pi is available on the I2C bus using "sudo i2cdetect -y 0". It should appear on address 0x68.

If the RTC Pi is available on the I2C bus, you can test it using our Python library, which can be downloaded from GitHub using " git clone https://github.com/abelectronicsuk/ABElectronics_Python_Libraries.git"

Before you can use the python library you will need to install two python 3 modules using
"sudo apt-get install python3-smbus python3-dev"

Try running the ABElectronics_Python_Libraries/RTCPi/demos/demo_rtcgetdate.py script using "python3 ABElectronics_Python_Libraries/RTCPi/demos/demo_rtcgetdate.py". If it works, it should start printing the date from the RTC Pi on the display.

I will update the Orange Pi tutorials on our website to work with the current version of Armbian Linux.

If you have any problems getting your RTC Pi to work using the instructions above, please let me know.

Sign in to post your reply

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.