53 lines
1.7 KiB
Markdown
53 lines
1.7 KiB
Markdown
---
|
||
title: "Refresh System [Active + Passive]"
|
||
date: 2014-01-29
|
||
url: refresh-system-active-passive
|
||
layout: post
|
||
category: Hacking
|
||
---
|
||
|
||
{% include gallery.html URIs='refresh-system-active-passive_1.jpg;refresh-system-active-passive_2.jpg' %}
|
||
|
||
### Passive refresh
|
||
|
||
I've bought and installed [that Heat Dissipation](http://dx.com/p/abs-heat-dissipation-panel-for-raspberry-pi-silver-white-1-x-3pcs-222212#.Ut2DzLRKG70) for Raspberry.
|
||
|
||
### Active refresh
|
||
|
||
I've installed a little fan, which is powered in continue by 3.3V of Raspberry.
|
||
|
||
To report out the temperature level inside the case, I've two LEDS (one green and one red), which are set on or off, controlled by a _BASH_ script below, with [GPIO Pins](https://projects.drogon.net/raspberry-pi/wiringpi/pins/), as a function of measured temperature.
|
||
|
||
The surveillance of the temperature is run every minutes by [Cron](https://fr.wikipedia.org/wiki/Cron) :
|
||
|
||
> \* \* \* \* \* bash /path/to/script/LED_Temp.sh > /dev/null
|
||
|
||
[Fritzing](http://fritzing.org/) of the wiring :
|
||
|
||
[![A missing blog post image](/img/blog/refresh-system-active-passive_3.png)](/img/blog/refresh-system-active-passive_3.png)
|
||
|
||
{% highlight bash %}
|
||
#!/bin/bash
|
||
|
||
# Author: Horloge-Skynet
|
||
# Date: Begun 2014-01-26
|
||
# Objective: Light up colored LED as a function of temperature
|
||
|
||
temp=$(/opt/vc/bin/vcgencmd measure_temp);
|
||
|
||
/usr/local/bin/gpio mode 4 out # Red LED
|
||
/usr/local/bin/gpio mode 6 out # Green LED
|
||
|
||
if [${temp:5:2} -gt 30]; then
|
||
|
||
/usr/local/bin/gpio write 6 0 # Shutdown green LED
|
||
/usr/local/bin/gpio write 4 1 # Light up red LED
|
||
|
||
else
|
||
|
||
/usr/local/bin/gpio write 4 0 # Shutdown red LED
|
||
/usr/local/bin/gpio write 6 1 # Light up green LED
|
||
|
||
fi
|
||
{% endhighlight %}
|