Search

Tech Tip's : Do's and dont's

Month

December 2013

Logitech camera setup – Raspberry Pi

Webcam on RaspberryPi

I had a Logitech C310 Webcam lying idle at home so decided to give it a try with the Raspberry Pi.

After hooking any usb device i always have a tendency to run lsusb and lsmod
It worked out of the box, i was able to see /dev/video0
Motion detection was good and captured screenshots with date time stamp.
Steps
sudo apt-get update
sudo apt-get install motion

sudo nano /etc/motion/motion.conf
change these lines to “off” in that file:
control_localhost off
webcam_localhost off

Start the program
sudo motion -n
Check Video Streams
http://raspberry ip address:8081 on the PC
Video Streaming was not usable it was very slow even at 320×240 @ 7~10 fps
Check these articles for Motion
Raspberry Pi • View topic – USB Cams and Motion on Debian
Jeremy’s Blog: Raspberry Pi webcam For Arch Linux
RaspberryPi birdfeeder webcam « Random Hacks
Raspberry Pi • View topic – video surveillance (USB webcam, IP cam…) enough power?
tsuki_chama: Raspberry Tank Day 14: Video Streaming
Jeremy’s Blog: Battery powered, Wireless, Motion detecting Raspberry Pi
Check these articles for Streaming  Webcam From The Raspberry Pi
How To : Stream A Webcam From The Raspberry Pi » The Rantings and Ravings of a Madman
How To : Stream A Webcam From The Raspberry Pi Part 2 » The Rantings and Ravings of a Madman
tsuki_chama: Raspberry Tank Day 14: Video Streaming
Webcam streaming with Raspberry Pi
References
WebHome Motion  Foswiki
Raspberry Pi • View topic – video surveillance (USB webcam, IP cam…) enough power?
Raspberry Pi • View topic – Security Camera System
Raspberry Pi • View topic – USB Cams and Motion on Debian
Webcam with the Linux UVC driver – OpenWrt Wiki
Interesting Projects
Battery powered, Wireless, Motion detecting Raspberry Pi 
RaspberryPi birdfeeder webcam « Random Hacks
Motion Google Drive Uploader and Emailer
Instant Wild Cambridge.ppt – Google Docs

Advertisements

Raspberry pi tips


# Finish headless installation via ssh. See /boot/config.txt


(local)$ ssh pi@192.168.2.X


$ sudo apt-get update && apt-get dist-upgrade


$ sudo raspi-config


# Add locale en.us-utf8 (but keep en.gb-utf8)


$ sudo dpkg-reconfigure locales


# Timezone


$ sudo dpkg-reconfigure tzdata


# Update firmware


$ sudo rpi-update


# Access remotely using 'raspberrypi.local'


$ sudo apt-get install avahi-daemon


# Create new user, enable sudo and video privileges


$ sudo adduser username


$ sudo adduser username sudo


$ sudo adduser username video


# Increase font size on tv console [utf-8, guess optimal, Terminus, 16x32]


$ sudo dpkg-reconfigure console-setup


# Echo command to tv console (as root)


> /usr/games/nethack >> /dev/tty1


 


## /etc/rc.local


# Turn off screen blanking


/usr/bin/setterm -blank 0 -powerdown off


 


## ~/.bash_aliases


# Blank screen before playing. I never remember the r-pi media player name.


alias omxplayer='omxplayer --refresh'


alias mplayer='omxplayer'


# Echo ssh console to tv console


alias mirror-console="sudo script --flush --command 'sudo -u $USER bash' /dev/tty1"


 


## /etc/usbmount/usbmount.conf


# Mount a VFAT formatted USB drive as username for read/write permissions.


FS_MOUNTOPTIONS="-fstype=vfat,uid=username,gid=username"


 


## Some helpful commands


tvservice #list hdmi info


vcgencmd #info about the rpi board. 'vcgencmd commands' for list of commands


vcgencmd measure_temp #=> temp=42.2'C


 


## SopCast


# Run streaming server on local box. xxxx = channel


(local)$ sp-sc-auth sop://broker.sopcast.com:3912/xxxx 3908 8900


# Connect to server, display on r-pi. omxplayer must support codec (h264)


(pi)$ omxplayer -r http://192.168.2.4:8900/tv.asf

Raspberry pi initial setup part 9

Now the moment you’ve all been waiting for. Your pi is imaged, plugged in, turned on, connected to the network, you’ve found its IPv4 address, logged into it via ssh and you’ve run “sudo raspi-config”, so lets get it configured.
First thing to remember is that this is a text interface so no mouse. You move between the different items with the arrow keys and select them by hitting enter. If you need to select a check box on one of the later screens, you hit space, and when you’re done, you move between the list of actions and the buttons at the bottom by pressing the “tab” key.
raspi-configraspi-config (Click to enlarge) The first thing to do is check that we have the latest version of raspi-config (if your pi doesn’t currently have anyway of connecting to the internet, you can skip this). I’m not sure why they decided to put this as the last option, but there you go. This might take the pi a minute. Once it has either found that you already have the latest version of raspi-config or updated it to the latest version, we can continue. We’ll deal with the rest of the options in order.

