Category Archives: hardware

Raspberry Pi GnuPlot Temperature

So, I have a raspberry Pi, and I wanted to chart it’s CPU temp

Ex: temp log hosted on RPI itself   | backup if the the RPI is down

To do this I needed to do a few things:

  1. Log the CPU temp (I’m doing every 5 minutes)
  2. Prepare the data
  3. Chart
  4. Show it to the world

1) Log data via 5 minute cron:

$ cat templog.sh 
temp=` cat /sys/class/thermal/thermal_zone0/temp| awk -v FS=" " '{print $1/1000""}'` 
echo "$temp | `date` ">>~/temp.log

Then a cronjob as normal user

*/5 * * * * bash ~/templog.sh

now a gnuplot script (plot.pg)

#!/usr/bin/gnuplot
reset
set nokey
plot "/home/pi/temp500" u 0:1
MAX=GPVAL_Y_MAX
min_y = GPVAL_DATA_Y_MIN
max_y = GPVAL_DATA_Y_MAX
f(x) = mean_y
fit f(x) '/home/pi/temp500'  u 0:1 via mean_y
 
set label 1 gprintf("Min = %g", min_y) at 52, 21 tc rgb "#00FFFF"
set label 2 gprintf("Max = %g", max_y) at 0, 21  tc rgb "#FF0000"
set label 3 gprintf("Mean = %g", mean_y) at 102, 21 tc lt 2
set terminal png size 1400,400
set style data linespoints
set yrange [20:MAX+(MAX*.1)]
set grid
set style line 1 lt 1 lw 3 pt 3 linecolor rgb "blue"
set object 1 rectangle from graph 0,0 to graph 1,1 behind fc rgbcolor "#10000f" lw 0
set pointsize .5
plot  \
"/home/pi/temp500" using 0:1 title "cpu temp" pt 5 ps .5  lc rgb "#FF0000" , \
min_y with filledcurves y1=min_y lt 1 lw 2 lc rgb "#00FFFF"  , \
max_y with filledcurves y1=max_y lt 2 lw 2 lc rgb "#FF0000", \
mean_y with filledcurves y1=mean_y lt 3 lw 2 lc 2,\
 "/home/pi/temp500" using 0:1 title "cpu temp" pt 5 ps .10  lc rgb "#0FfFFF"

now a script to run it all: (plot.sh)

#!/bin/bash
cat /home/pi/temp.log|tail -n 500 > /home/pi/temp500A
sed '/-/d'  /home/pi/temp500A  > /home/pi/temp500
chown pi:pi /home/pi * 
/root/plot.pg > /var/www/temp.png

pfSense2

So I recently bought a box to run pfSense2 on, to replace some of the crap on my network
before my home lan was more or less:

[Internets]—>[crappy actioncrap router from fios]—->[linksys running tomato]—>computers
now its   [internets]—>[pfSense]—[gigabit switch(unmanaged)]—>computers    (with linksys on the switch for wifis)

Hardware (total over kill)

  • BIOSTAR IPV10-IA Intel NM10 Mini ITX Intel Atom D525 (Dual core, 1.8 GHz) Server Motherboard
  • Kingston 4GB (2 x 2GB) 240-Pin DDR3 SDRAM DDR3 1066 (PC3 8500) Dual Channel Kit Desktop Memory Model KVR1066D3N7K2/4G
  • APEX MI-008 Black Steel Mini-ITX Tower Computer Case 250W Power Supply
  • Western Digital Caviar Blue WD1600AAJS 160GB 7200 RPM SATA 3.0Gb/s 3.5? Internal Hard Drive -Bare Drive

 

After the initial headaches I’m really starting to like it

Headache one:  For what ever reason pfSense would not boot of a usb drive (tested same usb drive with ubuntu, and booted just fine)   I got around this by just using the sata dvd/cd drive from my desktop…

