User Tools

Site Tools


rv3032c7_pi


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rv3032c7_pi [2025/02/01 05:19] – [Sensors] adminrv3032c7_pi [2025/02/01 05:21] (current) – [Install Requirements] admin
Line 15: Line 15:
 ''dtparam=rtc=off'' ''dtparam=rtc=off''
 ===== Install Requirements ===== ===== Install Requirements =====
-<code> 
-sudo apt-get install python-smbus i2c-tools 
-</code> 
  
 +''sudo apt-get install python-smbus i2c-tools''
 ===== Confirm Presence ===== ===== Confirm Presence =====
 <code> <code>
Line 63: Line 61:
 </code> </code>
  
 +====== dmesg ======
 +<code>
 +$ sudo dmesg | grep rtc
 +[    2.837650] rtc-rv3032 1-0051: registered as rtc0
 +[    2.839127] rtc-rv3032 1-0051: setting system clock to 2025-02-01T05:17:05 UTC (1738387025)
 +</code>
 ===== Disable Fake hwclock ===== ===== Disable Fake hwclock =====
  
Line 126: Line 130:
  
 ===== Directly ===== ===== Directly =====
-<code>cat /sys/class/i2c-dev/i2c-1/device/1-0068/hwmon/hwmon2/temp1_input</code> +<code>$cat /sys/class/i2c-dev/i2c-1/device/1-0051/hwmon/hwmon3/temp1_input 
- +21312</code>
-===== Python ===== +
-<code> +
-import smbus +
-import os +
- +
-bus = smbus.SMBus(1) +
-address = 0x68 +
- +
-os.system('sudo rmmod rtc_ds1307'+
-def getTemp(address): +
-   byte_tmsb = bus.read_byte_data(address,0x11) +
-   byte_tlsb = bin(bus.read_byte_data(address,0x12))[2:].zfill(8) +
-   return byte_tmsb+int(byte_tlsb[0])*2**(-1)+int(byte_tlsb[1])*2**(-2) +
- +
-#print getTemp(address) +
-Celsius = getTemp(address) +
-Fahrenheit = 9.0/5.0 * Celsius + 32 +
-print Fahrenheit, "*F /", Celsius, "*C" +
-os.system('sudo modprobe rtc_ds1307') +
-</code> +
- +
-Save as a .py file (e.g. ds3231_temp.py) and run with ''sudo python ds3231_temp.py''+
  
-You may need to install ''python-smbus''. 
  
rv3032c7_pi.1738387167.txt.gz · Last modified: 2025/02/01 05:19 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki