Showing posts with label sudo. Show all posts
Showing posts with label sudo. Show all posts

Thursday, August 30, 2012

on Leave a Comment

Bluetooth pairing on Raspberry Pi with smartphone


Follow the steps below to pair your Raspberry Pi with your smartphone:-

1. Load a new wheezy raspbian image on SD card via the MAC, from a terminal window enter:
sudo umount /dev/disk1s1
sudo dd bs=1m if=2012-09-18-wheezy-raspbian.img of=/dev/rdisk1
sudo umount /dev/disk1s1
2. Boot Raspbian, perform the initial configuration and increase the size of SD to maximum (4GB), & Reboot.
3. Perform a ssh login to Raspbian from MAC, username pi pw raspberry and enter commands:
su
(enter root password)
apt-get update
apt-get install -y bluetooth bluez-utils blueman
lsusb
/etc/init.d/bluetooth status
4. Enable tightvncserver  and remote connect to Raspbian to see its GUI.
5. From Raspbian's GUI select Preferences->Bluetooth Manager, a Bluetooth Devices window will pop up.
Click 'Search' on the Bluetooth Devices, go to the phone, turn on Bluetooth and enable discovery.
6. When Raspberry Pi detects the smartphone, click + on the Bluetooth Devices window. Click Setup, specify password 0000 on the Bluetooth Assistant window.
7. On the smartphone, enter 0000 to pair with Raspberry Pi, the phone should display "raspberry3-14" as a paired device.

setting up Bluetooth with raspberry pi

















The Raspberry Pi Bluetooth name can be changed using : Adapter->Preferences and change the Friendly Name.

Friday, August 24, 2012

on 2 comments

Setting up webcam on Raspberry Pi

I wanted to find out if the Raspberry Pi supports webcam or not. So I pulled an old Microsoft LifeCam NX-3000 to test with the Pi.The packages were talking a long time to load so I had to perform most of my installation on the emulator instead.
Since my MAC has single hard disk drive, the USB drive for the SD card would always be on /dev/disk1s1 when plugged in. To overcome the problem I created a shell script to write any Raspberry Pi  images on the SD card.

#!/bin/bash
sudo diskutil umount /dev/disk1s1
sudo dd bs=1m if=$1 of=/dev/rdisk1
sudo diskutil umount /dev/disk1s1

Through Qemu you can quickly install debian packages on SD card.The image can be loaded on the SD card using the script above.Follow the steps below to test webcam packages on the Raspberry Pi:

1. Remotely access your Linux box using ssh, then mount the folder containing wheezy raspbian image.
2. Create a raw 3GB raw image disk and copy wheezy raspbian onto it:
qemu-img info 2012-09-18-wheezy-raspbian.img
qemu-img create -f raw newwheezy.img 3G
dd if=2012-09-18-wheezy-raspbian.img of=newwheezy.img
3. Start qemu without graphic, and specify 512MB memory (or replace the flag to -m 1024 to use 1GB memory), command:
sudo qemu-system-arm -kernel kernel-qemu -cpu arm1176 -M versatilepb -m 512 -no-reboot -append "root=/dev/sda2" -hda newwheezy.img -net nic -net user -nographic
4. Within qemu emulating Raspbian:
sudo passwd root
(enter new root password: root, twice)
su
(enter root)
aptitude update
aptitude install -y camorama
aptitude show camorama (to make sure it's installed).
shutdown -h now
(enter Ctrl-a x to exit qemu, then quit ssh session to go back to the MAC).
5. From the MAC, use sftp or scp to copy the new wheezy raspbian image loaded with camorama, command:
./loadsd.sh newwheezy.img
6. Now boot your Raspberry Pi with new wheezy raspbian. Enter command: startx to start the GUI & click LXTerminal, enter:
lsub (a list of USB devices is displayed, one of those lines listed the LifeCam)
camorama (command to start camorama, or command cheese to start cheese)


Thursday, July 19, 2012

on Leave a Comment

Overclocking the Raspberry Pi


Raspberry Pi uses the Broadcom BCM2835 system-on-chip (SoC) processor which was originally developed to be used with applications that involved heavy graphics and multimedia handling. This led to the design of architecture that pairs a relatively weak and outdated CPU with a massively powerful graphics processor.The CPU instruction set is based on an outdated ARM v6  architecture.


Overclocking the Raspberry Pi is quite different from that of the desktop processors, where if you overclock it and crank up the voltage a few notch you can sustain a higher clock rate with increased power consumption.But the problem with Raspberry Pi is that it uses a mobile phone chip and over-volting can significantly lower the overall chip lifetime.


Even though, since launch Raspberry Pi supported over-volting and overclocking by modifying the "config.txt". The Raspberry Pi can be safely overclocked to 1 GHz without voiding the warranty. Over-volting  is not recommended as it will permanently set a fuse in your SoC and void your warranty.


The latest version of the Raspbian operating system has inbuilt overclock method built into it.With the help of cpufreq driver it offers a “turbo mode”, which can dynamically overclock and over-volt the chip without voiding your warranty.To overclock enter "sudo raspi-config"  in Terminal. Select "overclock" and reboot the system. This will enables dynamic overclocking. If your Raspberry Pi gets too hot(85°C) it will automatically drop back down to 700MHz.


In case the Pi fails to boot due to higher clock, hold the shift key to disable the overclock for that boot session. Link for default clock: http://elinux.org/RPi_config.txt#Overclocking_configuration. Also make sure that you have a decent quality power supply capable of handling the extra load due to overclocking.





Saturday, June 23, 2012

on 1 comment

Safely Shutting Down / Rebooting your Raspberry Pi


Well the most easiest way to shut down any computer is by pulling the plug or to switch it off directly. As with most of the PCs they can be switched off forcibly even when the system has crashed by holding the power switch for 3 secs. But this method isn't quite healthy for your system as it can damage the HDD or BIOS. For the Raspberry Pi, it can cause problems or corrupt the SD card.

So now let’s talk about how to shut down your Raspberry Pi when it hasn't frozen.

sudo shutdown -h now (or sudo halt)  [-h means halt the system] [now means to shutdown immediately]

You can also use the shorthand's:- `halt` and `reboot`.


Remember that you will need sudo privileges to  use shutdown (or halt)

When the shutdown command is entered it sends out a message to all logged in users
“The system is going down for system halt NOW!”
If you want to reebot your system simply replace the -h with -r 
sudo shutdown -r now (or sudo reboot) [-r means reboot the system] [now means to shutdown immediately]

Now for cases when your system is not responding or frozen,ssh comes in handy.By using a ssh client on another computer within the same network start an Xterm console window and enter the given commands..
sudo shutdown -h now (or sudo halt) OR
sudo shutdown -r now (or sudo reboot)
Your ssh session will terminate as the system is shutting down.