At first I wanted to do a two branch split for both Mac M1 and
RaspberryPI ARM
-- Quad core Cortex-A72 (ARM v8).
However, it turns out that getting the CPU temp through CLI on a mac is extremely difficult and it was not worth
the time and trouble.
I found plenty of free programs that do the same thing, and better. You can find the list here: apps.
What you can do is use powermetrics.
Mac
Install powermetrics
brew install powermetrics
Run powermetrics
sudo powermetrics -s cpu_power,gpu_power
Run powermetrics MacOS X
sudo powermetrics --samplers smc |grep -i "CPU die temperature"
RaspberryPI
I was not surprised by the ease of how you can write a few lines of python code and have a working script
capable of logging CPU temperature. We basically need only 1 command from shell, this means we can easily write the same script as bash:.sh.
This command is: vcgencmd -- vc stands for VideoCore. gen stands for general. cmd for command.
🐍Get CPU temperature script:
import os
from datetime import datetime
import time
def temperature_of_raspberry_pi():
cpu_temp = os.popen("vcgencmd measure_temp").readline()
return cpu_temp.replace("temp=", "")
now = datetime.now().strftime('%d-%m-%Y_%H:%M:%S')
def main():
while True:
print(datetime.now().strftime('%d/%m/%Y,%H:%M:%S'),",",temperature_of_raspberry_pi())
file = open('temp_'+now+'.log','a')
line = datetime.now().strftime('%d/%m/%Y,%H:%M:%S') + "," + temperature_of_raspberry_pi().replace("'C","")
file.write(line)
time.sleep(1)
if __name__=="__main__":
main()
Ok, remember to: chmod 755 the python script before running it for a few minutes.
Now we have the data, we only need to process it and to plot using pandas and matplotlib
🐍Plot temperature data script:
import os
import pandas as pd
import matplotlib.pyplot as plt
# Step 1: Identify the most recent log file in the directory
log_files = [f for f in os.listdir() if f.endswith('.log')]
log_files.sort()
latest_log_file = log_files[-1] # The last file when sorted alphabetically
# Step 2: Read the data from the latest log file into a Pandas DataFrame
df = pd.read_csv(latest_log_file, header=None, names=['Date', 'Time', 'Temperature'])
df['Datetime'] = pd.to_datetime(df['Date'] + ' ' + df['Time'], format='%d/%m/%Y %H:%M:%S')
df.set_index('Datetime', inplace=True)
# Step 3: Plot the data using Pyplot
plt.figure(figsize=(10, 6))
plt.plot(df.index, df['Temperature'], label='Temperature')
plt.xlabel('Datetime')
plt.ylabel('Temperature (°C)')
plt.title('Temperature Over Time')
plt.legend()
plt.show()
Handbooks
ML models for User Recognition using Keystroke Dynamics
The keystroke dynamics that are used in this article’s machine learning models for user
recognition are behavioral biometrics. Keystroke dynamics uses the distinctive way that each
person types to confirm their identity. This is accomplished by analyzing the 2 keystroke
events on Key-Press and Key-Release — that make up a keystroke on computer keyboards to
extract typing patterns. The article will examine how these patterns can be applied to
create 3 precise machine learning models for user recognition.
Keystroke Dynamics — Predicting the User — Lambda App
The keystroke dynamics that are used in this article’s machine learning models for user
recognition are behavioral biometrics. Keystroke dynamics uses the distinctive way that each
person types to confirm their identity. This is accomplished by analyzing the 2 keystroke
events on Key-Press and Key-Release — that make up a keystroke on computer keyboards to
extract typing patterns. The article will examine how these ML Models can be used in
real-life situations to predict an user.
Unlock the full potential of your Raspberry Pi 4B as I guide you through transforming it into
a versatile coding machine or even a web server. In this concise handbook, I'll punctually
and minimalistically outline the steps to install Ubuntu Desktop, essential software,
packages, and applications, while also exploring fine-tuning options. Get ready to unleash
the power of your Raspberry Pi!
Discover the power of Pi-hole, your ultimate tool for reclaiming control over your internet
browsing experience. In this comprehensive handbook, I'll take you through each step of the
process, from understanding the basics to setting up your very own Pi-hole ad blocker.
In this tutorial, I'll show you how to create a Twitter bot that can intelligently reply to
mentions. Whether you're a developer looking to explore the possibilities of automation or
just curious about Twitter bots, I've got you covered.