I've stumbled recently upon a little gem called AVR-Stick and bought two of them for about 7€ per stick. I also had a thermoregulated fan controller salvaged from a recycled computer. I decided to desolder a thermistor from that controller and put it onto the stick to use it as a USB temperature logger. Stick's ATtiny85 has an internal temperature sensor too but it should be calibrated otherwise its precision is ±10°C. Thermistor that I'm using is equivalent to the NTCLE100E3103JB0 and its resistance is 10K at 25°C. Any other NTC thermistor that has resistance around 10K at room temperature could also be used but it should be checked if manufacturer specifies Steinhart-Hart equation coefficients for it.
Thoughts and ideas about programming, scripting, automation, electronics, gadgets, web and technology
Friday, June 29, 2012
AVR-stick as a temperature logger
Labels:
attiny85,
avr-stick,
bash,
bootloader,
C,
collectd,
logger,
lua,
temperature
Thursday, June 7, 2012
Using of the xfce4-messenger-plugin
I was looking for a way to display an icon on a xfce desktop panel on some event. One possible solution is to use the xfce4-messenger-plugin. The plugin listens to messages on the D-Bus and displays them in a pop-up window or in the panel. Additionally it can display an icon if the message sent is prefixed with a identifier.
Tuesday, June 5, 2012
dnsmasq cache size tuning
dnsmasq is a lightweight DNS forwarder and DHCP server used primarily in embedded systems (like routers) where resources are limited. DNS queries are small in size but latency introduced can be significant depending on the proximity of a DNS server that can answer the query. DNS queries are usually cached either by a web browser of by the operating system but if several clients are connecting to the Internet through a router they would all need to send 'possibly' same DNS requests over again. That's why dnsmasq running on a router has a local cache for DNS queries.
Saturday, June 2, 2012
Mount WebDAV resources with davfs2 and secure it with encfs
Number of online resources offering free remote storage facilities has seriously increased in the recent time and it continue to grow taking a good share from the Dropbox's marketspace. Dropbox has been on the cloud storage market since the early days but for many people a proprietary client offered by Dropbox is not acceptable. There are of course attempts to overcome such a drawback by implementing an open source client that is configurable to use different types of cloud storage facilities transparently to the user. An example for such a client is syncany.org. I've been waiting for the syncany.org project to reach a mature state for months but it seems like they are not making it in the near future. So I started to look for other possibilities to utilize cloud storage facilities using only standard means available on the operating system's level that would require no dedicated client to be installed. The rest of the article is devoted mainly to users of Unix-like OS's but there is a section in the end explaining how to mount and encrypt WebDAV resources on Windows platform.
Sunday, February 26, 2012
Digital Picture Frame as a router status display
A 320x240 cheap (2,90€ by pearl.de) digital picture frame attached to a router is a very useful addition to show router's status information. The DPF display driver is already integrated into the lcd4linux project that makes it easy to use the frame. This for example is how it works for me:
Some details regarding DPF hacking can be found here (the page is in German)
Although lcd4linux is a powerful tool I'm still looking for a way to build complex dynamic menu structures to be able to control MPD from my remote, i.g to be able to navigate visually through the MPD database and select items into the playlist. And it seems like the lcd4linux is not powerful enough to do such things. I'll add some additional notes if I find a solution.
Update: my lcd4linux.conf for this layout is here
Update2: the digit's font is Impact, 48 points
Update3: I was asked to add some info about weather parsing
Well, first of all I have a script that is called when WAN interface goes up:
Friday, June 10, 2011
A simple bash IRC logging bot
Couple of years ago I googled for a simple bash IRC logging bot that I could start on my router to log some channels. I've found a very simple script that worked but didn't handle PINGs from the server. So I extended it a bit trying to keep it as simple as possible.
Thursday, March 3, 2011
Encrypting with the openssl in bash
With a bit of commandlinefu it becomes easy to encrypt and decrypt files with the strong 256 bit aes algorithm using openssl.
Add the following into your ~/.bashrc
# crypting functions
function encrypt {
if [ -t 0 ]; then
# interactive
local fname="$1"
shift
openssl aes-256-cbc -salt -in "$fname" -out "${fname}.enc" $@
else
# piped
perl -e 'use IO::Select; $ready=IO::Select->new(STDIN)->can_read();'
openssl aes-256-cbc -salt $@
fi
}
function decrypt {
if [ -t 0 ]; then
# interactive
local fname="$1"
shift
openssl aes-256-cbc -d -in "$fname" -out "${fname%\.*}" $@
else
perl -e 'use IO::Select; $ready=IO::Select->new(STDIN)->can_read();'
openssl aes-256-cbc -d $@
fi
}
and source it to let changes take effect (source ~/.bashrc).
Labels:
bash,
encrypting,
openssl
Thursday, January 27, 2011
collectd-mod-exec Part 5
Part 1
Part 2
Part 3
Part 4
In this final part I'm publishing a real world example of the collectd-exec usage - weather info collecting script.
I'm using yahoo weather api to get weather information because it sends back very concise xml formatted text file which is only 2k in size. The weather info is updated once per hour so I've added special logic to retrieve it once per hour and feed same values in between.
Part 2
Part 3
Part 4
In this final part I'm publishing a real world example of the collectd-exec usage - weather info collecting script.
I'm using yahoo weather api to get weather information because it sends back very concise xml formatted text file which is only 2k in size. The weather info is updated once per hour so I've added special logic to retrieve it once per hour and feed same values in between.
Labels:
bash,
collectd-exec,
OpenWRT,
weather
Wednesday, January 26, 2011
collectd-mod-exec Part 4
Part 1
Part 2
Part 3
There is only one thing left to explain - how to get notified if some values go out of scope. As an example I'm going to send notification emails if CPU temperature reaches 57 degree Celsius. This could be implemented with only one additional if statement and this would work perfectly if I only had one script that sends notifications. It would become cumbersome if I needed to edit multiple scripts to change say an email address where my notifications are sent. In other words the collecting and notification logics shall be separated. To do this one can use 'PUTNOTIF' statement that shall be sent to the script STDOUT - exactly the same way like 'PUTVAL' is sent. Documentation of the 'PUTNOTIF' arguments can be found on the collect-exec module documentation page. Additionally there shall be some logic added to send notification after some time out period otherwise emails would be sent after each $COLLECTD_INTERVAL which is by default 30 seconds. Updated tmpcollect.sh script is shown below:
Part 2
Part 3
There is only one thing left to explain - how to get notified if some values go out of scope. As an example I'm going to send notification emails if CPU temperature reaches 57 degree Celsius. This could be implemented with only one additional if statement and this would work perfectly if I only had one script that sends notifications. It would become cumbersome if I needed to edit multiple scripts to change say an email address where my notifications are sent. In other words the collecting and notification logics shall be separated. To do this one can use 'PUTNOTIF' statement that shall be sent to the script STDOUT - exactly the same way like 'PUTVAL' is sent. Documentation of the 'PUTNOTIF' arguments can be found on the collect-exec module documentation page. Additionally there shall be some logic added to send notification after some time out period otherwise emails would be sent after each $COLLECTD_INTERVAL which is by default 30 seconds. Updated tmpcollect.sh script is shown below:
Labels:
bash,
collectd-exec,
OpenWRT
Monday, January 24, 2011
Subscribe to:
Posts (Atom)
![[Image]](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAgYJLD5BudImPD7BAh8oKKm-2Hl1UzQSY0NmZJz46aWfzyKuyCf-iFuO-aP-dDxB6WzMVTUSEHmPd9k0XZOq0sAjSbxo1ZcKT6rXWZeuqzzsujdUViawjADmt21m3FCwqnE2I12cHlS0/s1600/avrstick.jpg)
![[Image]](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZrpcNh7S4FFxU_pfcXg_L6wGMZfzOYOeh0ASBAru54kzoVPGOMNSujpzruue_N2Yxr6eT2gHGF-Ppi2XSUysnhMd3x6SsCn_z4tChP2Tn8WErhB6WK3UAUhNvjiPjfdex_S25svohywg/s1600/lcd4linux.gif)