Jan 25, 2015

High CPU temperature Raspberry Pi warning by mail

Prevent to bake your Raspberry Pi with this script. It alerts you by mail when CPU temperature is too high. Let's start.... Create your script file:
 cd to /path/you/prefered/   
 sudo nano nameofscript.py #this wiil create blank file and paste code   
CODE:
 #!/usr/bin/env python  
 # coding=utf-8  
 import os  
 import smtplib  
 from email.mime.text import MIMEText  
 # At First we have to get the current CPU-Temperature with this defined function  
 def getCPUtemperature():  
  res = os.popen('vcgencmd measure_temp').readline()  
  return(res.replace("temp=","").replace("'C\n",""))  
 # Now we convert our value into a float number  
 temp = float(getCPUtemperature())  
 # Check if the temperature is abouve 60°C (you can change this value, but it shouldn't be above 70)  
 if (temp >50):  
  # Enter your smtp Server-Connection  
  server = smtplib.SMTP('smtp.gmail.com' , 587)  
  #if your using gmail: smtp.gmail.com  
  server.ehlo()  
  server.starttls()  
  server.ehlo  
  # Login  
  server.login("yourmail@gmail.com" , "yourpassword")  
  # Now comes the Text we want to send:  
  value = "Warning! Too high CPU Temperature is: " + getCPUtemperature()  
  msg = MIMEText(value)  
  # The Subject of your E-Mail  
  msg['Subject'] = "Warning! Too high CPU Temperature:" + getCPUtemperature()  
  # Consigner of your E-Mail  
  msg['From'] = "Raspberry Pi"  
  # recipient of your E-Mail  
  msg['To'] = "receivermail@gmail.com"  
  # Finally send the mail  
  server.sendmail("yourmail@gmail.com", "receivermail@gmail.com", msg.as_string())  
  server.quit()  
Fill your data and save file (CTRL+O-> Enter) and exit (CTRL+X). To test it just make temperature lower than actual. If you receive mail everything is correct. One more thing add script to crontab:
 su - # to become root  
 crontab -e # to edit   
Then add:
 */5 * * * * python /path/to/yourscript/yourscript.py 2>&1 # this will check your temp every 5 minutes  
And again save file (CTRL+O-> Enter) and exit (CTRL+X). That's it! You are done!

You can buy sensors from HERE

Jan 24, 2015

Daily CPU and harddisk status updates on Raspberry PI by mail

Very useful script to daily status updates of CPU temperature and attached HDD on your Raspberry Pi.
To create a script copy the code and make a file with command:
 cd to /path/you/prefered/  
 sudo nano nameofscript.py #this wiil create blank file and paste code   

CODE:
 # coding=utf-8  
 import os  
 import smtplib  
 import statvfs  
 from datetime import timedelta  
 from email.mime.text import MIMEText  
 #Read the systems uptime:  
 with open('/proc/uptime', 'r') as f:  
   uptime_seconds = float(f.readline().split()[0])  
 # At First we have to get the current CPU-Temperature with this defined function  
 def getCPUtemperature():  
  res = os.popen('vcgencmd measure_temp').readline()  
  return(res.replace("temp=","").replace("'C\n",""))  
 # Now we convert our value into a float number  
  temp = float(getCPUtemperature())  
 #Read the statistics of the drives in bytes and convert to Gigabytes (using the mount points)  
 GB = (1024 * 1024) * 1024  
 HDD = os.statvfs ("/media/SERVICE")  # in my case is mounted to /media/ , name is SERVICE  
 HDD = (HDD.f_frsize * HDD.f_bfree)/GB  
 #HDD1 = os.statvfs ("/media/HDD2")  
 #HDD1 = (HDD1.f_frsize * HDD1.f_bfree) / GB  
 # Enter your smtp Server-Connection  
 server = smtplib.SMTP('smtp.gmail.com' , 587)  
  #if your using gmail: smtp.gmail.com  
 server.ehlo()  
 server.starttls()  
 server.ehlo  
  # Login  
 server.login("yourmail@gmail.com" , "yourpassword")  
 # Now comes the Text we want to send. It will send the System Uptime, the CPU Temperature and the free space of your hard drives:  
 value = "System Uptime (hh:mm:ss) is: " + str(timedelta(seconds = uptime_seconds)) + "\n" + "CPU Temperature is: " + getCPUtemperature() + "C " + "\n" + "HDD Free Space: " + str(HDD) + " GB"  
 msg = MIMEText(value)  
 # The Subject of your E-Mail  
 msg['Subject'] = "Daily Raspberry Pi Status" #you can wtite everyting you prefer   
 # Consigner of your E-Mail  
 msg['From'] = "Raspberry Pi"  
 # recipient of your E-Mail  
 msg['To'] = "receivermail@gmail.com"  
 # Finally send the mail  
 server.sendmail("sendermail@gmail.com", "receivermail@gmail.com", msg.as_string())  
 server.quit()  