Info

You can skip the info entry or read it as you wish. Disappointingly, the current version doesn’t have a lot of actual information in there, but if you’re using a later version, then me it might have.

Expand rootfs

This is the first interesting option. If you’ve been following all the way through this series of posts, you’ll know what a filesystem is and understand that the pi has two to begin with (one which holds the operating system and one which holds basic low level configuration details for the pi). The root filesystem is the one the root folder is on i.e “/”. This is the folder that contains all the other folders that the operating system uses. Other filesystems are mounted onto the root filesystem to be used.
Right, as to why it might need expanding. If you remember we installed a disk image, which is a byte for byte copy of another disk. Now what happens if your image is smaller than the disk you are copying it onto? Well the extra space is just left empty. So this option will take the root filesystem and grow it till it fills any extra empty space on your disk. Do you want it to do this? Almost certainly yes. The other option is that you format this unused space to create a new partition with its own filesystem on it and mount it onto the root filesystem, but I struggle to think up a good reason why anyone would (though there is undoubtedly some unusual use case where this is good idea). So go ahead, select it and hit enter. Some text will flash by, and it’ll tell you that the filesystem will be expanded on the next boot.

Overscan

Overscan is a way of making sure the picture fills all of the screen when using an old TV as a monitor. This won’t affect anything when connecting to the pi over the network, as we are now, but if it is likely that at some point in the future the pi will be attached to an old TV using the composite out, turn it on (you will also need to tweak the actual amount of overscan needed for your TV); if it is more likely to connected to a modern LCD TV turn it off; if you’re not likely to do either, just skip over it.

Configure Keyboard

This won’t do anything at the moment, as we don’t have a keyboard physically connected to the pi. So you can just skip it. In case you wondered, different keyboards have different layouts and keys on them (most commonly this is to incorporate letters and symbols that aren’t commonly used in other languages). The default for the pi is the standard British keyboard. If, at a later date, you do want to plug in a keyboard, if it isn’t a stand British keyboard, you will have to configure it (there are various ways of doing so, but just firing up raspi-config again is pretty reasonable way of doing it).

Change Password

This is probably the most important option! All Raspberry Pies have the same default password so you really need to change this, else everyone and their dog will be able to log on to it. Make sure you can remember it though, else you’ll have to wipe the disk and start again!

Change Locale

The locale is a specific combination of language and regional differences. For example, though the UK and the US share the same language, English, there are many regional differences e.g. in the UK the first of February is referred to as 01/02/13 but in America it is referred to as 02/01/13. The locale setting is how the pi works out how to translate its output for you.
The pi uses the standard POSIX locale codes, which start with the language and then the region e.g. for British English it is en_GB (English, Great Britain) and for American English it is en_US (English, United States). The default for the pi is en_GB. If this isn’t for you, choose your locale from the list (you want the UTF8 version). If you are multilingual, you can have multiple locales installed and switch between them; if you aren’t multilingual, then deselect any you don’t need. Changing the locale settings may take a short while.

Change Time Zone

This pretty much self explanatory. The pi defaults to London for the time zone (GMT 0) if you live somewhere else, set the time zone appropriately.

Memory Split

The pi has one chunk of memory which it shares between the main processor and the graphics processor. If you don’t intend to attach a monitor anytime soon, you aren’t really going to be using the graphics processor, so you can give your pi a nice little speed up by giving as much of the memory as possible to the main processor, so set it to 16. If you do intend to use a monitor soon, then you can set the split up now or just re run raspi-config later. For a general purpose desktop, setting it at 128 is probably a good start (if you have an older pi that only has 256MB of memory, you might want to set the graphics chip to only have 64MB and sacrifice the ability to play hi-res video files).

Overclock

Overclocking is the process of running a computer faster than it is specified. Due to variances in the manufacturing process, it isn’t possible to tell how much your processor can be overclocked (if at all) before the system becomes unstable, so if you do want to try, the best thing to do is to gradually increase the amount of overclocking. Overclocking will increase the amount of heat generated by the processor, and so will reduce its working life. If it is worth overclocking, largely depends on what you want to use the pi for. For most people, overclocking a modest amount is perfectly safe, but if you don’t need that extra processing power, then there isn’t any point in risking damaging the pi. If you want to really crank up the overclocking, you will probably need to invest in some sort of cooling for the processor.

ssh

You are almost certainly going to want to leave this at its default of enabled!

