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