1

I have a RTC DS3231 connected to my Raspberry Pi 3 B+. I connected it using this tutorial https://www.raspberrypi-spy.co.uk/2015/05/adding-a-ds3231-real-time-clock-to-the-raspberry-pi/ and everything works fine.

The DS3231 is connected to the pins:

DS1307  Pi GPIO
GND     P1-06
Vcc     P1-01 (3.3V)
SDA     P1-03 (I2C SDA)
SCL     P1-05 (I2C SCL)

Now, I want to connect a push button that will turn OFF and ON the raspberry pi. Per this tutorial https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi I can turn ON/OFF the pi by shorting pins 5 and 6. However, these pins are already taken by the RTC board.

I'm afraid that I will burn either the Pi, RTC, or something else if I connect the button to the same pins as the RTC.

I know I can select other pins like 18, to turn OFF The pi. However, this will not Turn ON the pi when the button is pressed again.

What would be the safest, faster, and easiest way to accomplish this? To have the RTC DS3231 and a push button/switch that will turn ON the pi.

Ghanima
  • 15,958
  • 17
  • 65
  • 125
Unxcellent
  • 11
  • 1
  • 2

2 Answers2

1

If you can safely short RPI's GPIO pins 5 and 6 to turn it on and off, then you can also do this safely with your RTC connected.

Here's why:

According to Adafruit's documentation, the chip is a Maxim DS3231, and the SCL line is connected to 3.3v through a pullup resistor. According to Maxim's documentation the SCL line is the clock input for the I2C serial interface used to synchronize data. If the SCL line is connected to RPi's GPIO pin 5, then it's also connected to the RPi's system clock.

The pullup resistor acts to limit current when the SCL pin and GPIO pin 5 are shorted to ground. This is exactly what happens when you short GPIO pin 5 to Ground at GPIO pin 6. Consequently, you will not damage the RTC, nor the RPi by connecting GPIO pins 5 and 6.

Seamus
  • 23,558
  • 5
  • 42
  • 83
0

You can NOT run a script using the I²C pins, as this will change the mode and prevent RTC from running.

There is NO NEED to load any script - the current Pi firmware already includes this functionality. I use this, but on a different pin. See https://raspberrypi.stackexchange.com/a/77918/8697

Milliways
  • 62,573
  • 32
  • 113
  • 225