Boot Behaviour

As we are using the pi without a monitor, you defiantly want to leave this at its default of not starting the graphical login when it is turned on. Starting up the graphics system will take up a lot of unnecessary resources.
And that is it, we’re done. Press tab, move over to the finish button and press enter.
You now need to restart your pi so that the root file system can be expanded and that any change to memory split can take effect. To do that type:
sudo shutdown -r now The computer will then restart and you’ll be disconnected from it. Give it a minute to expand the filesystem, and then reconnect to it again with ssh. It will almost certainly have the same ip address as before, but if your network is really busy with computers connecting and disconnecting all the time there is a (really) small chance some else will have taken that ip address and you’ll have to search for the pi’s new one as you did before.
Anyway, once you are at the log in prompt, enter your ***new*** password and tadaa! You’ve successfully completed the basic setup of your raspberry pi without the need for plugging in a keyboard or monitor! Give yourself a pat on the back.
Now it needs to be configured for what ever task you have in mind for it. Check out my up coming posts on how to configure to be a file server, media centre and much more! Hope you’ve had fun and learned a thing or two!

Reboot Raspberry pi

There are three methods to reboot Raspberry pi

Terminal method 1

Type in Terminal
sudo reboot

Terminal method 2

sudo shutdown -r now

Third method

See in the bottom right corner for reboot option

Increase font size alternate method

Increase the font size used on the Terminal Monitor

  • sudo nano /etc/default/console-setup
FONTFACE=”Terminus”
FONTSIZE=”32×16″

#Rotate the screen in Mame4All for games like pacman and frogger so it uses the entire screen

  • sudo nano /home/pi/emulators/mame4all-pi/mame.cfg
ror=yes

Increase font size in RPi

RPi Command line font size

Jump to: navigation, search

Note this will also work for Raspbian installations however you will need to enter the password when you use a sudo command and the console-config allready has some values in unlike wheezy which has “” for FONTFACE and FONTSIZE.

TL;DR

sudo dpkg-reconfigure console-setup

Follow the steps, select “Let the system select a suitable font” and select the Font size you want:

sudo reboot

Full article:

When you first kick off wheezy using an HDMI TV as a monitor the default font size is very small unless you have a very big TV.
At this time the default startup kicks into the raspi-config script and some of you may have read the wiki page that covers raspi-config
There will however be a large number of noob persuasion that have not.
The second option in the raspi-config menu script is overscan and you need this enabled if you want to make best use of a default font change for the command line.
log in to your pi and enter

sudo raspi-config

this will re-run the configuration script and you can go to the overscan option and change the setting to enable.
Note you can do only that line you do not need to do all of the menu again.
Use the down arrow to select the finish line hit enter twice and reboot your pie with what used to be known as the three finger spread [Ctrl][Alt][Del]
After the reboot the plan is to change the default settings for the command line screen font
So login:

sudo bash

This is just one of the ways to make you the super user root.

cd /etc/default

This line changes your current directory and if you want the detail it braks down as this

cd change directory command
/ start at the root
etc follow the path to the etc directory
/default from there to the directory called default (this can be confusing there is a sub directory of /etc called default)
pwd

this is the command that shows you the current working directory it should show you
/etc/default

ls

This is a handy little command it will show you the content of the current working directory this can more than fill the screen but /etc/default is not overly stuffed with files.
one of those is console-setup and we now want to edit this file there are a number of text editors within linux my personal favourite is nano there are others pico and vi to name two but we will use nano for this description.

nano console-setup

Just about everything within linux is set up using a text file and this is no exception note if you get a blank screen you made a typo and should exit with the key combination [Ctrl][x] shown at the bottom of the editor screen as ^x
Use your arrow keys to get to the line FONTFACE=””
type Terminus between the speech marks there are other font faces but this is the example we are using.
drop one line to the line that reads FONTSIZE=”” and type 12×32 between the quotes marks if you are using a composite connection this font may be too big and a setting of 16×8 may be better there are a range of settings experiment to find the one that suits your monitor setup best.
Do not Erase the speech marks

[Ctrl][x]

If you have not changed anything you will drop back to the command prompt but if you have made the changes the instruction line at the bottom will tell yo you need to type y to save the changes n will discard those changes
If you type n you will also be dropped back to the command prompt. y will allow you to either use the current file name or give it a new one just type [Enter] and save using the current file name
at the command prompt it’s the three finger spread again

Do’s and Donts while using Raspberry pi

Raspberry pi is a popular platform for students in engineering colleges to work around this beautiful toy cum computer

Did just say toy ?
Yes it can be made to a full fledged computer.
I am Ankit Shah a robotics enthuiast and a student of National Institute of Technology Karnataka and I am here to help you in getting started with raspberry pi

Blog at WordPress.com.

Up ↑