You have to change this lines according where your HDD is mounted and name of it:
 HDD = os.statvfs ("/media/SERVICE")      # in my case is mounted to media and name is SERVICE  
 HDD = (HDD.f_frsize * HDD.f_bfree)/GB  
Check where is maunted and what's the name of HHD with this command:
 df -h   
You will see it of the bottom of output. When you are ready with edited code test it with this command: cd /path/to/script sudo python nameofscript.py and wait to receive mail :) If everything is OK add script to crontab:
 su - #to become a root  
 crontab – e # to edit cron jobs  
and add this line:
 */*10* * * * python /path/to/yourscript/temp_usbHDD_status.py 2>&1   
 # with this you will receive mail every day at 10 am.  
To save it -> CTRL+O-> Enter To exit -> CTRL+X Final result: That's it! You are done!
Source

You can buy sensors from HERE

Jan 7, 2015

SELL Nokia N770 Tablet / PDA








 

Like new great condition except the cap around audio/usb/charging ports you can see it from images(this is cap not main panel).No scratches!
Battery is NOT original, but working!

You will receive:
N770 + battery + stylus + hard case + pouch 


Specifications

  • Dimensions: 141×79×19 mm (5.5×3.1×0.7 in)
  • Weight: 230 g (8.1 oz) with protective cover or 185 g (6.5 oz) without.
  • Processor: Texas Instruments OMAP 1710 CPU running at 252 MHz. It combines the ARM architecture of the ARM926TEJ core subsystem with a Texas Instruments TMS320C55x digital signal processor.
  • Memory: 64 MB (64 × 220 bytes) of DDR RAM, and 128 MB of internal flash memory, of which about 64 MB should be available to the user. Option for extended virtual memory (RS-MMC up to 1 GB (2 GB after flash upgrade)).
  • Display and resolution: 4.1 inches, 800×480 pixels at 225 pixels per inch with up to 65,536 colors
  • Connectivity: WLAN (IEEE 802.11b/g), Bluetooth 1.2, dial-up access, USB (both user-mode, and non powered host-mode)
  • Expansion: RS-MMC (both RS-MMC and DV-RS-MMC cards are supported).
  • Audio: speaker and a microphone
  •  
    PRICE: $100 USD 
    SHIPPING: $20 USD WORLDWIDE

Feb 12, 2014

Как да включим Numlock при влизане Ubuntu 12.04 LTS

Много дразнещо, когато си пишеш паролата с Numlock а не е включена!

Ето как си реших проблема...

Въвеждаме в терминала следната команда:
 sudo apt-get install numlockx  
След това трябва да редактираме /etc/lightdm/lightdm.conf:
 gksudo gedit /etc/lightdm/lightdm.conf  

Добавяме този ред в края на файла: greeter-setup-script=/usr/bin/numlockx on

Запазваме и готово! Тествайте, като рестартирате системата.

Feb 8, 2014

Как да сменим иконката на клавиатурната подредба със знаме в Ubuntu 12.04 LTS


Здравейте, така би трябвало да изглежда иконката след командите, които ще въведем. Интересно и приятно изглежда поне според мен :)

1. Като начало е необходимо да свалим файла със знамената. Може да го свалите от ТУК .

2.Следващата стъпка е да го разархивираме. Вече разархивираният файл преместваме в"  /usr/share/pixmaps/flags/ " .

3.Отваряме терминала (Ctrl+Alt+T) и въвеждаме следната команда:
 

 gconftool-2 --type bool --set /desktop/gnome/peripherals/keyboard/indicator/showFlags true  

С нея разрешаваме показването на знамето;). Това е!!! Сега е нужно само да излезем и влезем отново в системата.

Jan 20, 2014

NeatROM v5.6 for Samsung Galaxy S2


I decided to share this ROM with you, because I think it's really cool. Based on stock ROM with additional settings. You have to root your device, before install the ROM. You can check link below for instructions. ENJOY!

Source: xda-developers.com

Jan 9, 2014

HOWTO: Fix Samsung Galaxy S2 Gallery Not Opening claims Not Enough Storage


 

 It's so terrible to take a picture and when want to see it  popups this problem....
OK let me share with you two methods to fix this:


#Method 1

Just dial *#9900#  and then select " Deletedumpstate/logcat ".  Then "Exit".

This will raise your available storage. If this not solve problem try next method.


#Method 2

Go to -> Setting->Application manager->ALL-> Gallery and select  "Clear data"
Then restart.


This work for me, hope to work for you too.
Good luck!

Jan 8, 2014

Monitor fireplace water temperature using Raspberry Pi + DS18B20 sensors + Alarm

Before you start make sure that you have configured cacti installation.
To complete the project, you will need the following parts :
  • Raspberry Pi
  • DS18B20 Digital temperature sensor(s)
  • 4 .7K or 10K ohm resistor
  • Jumper wire
I used waterproof version of the DS18B20 the device has three leads: red(VCC), black(GND) and yellow(DATA). Every seller may have different variation of colors!
How to connect sensor to your Raspberry Pi.


As you can see sensor is NOT waterproof, but this is only for example!
Now login in Raspberry Pi and open terminal. You can use ssh to operate with Pi.
Type these commands into a terminal window:
 sudo modprobe w1-gpio 
 sudo modprobe w1-therm 
 cd /sys/bus/w1/devices 
 ls 
 cd 28-xxxx (change this to match what serial number pops up) 
 cat w1_slave 

If everything is OK, you will see current temperature.

I have two sensors with unique serial numbers for my fireplace in/out water.
I use this perl script,because reading the sensors on the command line with cat isn't very useful.

Script is for ONLY ONE SENSOR!
 #!/usr/bin/perl
 $mods = `cat /proc/modules`;
 if ($mods =~ /w1_gpio/ && $mods =~ /w1_therm/)
 {
  print "w1 modules already loaded \n";
 }
 else 
 {
 print "loading w1 modules \n";
 $mod_gpio = `sudo modprobe w1-gpio`;
 $mod_them = `sudo modprobe w1-therm`;
 }
 $sensor_temp = `cat /sys/bus/w1/devices/10-*/w1_slave 2>&1`;
 if ($sensor_temp !~ /No such file or directory/)
 {
 if ($sensor_temp !~ /NO/)
 {
     $sensor_temp =~ /t=(\d+)/i;
     $tempreature = (($1/1000)-0); #You can fix your temp value.In this case is0
     print "fireplace temp = $tempreature\n"; #Print fireplace temp as result
     exit;
 }
 die "Error locating sensor file or sensor CRC was invalid";
 }

Now you need to install RRDtool archiving and graphing temperature readings.
This command will install it.
 sudo apt-get install rrdtool

Then create database to store readings.
 pi@raspberrypi:~/rrdtool create fireplace.rrd --step 300 \ 
 DS:temp:GAUGE:600:0:100 \ 
 RRA:AVERAGE:0.5:1:12 \ 
 RRA:AVERAGE:0.5:1:288 \ 
 RRA:AVERAGE:0.5:12:168 \ 
 RRA:AVERAGE:0.5:12:720 \ 
 RRA:AVERAGE:0.5:288:365 

A shell script produces graphs.
 
 #!/bin/bash 
 RRDPATH="/home/pi/temperature/" 
 RAWCOLOUR="#FF0000" 
 TRENDCOLOUR="#0000FF" 
 # Edited 2012/12/9 to add running averages to hourly and daily graphs 
 #hour 
 rrdtool graph $RRDPATH/hour.png --start -6h \ 
 DEF:temp=$RRDPATH/fireplace.rrd:temp:AVERAGE \ 
 CDEF:trend=temp,1800,TREND \ 
 LINE2:temp$RAWCOLOUR:"Hourly Raspberry PI temperature" \ 
 LINE1:trend$TRENDCOLOUR:"30 min average" 
 #day 
 rrdtool graph $RRDPATH/day.png --start -1d \ 
 DEF:temp=$RRDPATH/fireplace.rrd:temp:AVERAGE \ 
 CDEF:trend=temp,21600,TREND \ 
 LINE2:temp$RAWCOLOUR:"Daily Raspberry PI temperature" \ 
 LINE1:trend$TRENDCOLOUR:"6h average" 
 #week 
 rrdtool graph $RRDPATH/week.png --start -1w \ 
 DEF:temp=$RRDPATH/fireplace.rrd:temp:AVERAGE \ 
 LINE2:temp$RAWCOLOUR:"Weekly Raspberry PI temperature" \ 
 #month 
 rrdtool graph $RRDPATH/month.png --start -1m \ 
 DEF:temp=$RRDPATH/fireplace.rrd:temp:AVERAGE \ 
 LINE1:temp$RAWCOLOUR:"Monthly Raspberry PI temperature" \ 
 #year 
 rrdtool graph $RRDPATH/year.png --start -1y \ 
 DEF:temp=$RRDPATH/fireplace.rrd:temp:AVERAGE \ 
 LINE1:temp$RAWCOLOUR:"Yearly Raspberry PI temperature" \ 

To run the perl sensor reading code and the graph generating script every five minutes from a cron job.
 # m h dom mon dow command 
 */5 * * * * /home/pi/temperature/get_temp_one.pl 
 */5 * * * * /home/pi/temperature/graph_temp_one.sh  

Where get_temp_one.pl is the perl sensor code, and graph_temp.sh plots the graphs.



Cacti can use external rrd files. I found very good tutorial to make it happen.
TUTORIAL: external rrd files in cacti

Aaand final result in cacti!





You can download all need files from DROPBOX
 get_temp_one.pl - script for ONE sensor 
 get_temp_multiple.pl – script for MULTIPLE sensors 
 graph_temp_one.sh – graph ONE sensor 
 graph_temp_multiple.sh – graph MULTIPLE sensor 
 create_rrd.sh – creates rrd file 
 createrrd_multi.sh - creates rrd file for multiple sensors 

If you want mail alert when temperature is high or low check here.
 

 Hope you like it! Enjoy!

You can buy  DS18B20 sensors from HERE


Dec 17, 2013

Fiskars X7 Hatchet splitting wood


Get more done faster with a hatchet that chops deeper on every swing and includes a heavy-duty sheath.

Another easy-to-carry choice perfect for hikers and outdoor enthusiasts, the X7 Hatchet is ideal for chopping kindling and small- to medium-sized logs. Like every X-Series Hatchet or Axe, the X7 combines perfected weight distribution, advanced blade geometry, an ultra-sharp edge and virtually unbreakable design to maximize your performance. This combination of features allows the blade to bite three times deeper when chopping. With more blade penetration on each swing, you can chop more wood in less time, with less effort and hand strain.

Features

  • Ideal for chopping kindling and small- to medium-sized logs
  • Chops up to three times deeper with each swing to chop more faster
  • Perfected balance and power-to-weight ratio increases swing speed to multiply power, much like an aluminum baseball bat
  • Proprietary blade-grinding technique provides a sharper edge for better contact and cleaner cuts
  • Hardened forged steel blade stays sharp longer than traditional axes
  • Low-friction blade coating powers through wood and prevents head from getting stuck
  • Inseparable PermaHead insert-molded head will not loosen and prevents overstrike breakage
  • Shock-absorbing DuraFrame handle is lightweight yet stronger than steel to prevent overstrike damage
  • Non-slip grip reduces hand strain and improves control
  • Designed in Billnäs, Finland, building on a 360-year history of the world’s best forged tools
  • Included sheath helps protect blade and the user

    I know that #X7 is NOT for splitting, but I think it's doing it well :)  Second season splitting!
    Next will be #X11 :))) Thanks #Fiskars!

McCulloch MAC 842 chainsaw in action


Product Description

The MAC 842 petrol chainsaw by McCulloch is made for challenging tasks and features the advanced ECOBOOST engine technology for lower emissions, increased engine power, but with reduced fuel consumption.Ideal for domestic use for jobs such as cutting fire wood and cutting back trees, the MAC 842 is lightweight and easy to use. With a comfortable, ergonomically designed handle for maximum operator comfort, your MAC 842 is powered by a 42cc 1.6Kw engine with easy start technology for up to 30% less pulling effort and anti-vibration for improved handling, forcing the chain around at 18.5m/s.
The comfort touch rear handle gives you added operating comfort.
Your MAC 842 is equipped with a 40cm bar, and auto oil feed to keep the chain lubricated. You don't need to worry about carrying tools around with you, your MAC 842 has tool-less chain tensioning, meaning adjusting the chain is quick and easy. For added safety and peace of mind, it is also fitted with anti kickback protection.
The fuel tank holds 340ml of fuel, and the oil tank holds 200ml. It's light weight design means that using your MAC 842 won't leave you feeling tired and exhausted after the job is complete.
Your MAC 842 comes fully assembled.


McCulloch mac 842 petrol chainsaw black/yellow 1.6KW 1200RPM (Max recommended) 0.34L FUEL/0.2L oil tank volume Cylinder displacement: 42cm³ / 2.56cu.inch 1.6kW / 2.2hp(l). 12000 rpm (Maximum recommended) Fuel tank volume: 0.34L / 0.16 US pint. Oil tank volume: 0.2L / 0.09 US pint Oil pump type: Automatic. Oil pump capacity: 4-8 ml/min Chain pitch: 3/8 Inches. Ecoboost feature CCS-system feature. Advanced engine system for lower emission.

I am very happy with this chainsaw!