Tag: ribby

  • .py non ti temo

    Oggi (14.10.2020) ho modificato il file fan_controller.py per impostare la FanHat Melopero del Raspberrypi4 con Kodi in modo che non partisse in automatico all’avvio, e si attivasse solo superata una certa temperatura.

    Dato che ho intensione di tenere il Rpi sempre acceso non aveva senso che continuasse a girare anche quando non lo stavo usando.

    File originale

    !/usr/bin/env python3

    import sys
    sys.path.append(‘/storage/.kodi/addons/virtual.rpi-tools/lib’)
    import os
    import time
    import RPi.GPIO as GPIO
    import glob

    minimum_always_ON=True
    minimum_speed=30
    target_temp=52

    current_speed=0

    thermal_zones_temp_dirs=glob.glob(“/sys/class/thermal/thermal_zone*/temp”)

    def getCPUtemperature():
    res = os.popen(‘vcgencmd measure_temp’).readline()
    #vcgencmd measure_temp -> res=”temp=NN.N’C\n”
    #temp =(res.replace(“temp=”,””).replace(“‘C\n”,””))
    temp=res[5:9]
    try :
    temp= float(temp)
    except :
    print(“vcgencmd measure_temp failed”)
    temp=getCPUTemperature2()

    return temp

    def getCPUTemperature2():
    temps=[]
    for file_dir in thermal_zones_temp_dirs:
    with open(file_dir, “r”) as file:
    try :
    temps.append(float(file.read()))
    except :
    print(“Error reading from file {}”.format(file_dir))
    continue

    if len(temps) == 0:
        print("reading from sys files failed, no CPU temp detected using target_temp")
        temps.append(target_temp * 1000)
    
    return max(temps) / 1000

    try:
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(18, GPIO.OUT)

    myPWM=GPIO.PWM(18,50)
    myPWM.start(minimum_speed)
    
    current_speed=minimum_speed
    
    while True:
        temp = getCPUtemperature()
    
        if(temp<target_temp and not minimum_always_ON):
            myPWM.ChangeDutyCycle(0)
            current_speed=0
            time.sleep(1)
            continue
        if(temp<target_temp and minimum_always_ON):
            myPWM.ChangeDutyCycle(minimum_speed)
            current_speed=minimum_speed
            time.sleep(1)
            continue
    
        if(temp>target_temp and temp<56):
            myPWM.ChangeDutyCycle(40)
            current_speed=40
            time.sleep(1)
            continue
        if(temp>56 and temp<60):
            myPWM.ChangeDutyCycle(50)
            time.sleep(1)
            continue
        if(temp>60 and temp<65):
            myPWM.ChangeDutyCycle(60)
            current_speed=60
            time.sleep(1)
            continue
        if(temp>65 and temp<70):
            myPWM.ChangeDutyCycle(70)
            current_speed=70
            time.sleep(1)
            continue
        if(temp>70 and temp<74):
            myPWM.ChangeDutyCycle(80)
            current_speed=80
            time.sleep(1)
            continue
        if(temp>74 and temp<76):
            myPWM.ChangeDutyCycle(90)
            current_speed=90
            time.sleep(1)
            continue
        if(temp>76):
           #handleFan(100)
            myPWM.ChangeDutyCycle(100)
            current_speed=100
            time.sleep(1)
            continue

    except KeyboardInterrupt: # trap a CTRL+C keyboard interrupt
    GPIO.cleanup() # resets all GPIO ports used by this program

    File modificato

    !/usr/bin/env python3

    import sys
    sys.path.append(‘/storage/.kodi/addons/virtual.rpi-tools/lib’)
    import os
    import time
    import RPi.GPIO as GPIO
    import glob

    minimum_always_ON=True
    minimum_speed=30
    target_temp=50

    current_speed=0

    thermal_zones_temp_dirs=glob.glob(“/sys/class/thermal/thermal_zone*/temp”)

    def getCPUtemperature():
    res = os.popen(‘vcgencmd measure_temp’).readline()
    #vcgencmd measure_temp -> res=”temp=NN.N’C\n”
    #temp =(res.replace(“temp=”,””).replace(“‘C\n”,””))
    temp=res[5:9]
    try :
    temp= float(temp)
    except :
    print(“vcgencmd measure_temp failed”)
    temp=getCPUTemperature2()

    return temp

    def getCPUTemperature2():
    temps=[]
    for file_dir in thermal_zones_temp_dirs:
    with open(file_dir, “r”) as file:
    try :
    temps.append(float(file.read()))
    except :
    print(“Error reading from file {}”.format(file_dir))
    continue

    if len(temps) == 0:
        print("reading from sys files failed, no CPU temp detected using target_temp")
        temps.append(target_temp * 1000)
    
    return max(temps) / 1000

    try:
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(18, GPIO.OUT)

    myPWM=GPIO.PWM(18,50)
    myPWM.start(0)
    
    current_speed=minimum_speed
    
    while True:
        temp = getCPUtemperature()
    
        if(temp<target_temp and not minimum_always_ON):
            myPWM.ChangeDutyCycle(0)
            current_speed=0
            time.sleep(1)
            continue
        if(temp<target_temp and minimum_always_ON):
            myPWM.ChangeDutyCycle(0)
            current_speed=0
            time.sleep(1)
            continue
    
        if(temp>target_temp and temp<56):
            myPWM.ChangeDutyCycle(40)
            current_speed=40
            time.sleep(1)
            continue
        if(temp>56 and temp<60):
            myPWM.ChangeDutyCycle(50)
            time.sleep(1)
            continue
        if(temp>60 and temp<65):
            myPWM.ChangeDutyCycle(60)
            current_speed=60
            time.sleep(1)
            continue
        if(temp>65 and temp<70):
            myPWM.ChangeDutyCycle(70)
            current_speed=70
            time.sleep(1)
            continue
        if(temp>70 and temp<74):
            myPWM.ChangeDutyCycle(80)
            current_speed=80
            time.sleep(1)
            continue
        if(temp>74 and temp<76):
            myPWM.ChangeDutyCycle(90)
            current_speed=90
            time.sleep(1)
            continue
        if(temp>76):
           #handleFan(100)
            myPWM.ChangeDutyCycle(100)
            current_speed=100
            time.sleep(1)
            continue

    except KeyboardInterrupt: # trap a CTRL+C keyboard interrupt
    GPIO.cleanup() # resets all GPIO ports used by this program

    Tranquilli è finito!

    Può sembrare chissà cosa ma in realtà la modifica è molto semplice una volta capito il senso di quello che stiamo guardando, la possibilità di modificare un file di testo per ottenere ciò che vogliamo da una enorme sensazione di potere (come usare il terminale)!!!

    Un grazie a Francesco del gruppo telegram che mi ha assistito evitando che facessi esplodere il Rpi 😛

    E tu che rapporti hai con i file di configurazione?

    Se siete arrivati a leggere fino a qui commentate con “Attenti al Pitone!” 😛

    Se apprezzi il mio hobby dai un occhiata agli altri articoli, seguimi su Instagram “https://www.instagram.com/officinadiribby/”, Youtube “https://www.youtube.com/channel/UCwjuFZCIN7IJN_3kuY4pJCA” o iscriviti al mio gruppo Telegram “https://t.me/OdRgroup“ , se preferisci puoi anche scrivermi un email officinadiribby@altervista.org

  • Grazie Cuore di panna

    Alcuni giorni fa ho incontrato LM ( cuore di panna ce la chiamo io ma poco che poi si arrabbia), mi dice di avere un portatile mezzo rotto che voleva dare via, un bel netbook Acer del fratello con display touch e reversibile, molto interessante.

    Ieri sono andato a prenderlo (neanche una birra ha voluto), torno a casa e sollevando il coperchio noto che manca la cornice del display oltre a essere molto vissuto però quando lo accendo si avvia, è questo quello che conta 😛

    Entro nel bios imposto data e ora, controllo tra le impostazioni che mi sembrano scarne rispetto al solito, riavvio e provo Linux Mint 20 in live.

    Senza difficoltà copio su una pennetta la cartella utenti di Windows come mi aveva chiesto.

    aprendolo trovo 2x2gb di ram DDR3, un HD sata da 300 GB che rimuovo e restituirò con la pennetta per il resto dentro si è mantenuto molto meglio che fuori.

    Monto l’SSD 120 Gb che tenevo sul Thinpad IBM, anche se al riavvio parte Debian 10 che era già istallato formatto tutto e installo Mint 20.

    Non va il wifi credo ci sia un problema con l’interruttore fisico che penso Linux vede male, una cosa simile mi era successa nel 2008 con un portatile HP speriamo che dopo 12 anni si risolva con una ricerca in rete.

    Usando il tethering usb del telefono riesco a fare gli aggiornamenti e dopo aver notato e ricollegato (da spento ovvio) un connettore del display ora funziona anche il touch male ma funzione 😛

    Le 4 di notte!!! direi che già cosi va piu che bene.

    LM ha un caratteraccio però quando deve buttare via un pc pensa a me, Persone che conosco da molti più anni non lo fanno.

    Se siete arrivati a leggere fino a qui commentate con “LM=cornetto” 😛

    Se apprezzi il mio hobby dai un occhiata agli altri articoli, seguimi su Instagram “https://www.instagram.com/officinadiribby/”, Youtube “https://www.youtube.com/channel/UCwjuFZCIN7IJN_3kuY4pJCA” o iscriviti al mio gruppo Telegram “https://t.me/OdRgroup“ , se preferisci puoi anche scrivermi un email officinadiribby@altervista.org

  • Osservatorio Astronomico Elpidiense

    Da poco ho creato un gruppo Telegram (https://t.me/OAEgroup) per l’Osservatorio che secondo me merita molto e spero che cresca, ho proposto per Lunedi 10 un Pic-Nic dato il grande prato che lo circonda e l’occassione della notte di San Lorenzo.

    se siete della zona raggiungerete facilmente l’osservatorio, siete i benvenuti nel gruppo (anche tutti gli altri ovvio :P)

    Per tutte le info potete consultare il sito dell’associazione di astrofili che gestisce l’osservatorio 😛

    https://www.alphagemini.it/osservatorio-marco-bertini/

    Se apprezzi il mio hobby dai un occhiata agli altri articoli, seguimi su Instagram “https://www.instagram.com/officinadiribby/”, Youtube “https://www.youtube.com/channel/UCwjuFZCIN7IJN_3kuY4pJCA” o iscriviti al mio gruppo Telegram “https://t.me/OdRgroup“ , se preferisci puoi anche scrivermi un email officinadiribby@altervista.org

  • 3D Print 00

    Grazie a Gio per aver stampato il case del mio Rpi3 ma soprattutto per aver ridisegnato e stampato quello del Rpi0+PiHat TV con anche le iniziali del mio blog ??

    Da tempo sono tentato dall’idea di acquistare una stampante 3D economica e provare ad usare software di modellazione 3D tipo Blender.

    Non avendo spazio e neanche una particolare necessita non sarebbe sfruttata come merita, inoltra Blender è assurdo e il pippone di imparare per poi farci 3 cose in croce non ha molto senso, purtroppo!

    Ovviamente sfruttando la mia qualità migliore (rompere il Ca77o) magari convinco qualcuno a prenderla in società 😛

    Gio instagram https://instagram.com/cantolacqua_videomaker?igshid=4tj0cevy0qkp

    Se apprezzi il mio hobby dai un occhiata agli altri articoli, seguimi su Instagram “https://www.instagram.com/officinadiribby/”, YouTube “https://www.youtube.com/channel/UCwjuFZCIN7IJN_3kuY4pJCA“, entra nel mio gruppo Telegram “https://t.me/OdRgroup“ , o inviami un email officinadiribby@altervista.org

  • Installazione Mint 20 xfce

    L’installazione di Linux Mint 20 xfce sul tablet chuwi Hi 10 plus è andata molto bene, Mint come Xubuntu 20.04 riconosce perfettamente l’audio cosa che non accadeva come la versione precedente.

    Purtroppo ancora non va il touch ma ci dovrebbe essere un firmware dedicato da qualche parte, con la tastiera è comunque un ottimo netbook con 4 GB di ram che non è poco.

    A breve installerò Mint 20 anche su VirtualBox per la serie di video che ho iniziato durante la quarantena quando installai Xubuntu e Manjaro, non mi soffermerò troppo sull’installazione dato che non cambia delle precedenti.

    Purtroppo le foto non rendono molto dato che il tablet è estremamente riflettente, in più ero in un bar per fruttare la connesione 😛 (dati i potenti mezzi di cui dispone l’Officina di Ribby).

    Dato il basso numero di commenti ho deciso di attivare un indirizzo email “alias” officinadiribby@altervista.org al quale potete scrivermi per dirmi quanto sono bravo, per dare o chiedere consigli e condividere con me le vostre idee. purtroppo per gli insulti siamo già al completo ?.

    Se apprezzi il mio hobby dai un occhiata agli altri articoli, seguimi su Instagram “https://www.instagram.com/officinadiribby/”, Youtube “https://www.youtube.com/channel/UCwjuFZCIN7IJN_3kuY4pJCA” o iscriviti al mio gruppo Telegram “https://t.me/OdRgroup“

  • Linux Mint 20 Beta

    Era da un pò che aspettavo l’uscita della Beta di Linux Mint 20 dopo aver scoperto che Xubuntu 20.04 riconosce perfettamente l’audio del mio Tablet Chuwi Hi 10 Plus.

    lascio il link al download per tutti quelli che come me non vedono l’ora di provarla, ovviamente come per Xubuntu 20.04 anche Mint 20 sarà solo a 64 Bit.

    https://ftp.heanet.ie/mirrors/linuxmint.com/testing/

    Lascio anche il link all’articolo di Marco’s Box dove ho prevo il link per il download.

    http://www.marcosbox.org/2020/06/linux-mint-20-ecco-le-iso-della-beta.html

    Se apprezzi il mio hobby dai un occhiata agli altri articoli, seguimi su Instagram “https://www.instagram.com/officinadiribby/”, Youtube “https://www.youtube.com/channel/UCwjuFZCIN7IJN_3kuY4pJCA” o iscriviti al mio gruppo Telegram “https://t.me/OdRgroup“

  • WhatsApp grave Bug

    Di sicuro avete letto del problema di WhatsApp !!!

    “Il ricercatore (Athul Jayaram), secondo le sue dichiarazioni, avrebbe segnalato il problema dei numeri di telefono il 23 maggio. Sembra però che gli sviluppatori di WhatsApp, di proprietà di Facebook, abbiano risposto di essere al corrente già da tempo di questo problema e di non essere intenzionati a risolverlo. Almeno per il momento.”

    Fonte

    https://www.open.online/2020/06/08/scoperto-bug-su-whatsapp-per-accedere-a-300-mila-numeri-basta-una-ricerca-su-google/

    A questo punto direi che una possibilità a Telegram potete concederla

    https://telegram.org/

    Se apprezzi il mio hobby dai un occhiata agli altri articoli, seguimi su Instagram “https://www.instagram.com/officinadiribby/”, Youtube “https://www.youtube.com/channel/UCwjuFZCIN7IJN_3kuY4pJCA” o iscriviti al mio gruppo Telegram “https://t.me/OdRgroup“