Headache two: adding a NAT port forward will by default flush your state table, and I like to randomly add port fowards, and being on irc made this quite annoying,

To fix this you need to go to > System: Advanced: Miscellaneous and check the option:

Gateway Monitoring
States By default the monitoring process will flush states for a gateway that goes down. This option allows to override this setting by not clearing states for existing connections.

 

also some graphs :D

LASERS! HP 5517D Laser Head

So at a techno-swap fest I bought two lasers for $5 :D    sadly I have no idea how to get them running since I don’t have the power supply D:
If you know how to get them running tell me n_n   , they’re currently at Unallocated Space

 

scapy on the n900

I came across this rather neat tool called scapy, after playing around with on my desktops I wondered if it would run on my phone(nokia n900) so I checked the repos, and it was in there

Unfortunately AT&T blocks trace-routes :(      oh well, the n900 has wifi so it’s all good \o/

Here’s a demo of me doing a trace-route \o/

Start scapy :D

Start scapy :D

enter in the traceroute command

enter in the traceroute command

run it and watch the moving text :o

run it and watch the moving text :o

oh yay, it's done :D

oh yay, it's done :D

Then run    res.graph(target=”> /tmp/graph.svg”)     to export the graph to a svg   (For me it errors out if I just run res.graph()

Then you can view the .svg in the maemo browser :D

mmmm graphs

mmmm graphs

Of course you can do anything else that scapy allows you to do *evil grin* >.>   but I would highly recommend scripting that, entering in commands on the n900 is quite annoying xD

ex: my crappy but working script for the above:

#! /usr/bin/env python
import sys, os
from scapy.all import *
#txt file with a list
#remove \n
#get name of image to create
name_img = raw_input('enter in name for image: ')
askfile = raw_input('use file for server list? yes/NO: ')
 
if askfile == "yes" or askfile == "y":
	serverfile = open("/root/python/scapy/fromfile/servers", "r")
	servers = [line[:-1] for line in serverfile]
elif askfile == "no" or askfile == 'n' or askfile == "":
	servers = []
	serversin = raw_input("enter in domain/ip(seprate with a space): ")
	servers = serversin.split()
print servers
 
#broken D:
#askport = raw_input('Use default ports?(80, 443)?(YES/no): ')
#if askport == "" or askport == 'yes':
#	ports = "80, 443"
#else:
#	ports = raw_input("enter in ports(seprate with comma): ")
	#ports = portin.split()
#print ports
 
#wiere you want svg and pngs to poop out
path="/home/pronto/images/scapy/"
#scapy stuff
res,unans=traceroute(servers[0:],dport=[22,80,443],maxttl=20,retry=-2)
res.graph(target="> %s%s.svg" % (path,name_img))

Able Planet NC500SC Sound Clarity Noise Canceling Headphones

So about two months ago I bought the Able Planet NC500SC Sound Clarity Noise Canceling Headphones from woot.com

Able Planet NC500SC Sound Clarity

Able Planet NC500SC Sound Clarity

The head phones are pretty awesome for the most part, the active noise canceling is  amazing.
I tested them while mowing the lawn a few times, and wow I’m able to have music on a reasonable level while the headphones cancel out the majority of the lawn mower noise.

They’re also extremely comfortable, I’m able to have them on for hours at a time with no issues(which is a major plus)

The removable cord is a really great feature

The downsides are:
They seem bass heavy leaving the high frequency to suffer, not that much of an issue though
When the active noise canceling is on I’ll get horrible interference with an active cell phone,
I emailed Able Planet about this issue and got this response:

Good afternoon,
I’m sorry to hear that your being inconvenienced unfortunately, several
electronic devices could cause disruption it’s not a defect it’s just
electronics sending out frequencies.  I’m sorry I can’t be of much help
but there is not a whole lot that can be done.

If anyone knows how to stop or reduce interference with active noise canceling headphones, please leave a comment.

Other then those downsides, I love these headphones and would buy them again.