Friday, March 20, 2015

RaspberryPi communication with Attiny85+PIR sensor alert system depends on movement

In this project I used Attiny85 + RaspberryPi+ 433Mhz Transmitter and PIR sensor. So when ever PIR sensor detect any human movement, it(PIR sensor) will activate attiny85 and send signal throw 433MHz transmitter and RaspberryPi will receive the signal and put to MySQL. Below video can explain more about my project:

Attiny85

Ask me question if you want to more about this project.

Saturday, March 14, 2015

Wordpress Permalink issue

This is only true for linux server:

If anyone of them is not working for you:

To enable it the rewrite module, run "apache2 enable module rewrite":You need to enable mod_rewrite
sudo a2enmod rewrite
You need to restart the webserver to apply the changes:
sudo service apache2 restart
If you plan on using mod_rewrite in .htaccess files, you also need to enable the use of .htaccess files by changing AllowOverride None to AllowOverride FileInfo. For the default website, edit /etc/apache2/sites-available/default:
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            # changed from None to FileInfo
            AllowOverride FileInfo
            Order allow,deny
            allow from all
    </Directory>
After such a change, you need to restart Apache again.

Thursday, March 12, 2015

How to install Oracle Java 7 in Ubuntu 14.04

Install Oracle Java 7 in Ubuntu via PPA

This package provides Oracle Java JDK 7 (which includes Java JDK, JRE and the Java browser plugin). However, you can't only install Oracle JRE - the PPA only provides the full Oracle JDK7 package.


To add our PPA and install the latest Oracle Java 7 in Ubuntu (supports Ubuntu 13.10, 13.04, 12.10, 12.04 and 10.04), use the commands below:

> sudo add-apt-repository ppa:webupd8team/java
> sudo apt-get update
> sudo apt-get install oracle-java7-installer


After the installation finishes, if you wish to see if it was successful, you can run the following command:

> java -version

It should return something like this:

java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)


Wednesday, March 4, 2015

RaspberryPi language perl problem solve

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_TIME = "es_ES.utf-8",
        LC_MONETARY = "es_ES.utf-8",
        LC_CTYPE = "es_ES.utf-8",
        LC_COLLATE = "es_ES.utf-8",
        LC_MESSAGES = "es_ES.utf-8",
        LC_NUMERIC = "es_ES.utf-8",
        LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
You may have to edit /etc/default/locale and add the default locales:
LANG=en_GB.UTF-8
LC_ALL=en_GB.UTF-8
LANGUAGE=en_GB.UTF-8

Best Solution :

sudo nano /etc/ssh/ssh_config
and put a # at the beginning of the line starting with SendEnv LANG LC...
Save, close and reconnect your SSH session and everything should be fine.

Sunday, March 1, 2015

How to rename the default account on the RaspberryPi

It is very tricky to rename an account while you are logged in to it, so first enable the root account with
% sudo passwd root
Use a secure password, even if you intend to lock the root account again later. Then log out and log back in as root. The rest supposes a desired username of “myuname” – replace with whatever you want.
# usermod -l myuname pi
# usermod -m -d /home/myuname myuname
Then log out and log back in again as “myuname”. If you are still using the default password of “raspberry” on this account, do
% passwd
and change password to something more secure. That should be it. Test carefully! “sudo” users seem to get updated OK, but check that your renamed account works and really does have “sudo” privileges before disabling the root account.
Should you prefer to disable the root account, do
% sudo passwd -l root
To edit the “/etc/hosts” file, type:
sudo nano /etc/hosts
Find the line that reads:
127.0.1.1       raspberrypi

And change the word “raspberrypi” to the new name, e.g. “garypi” and exit nano with “Ctrl + x”.
Reboot your Pi with “sudo reboot” and check the name using the “hostname” command.

RaspberryPi installation by using the Linux command line

Please note that the use of the "dd" tool can overwrite any partition of your machine. If you specify the wrong device in the instructions below you could delete your primary Linux partition. Please be careful.
  1. Download the zip file containing the image from a mirror or torrent
  2. Verify if the the hash key of the zip file is the same as shown on the downloads page (optional). Assuming that you put the zip file in your home directory (~/), in the terminal run:
    • sha1sum ~/2012-12-16-wheezy-raspbian.zip
    • This will print out a long hex number which should match the "SHA-1" line for the SD image you have downloaded
  3. Extract the image, with
    • unzip ~/2012-12-16-wheezy-raspbian.zip
  4. Run df -h to see what devices are currently mounted
  5. If your computer has a slot for SD cards, insert the card. If not, insert the card into an SD card reader, then connect the reader to your computer.
  6. Run df -h again. The device that wasn't there last time is your SD card. The left column gives the device name of your SD card. It will be listed as something like "/dev/mmcblk0p1" or "/dev/sdd1". The last part ("p1" or "1" respectively) is the partition number, but you want to write to the whole SD card, not just one partition, so you need to remove that part from the name (getting for example "/dev/mmcblk0" or "/dev/sdd") as the device for the whole SD card. Note that the SD card can show up more than once in the output of df: in fact it will if you have previously written a Raspberry Pi image to this SD card, because the Raspberry Pi SD images have more than one partition.
  7. Now that you've noted what the device name is, you need to unmount it so that files can't be read or written to the SD card while you are copying over the SD image. So run the command below, replacing "/dev/sdd1" with whatever your SD card's device name is (including the partition number)
    • umount /dev/sdd1
    • If your SD card shows up more than once in the output of df due to having multiple partitions on the SD card, you should unmount all of these partitions.
  8. In the terminal write the image to the card with this command, making sure you replace the input file if= argument with the path to your .img file, and the "/dev/sdd" in the output file of= argument with the right device name (this is very important: you will lose all data on the hard drive on your computer if you get the wrong device name). Make sure the device name is the name of the whole SD card as described above, not just a partition of it (for example, sdd, not sdds1 or sddp1, or mmcblk0 not mmcblk0p1)
    • dd bs=4M if=~/2012-12-16-wheezy-raspbian.img of=/dev/sdd
      • Please note that block size set to 4M will work most of the time, if not, please try 1M, although 1M will take considerably longer.
    • Note that if you are not logged in as root you will need to prefix this with sudo
    • The dd command does not give any information of its progress and so may appear to have frozen. It could take more than five minutes to finish writing to the card. If your card reader has an LED it may blink during the write process. To see the progress of the copy operation you can run pkill -USR1 -n -x dd in another terminal (prefixed withsudo if you are not logged in as root). The progress will be displayed (perhaps not immediately, due to buffering) in the original window, not the window with the pkillcommand.
  9. Instead of dd you can use dcfldd; it will give a progress report about how much has been written.
  10. Another option to monitor progress is to use Pipe Viewer (pv). Pipe dd input part through pv to the output part of dd:
    • dd bs=4M if=2014-09-09-wheezy-raspbian.img | pv | dd of=/dev/mmcblk0
    • 2,02GB 0:06:34 [10,4MB/s] [       <=>                              ]
  11. You can check what's written to the SD card by dd-ing from the card back to your harddisk to another image, and then running diff (or md5sum) on those two images. There should be no difference.
  12. As root run the command sync or if a normal user run sudo sync (this will ensure the write cache is flushed and that it is safe to unmount your SD card)
  13. Remove SD card from card reader, insert it in the Raspberry Pi, and have fun