<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>raspberry &#8211; El Cornijal de Linux</title>
	<atom:link href="https://linuxete.duckdns.org/category/raspberry/feed/" rel="self" type="application/rss+xml" />
	<link>https://linuxete.duckdns.org</link>
	<description>Un blog sobre Linux</description>
	<lastBuildDate>Sat, 10 Jan 2026 19:06:40 +0000</lastBuildDate>
	<language>es</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Ventilador para Raspberry Pi 4</title>
		<link>https://linuxete.duckdns.org/ventilador-para-raspberry-pi-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ventilador-para-raspberry-pi-4</link>
					<comments>https://linuxete.duckdns.org/ventilador-para-raspberry-pi-4/#respond</comments>
		
		<dc:creator><![CDATA[raspberry]]></dc:creator>
		<pubDate>Tue, 09 Apr 2024 13:48:13 +0000</pubDate>
				<category><![CDATA[raspberry]]></category>
		<category><![CDATA[Raspberry PI]]></category>
		<category><![CDATA[control ventilador raspberry]]></category>
		<category><![CDATA[fan raspberry pi 4]]></category>
		<category><![CDATA[ventilador raspberry]]></category>
		<guid isPermaLink="false">https://linuxete.duckdns.org/?p=1233</guid>

					<description><![CDATA[Existe un nueva entrada actualizada, puedes verla aquí Raspberry Pi 4 tiene una conexión para ventilador configurada de fábrica al PIN 8 (GPIO 14) que se activa a partir de 60ºC. Aunque el fabricante nos dice que ese rango de temperaturas es correcto, a mi me parece demasiado alto. Por ello he creado un script [&#8230;]]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image aligncenter size-medium"><img fetchpriority="high" decoding="async" width="300" height="300" src="https://linuxete.duckdns.org/wp-content/uploads/2024/04/51nl7x3rx-S._SL1000_-300x300.jpg" alt="" class="wp-image-1235" srcset="https://linuxete.duckdns.org/wp-content/uploads/2024/04/51nl7x3rx-S._SL1000_-300x300.jpg 300w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/51nl7x3rx-S._SL1000_-150x150.jpg 150w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/51nl7x3rx-S._SL1000_-768x768.jpg 768w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/51nl7x3rx-S._SL1000_.jpg 1000w" sizes="(max-width: 300px) 100vw, 300px" /></figure>



<h2 class="wp-block-heading"><mark style="background-color:rgba(0, 0, 0, 0);color:#cf2e2e" class="has-inline-color">Existe un nueva entrada actualizada, puedes verla <a href="https://linuxete.duckdns.org/control-inteligente-de-la-refrigeracion-de-mi-raspberry-pi-4/">aquí</a></mark></h2>



<p>Raspberry Pi 4 tiene una conexión para ventilador configurada de fábrica al PIN 8 (GPIO 14) que se activa a partir de 60ºC. Aunque el fabricante nos dice que ese rango de temperaturas es correcto, a mi me parece demasiado alto. Por ello he creado un script en Python con el cual podemos decir a qué temperatura queremos poner en marcha el ventilador.</p>



<p>Necesitamos un ventilador de 3 pines, que cuente con un cable <mark style="background-color:rgba(0, 0, 0, 0);color:#f70000" class="has-inline-color">rojo 5V positivo</mark>, negro para negativo y <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-ast-global-color-0-color">azul para el control de velocidad</mark>. </p>



<p>El funcionamiento es simple, rojo y negro se conectan a 5 voltios de la Raspberry y azul a un pin de nuestra elección para activar o desactivar el ventilador.</p>



<p>En este script, conectaremos el cable azul al pin 18, al cual daremos valor <strong>HIGH</strong> o<strong> LOW</strong>, dependiendo de los valores de temperatura que asignemos. </p>



<p>Este tipo de ventilador usa el modo <strong>PWM</strong> o ancho de pulso para regular el voltaje y así la velocidad de rotación del ventilador, pero eso lo veremos en otro script.</p>



<p>La ejecución del programa es la siguiente: </p>



<ul class="wp-block-list">
<li>Temperatura igual o superior a 45 grados activa el ventilador.</li>



<li>Entre 44 y 39 grados el ventilador se mantiene activo.</li>



<li>El ventilador se para al bajar de 39 grados.</li>



<li>El ventilador se mantiene apagado hasta que la temperatura sea igual o superior a 45 grados.</li>
</ul>



<p>Eres libre de usar el rango de temperaturas que más te interesen, modifica los valores en el programa.</p>



<p>Este script espera a ejecutar el bucle cada 5 segundos a fin de no cargar los núcleos del procesador y con ello subir artificialmente la temperatura.</p>



<p>Aquí tenemos el código.</p>



<pre class="wp-block-code"><code>#!/usr/bin/python3
# https://linuxete.duckdns.org/
# https://chapuboot.blogspot.com/
# Importa la librería de control de GPIO de la Raspberry
import RPi.GPIO as GPIO

# Importa  la función sleep del módulo time
import time 

#Desactivar advertencias (warnings)
GPIO.setwarnings(False)

#Modo de identificación de GPIO
GPIO.setmode(GPIO.BOARD)

# Configurar pin 18 como salida
GPIO.setup(18, GPIO.OUT)

# Inicializamos pin 18 apagado con False, con True el programa inicia con el ventilador en marcha hasta meterse en el bucle While.
GPIO.output(18, False)

# Función Lectura de temperatura
def get_cpu_temp():
    temperatura = open( "/sys/class/thermal/thermal_zone0/temp" )
    cpu_temp = temperatura.read()
    temperatura.close()
    return float(cpu_temp)/1000

#bucle infinito
while True:
    time.sleep(5) #espera a ejecutar el bucle cada 5 segundos.
    print(get_cpu_temp())
    if get_cpu_temp() &gt;= 45:
        GPIO.output(18, GPIO.HIGH)
    elif get_cpu_temp() &lt;= 44 and get_cpu_temp() &gt;= 40:
        continue
    elif get_cpu_temp() &lt; 39:
        GPIO.output(18, GPIO.LOW)
      
</code></pre>



<p>Abre una terminal y escribe:</p>



<pre class="wp-block-code"><code>nano ventilador.py</code></pre>



<p>Copia, pega el código anterior y guarda pulsando las teclas <strong>Crtl + o</strong> y sal con <strong>Crtl + x</strong></p>



<p>Ahora, dale permisos de ejecución con:</p>



<pre class="wp-block-code"><code>chmod +x ventilador.py</code></pre>



<p>Programa la ejecución del programa al inicio con cron, escribe en la terminal:</p>



<pre class="wp-block-code"><code>crontab -e</code></pre>



<p>Al final del texto, pega el siguiente código:</p>



<pre class="wp-block-code"><code>@reboot /usr/bin/python3 /home/<s>tu_usuario</s>/ventilador.py</code></pre>



<p>Sustituye «tu_usuario» por el tuyo propio.</p>



<p>Guarda con <strong>Crtl + o</strong> y cierra con <strong>Ctrl +x</strong></p>



<p>Ahora cada vez que se encienda tu Raspberry el programa se ejecutará al inicio.</p>



<figure class="wp-block-image aligncenter size-full"><img decoding="async" width="859" height="237" src="https://linuxete.duckdns.org/wp-content/uploads/2024/04/Seleccion_084.png" alt="" class="wp-image-1244" srcset="https://linuxete.duckdns.org/wp-content/uploads/2024/04/Seleccion_084.png 859w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/Seleccion_084-300x83.png 300w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/Seleccion_084-768x212.png 768w" sizes="(max-width: 859px) 100vw, 859px" /><figcaption class="wp-element-caption">Script ejecutándose y con procesadores trabajando al mínimo.</figcaption></figure>



<p>Ventiladores disponibles 40 mm y 3 pines</p>



<ul class="wp-block-list">
<li><a href="https://www.amazon.es/GeeekPi-ventiladores-Raspberry-ventilador-silencioso/dp/B092ZF995F/ref=sr_1_9?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;crid=MY9S3IFWTKIL&amp;dib=eyJ2IjoiMSJ9.Zhk--RnJ5CPpg-4zZbURIPUU9uS90NeVFTT8PnK9jQn9P1cpXPe1ztcUF3cw6nT7cN980_nv9x-xz3Dheev-sUt6sjzLc1JpJz-XfoicfrtBjoNzofm2GwKLyx_YlMklILeYaCYydAB5Hy_WpG8yLcxg9ezQp2L9dNfZSTF_KjgrGiT6H7OekH3TgJ88Qs-i0TyMGZ-HiH1NH4_ErO0aUIytTxXbArf8W_LIS01azUMEPMBakUImPJOfi_8FmPVl4tFbKmIGgVBVfMHJvFw6KpleHo8ftNGcQDY9Kb1oe0M.SA-SxqGdkXfRa7S3F1ctwBeaFVAduelK27pjpgtTwAY&amp;dib_tag=se&amp;keywords=raspberry%2Bpi%2B4%2Bventilador%2B3%2Bpines&amp;qid=1712521517&amp;sprefix=raspberry%2Bpi%2B4%2Bventilador%2B3%2Bpines%2Caps%2C100&amp;sr=8-9&amp;th=1" target="_blank" rel="noreferrer noopener nofollow">GeeekPi 2PCS Raspberry Pi 4 PWM Controllable</a></li>



<li><a href="https://www.tiendatec.es/raspberry-pi/accesorios/1980-disipador-integral-con-ventilador-controlado-por-software-pwm-8472496029216.html" target="_blank" rel="noreferrer noopener nofollow">Tiendatec</a></li>



<li><a href="https://es.aliexpress.com/item/1005002518918026.html#nav-specification" target="_blank" rel="noreferrer noopener nofollow">Ventilador PWM, 5V, 3 pines, 40 mm</a></li>



<li><a href="https://www.amazon.es/GeeekPi-Raspberry-Cooling-Tower-Heatsink/dp/B0B9R7WWCG/ref=pd_ci_mcx_pspc_dp_d_2_i_1?pd_rd_w=kyuTE&amp;content-id=amzn1.sym.f11fe75a-7397-412e-9b90-7e09bf6f5c14&amp;pf_rd_p=f11fe75a-7397-412e-9b90-7e09bf6f5c14&amp;pf_rd_r=QEK2R12TZRYFTFTBGR2J&amp;pd_rd_wg=db2YX&amp;pd_rd_r=da453921-dc82-4721-9df6-5c8c7d5d70f9&amp;pd_rd_i=B0B9R7WWCG" target="_blank" rel="noreferrer noopener nofollow">GeeekPi Raspberry Pi Cooling Fan</a> el que estoy usando en mi Raspberry.</li>
</ul>



<figure class="wp-block-image aligncenter size-large"><img decoding="async" width="1024" height="577" src="https://linuxete.duckdns.org/wp-content/uploads/2024/04/photo_2024-04-07_10-39-29-1024x577.jpg" alt="" class="wp-image-1238" srcset="https://linuxete.duckdns.org/wp-content/uploads/2024/04/photo_2024-04-07_10-39-29-1024x577.jpg 1024w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/photo_2024-04-07_10-39-29-300x169.jpg 300w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/photo_2024-04-07_10-39-29-768x433.jpg 768w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/photo_2024-04-07_10-39-29.jpg 1280w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">GeeekPi Raspberry Pi Cooling Fan de 3 pines al pin 18 (GPIO 24)</figcaption></figure>



<p>Esquema de los pines GPIO</p>



<figure class="wp-block-image aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="588" src="https://linuxete.duckdns.org/wp-content/uploads/2024/04/pasted-image-0-1024x588.png" alt="" class="wp-image-1246" srcset="https://linuxete.duckdns.org/wp-content/uploads/2024/04/pasted-image-0-1024x588.png 1024w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/pasted-image-0-300x172.png 300w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/pasted-image-0-768x441.png 768w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/pasted-image-0-1536x882.png 1536w, https://linuxete.duckdns.org/wp-content/uploads/2024/04/pasted-image-0.png 1600w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">Esquema de los pines GPIO</figcaption></figure>



<p>Comprueba que funciona y  mantén tu Raspberry mas fresca que una lechuga. </p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxete.duckdns.org/ventilador-para-raspberry-pi-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Instalar botón de encendido Raspberry Pi 4</title>
		<link>https://linuxete.duckdns.org/instalar-boton-de-encendido-raspberry-pi-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=instalar-boton-de-encendido-raspberry-pi-4</link>
					<comments>https://linuxete.duckdns.org/instalar-boton-de-encendido-raspberry-pi-4/#respond</comments>
		
		<dc:creator><![CDATA[raspberry]]></dc:creator>
		<pubDate>Sun, 10 Mar 2024 18:52:55 +0000</pubDate>
				<category><![CDATA[raspberry]]></category>
		<category><![CDATA[Raspberry PI]]></category>
		<category><![CDATA[apagado raspberry pi]]></category>
		<category><![CDATA[button raspberry pi 4]]></category>
		<category><![CDATA[encendido raspberry pi]]></category>
		<category><![CDATA[pulsador raspberry pi 4]]></category>
		<guid isPermaLink="false">https://linuxete.duckdns.org/?p=1138</guid>

					<description><![CDATA[Mi raspberry Pi 4 no se lleva muy bien con los cortes repentinos de corriente, acaba por corromper los datos del disco SSD y cuando arranca ¡Que si quieres arroz Catalina! se me ponen los pelos como escarpias. Por eso, aparte de tenerla conectada a una línea de S.A.I o U.P.S, le he instalado un [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Mi raspberry Pi 4 no se lleva muy bien con los cortes repentinos de corriente, acaba por corromper los datos del disco SSD y cuando arranca ¡Que si quieres arroz Catalina! se me ponen los pelos como escarpias. Por eso, aparte de tenerla conectada a una línea de S.A.I o U.P.S, le he instalado un botón de encendido/apagado.</p>



<p>Vamos a ver cómo habilitar la funcionalidad del botón de encendido en la Raspberry Pi 4</p>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="800" height="800" src="https://linuxete.duckdns.org/wp-content/uploads/2024/03/the-terrapi-ng-including-a-power-button.jpg" alt="" class="wp-image-1146" srcset="https://linuxete.duckdns.org/wp-content/uploads/2024/03/the-terrapi-ng-including-a-power-button.jpg 800w, https://linuxete.duckdns.org/wp-content/uploads/2024/03/the-terrapi-ng-including-a-power-button-300x300.jpg 300w, https://linuxete.duckdns.org/wp-content/uploads/2024/03/the-terrapi-ng-including-a-power-button-150x150.jpg 150w, https://linuxete.duckdns.org/wp-content/uploads/2024/03/the-terrapi-ng-including-a-power-button-768x768.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /></figure>



<p>Conecta los dos pines del pulsador en PIN 5 (GPIO 3) y 6 (masa) &#8211; la polaridad es irrelevante.</p>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="800" height="600" src="https://linuxete.duckdns.org/wp-content/uploads/2024/03/gpio.jpg" alt="" class="wp-image-1140" srcset="https://linuxete.duckdns.org/wp-content/uploads/2024/03/gpio.jpg 800w, https://linuxete.duckdns.org/wp-content/uploads/2024/03/gpio-300x225.jpg 300w, https://linuxete.duckdns.org/wp-content/uploads/2024/03/gpio-768x576.jpg 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /><figcaption class="wp-element-caption">Pinouts GPIO</figcaption></figure>



<p>En este momento estoy usando como sistema operativo <a href="https://sourceforge.net/projects/mx-linux/files/Final/Xfce/mx23.2_rpi_respin_arm64.zip/download">MX-23.2_rpi_respin</a> basada en Debian 12, ya que me parece más estable que la última versión oficial de Raspberry Pi Os, también basada en Debian 12.</p>



<p>  A continuación, abre el archivo /boot/firmware/config.txt con cualquier editor de texto, si usas la versión oficial puede ser que varíe la ubicación de ese archivo.</p>



<pre class="wp-block-code"><code>sudo nano /boot/firmware/config.txt</code></pre>



<p>Añade la siguiente línea en la parte inferior:</p>



<pre class="wp-block-code"><code>dtoverlay=gpio-shutdown</code></pre>



<figure class="wp-block-image aligncenter size-full"><img loading="lazy" decoding="async" width="901" height="551" src="https://linuxete.duckdns.org/wp-content/uploads/2024/03/Seleccion_038.png" alt="" class="wp-image-1142" srcset="https://linuxete.duckdns.org/wp-content/uploads/2024/03/Seleccion_038.png 901w, https://linuxete.duckdns.org/wp-content/uploads/2024/03/Seleccion_038-300x183.png 300w, https://linuxete.duckdns.org/wp-content/uploads/2024/03/Seleccion_038-768x470.png 768w" sizes="auto, (max-width: 901px) 100vw, 901px" /></figure>



<p></p>



<p>Reinicia tu Raspberry Pi 4 y ¡listo!</p>



<p>¡Ahora al pulsar el botón, si nuestra Pi está encendida, se apagará y si estaba apagada, se encenderá!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://linuxete.duckdns.org/instalar-boton-de-encendido-raspberry-pi-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
