You are here

Risharde's Blog

Raspberry PI - Raspbian Static IP Address

auto lo

iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.50

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

END OF FILE
COMMENTS: Typically, most router are set by default to 192.168.1.1 so if 192.168.1.50, try 192.168.1.1

Autologin and run console application in Raspberry Pi

Try this first: sudo nano /etc/inittab

1:2345:respawn:/sbin/getty --autologin {USERNAME} --noclear 38400 tty1

Found this at: http://www.opentechguides.com/how-to/article/raspberry-pi/5/raspberry-pi...

Step 1: Open a terminal session and edit inittab file.

sudo nano /etc/inittab

Step 2: Disable the getty program.
Navigate to the following line in inittab
1:2345:respawn:/sbin/getty 115200 tty1

And add a # at the beginning of the line to comment it out
#1:2345:respawn:/sbin/getty 115200 tty1

Step 3: Add login program to inittab.
Add the following line just below the commented line1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
This will run the login program with pi user and without any authentication

Step 4: Save and Exit.
Press Ctrl+X to exit nano editor followed by Y to save the file and then press Enter to confirm the filename.

Reboot the pi and it will boot straight on to the shell prompt pi@raspberrypi without prompting you to enter username or password. But this isn't enough; you need your Pi to automatically run some command or a script. which is explained in the next section.

Run a Script after login

How to automatically run a script after login.
Step 1: Open a terminal session and edit the file /etc/profile
sudo nano /etc/profile
Step 2: Add the following line to the end of the file
. /home/pi/your_script_name.sh
replace the script name and path with correct name and path of your start-up script.
Step 3: Save and Exit
Press Ctrl+X to exit nano editor followed by Y to save the file.

When to use Wordpress and why? How Drupal isn't getting there yet...

The majority of websites and designers are using Wordpress to create quite impressive websites out there on the internet as opposed to using Drupal. I asked the typical question - WHY? I decided to have a look at Wordpress again to see if or what makes it the choice for most developers out there - I found out that Wordpress has reached 4.x status and a lot has changed since the time when I decided to give up on Wordpress for my more custom / specialized needs.

Interesting enough, one of the reasons developers still use Wordpress is because churning out a simple site is so much easier to do with Wordpress. It just has all the basic bells and whistles with a simple admin control panel that allows you to do what you want to do - GET YOUR INFORMATION ON THE INTERNET! There is hardly any much of a learning curve because the basics are quite straight forward. 

So how is this different from Drupal? Well Drupal's strength is its modules which interact with other modules, reducing the time to develop but there's a problem. The Administration control panel isn't simple and its quite "ugly" so to speak in the sense that its default is stricly text based and not well organized. The learning curve is therefore medium to high. I still love Drupal for custom content creation and views but if you aren't going to do much complexity features, it might be best to stick with Wordpress.

Wordpress feels much more lightweight when it comes to loading times and Drupal tends to require much more resources. While Drupal has come a long way since my list complaint about performance it isn't quite fast without caching mechanisms which you have to install separately. 

What's a breath of fresh air in Wordpress and something I have complained about with Drupal a few years is having the feature to do simple core upgrades. With Drupal, its still quite difficult to do a core upgrade but it seems Wordpress has moved a notch forward and can now do core upgrades right from the interfaces. What's even more convenient is that Wordpress allows you to find plugins right from in the interface, something that Drupal current lacks and sadly makes it a little longer to install plugins.

Drupal with the right backend modifications can stay within the market as a good development choice but only when the developers see the need to ensure that simplicity should be designed in and have an option to add complexity and not the way around.

Deluged crashing and Libtorrent on the Raspberry Pi - Solution

Okay so I've been really working my new Raspberry Pi Model B and I encountered a problem with deluged (a torrent client) which apparently uses libtorrent. Now according to my research, there is a known problem with deluged and libtorrent 0.15 which really makes me wonder the sanity of the raspbian developer community. Shouldn't they be bundling the libtorrent 0.16 version instead to maintain stability? Anyways, I read that you can compile your own libtorrent 0.16 so I decided that I'd do just that - WHAT A TASK - You'll need to install a lot of dependencies to get this to work properly!

Here goes:
First thing we need to do is make sure the dependencies are installed

sudo apt-get install libssl-dev
sudo apt-get install libboost-dev
sudo apt-get install libboost-system1.50-dev

#Then we need to download the libtorrent-rasterbar-0.16.5 source code. This takes FOREVER to compile, about 5 hours on PI! Man does the raspberry pi need a faster CPU!

wget http://libtorrent.googlecode.com/files/libtorrent-rasterbar-0.16.5.tar.gz
tar xvzf libtorrent-rasterbar-0.16.5.tar.gz
cd libtorrent-rasterbar-0.16.5
./configure --enable-python-binding
make
checkinstall
sudo make install

ldconfig -v | grep libtorrent

python -c "import libtorrent as lt; print lt.version"

Text To Speech (TTS) / Speech Synthesis with the Raspberry PI Model B

First, set up your webcam or usb microphone to get commands

Plug in your USB microphone. Let’s open up an ALSA configuration file in vim:

sudo nano /etc/modprobe.d/alsa-base.conf

Change the following line:

options snd-usb-audio index=-2

To this:

options snd-usb-audio index=0

Install SoX which is used for playback and not Text to Speech (very useful tool to playback wave files)

sudo apt-get install sox

Also, if you have already set up a microphone as main device, you need to set playback device for Sox to output to the raspberry audio jack:

export AUDIODEV=hw:1,0

THIS IS WHERE TEXT TO SPEACH COMES IN: THAT IS, TEXT CONVERTED INTO AUDIO FOR PLAYBACK

#Install Festival

sudo apt-get install festival

echo “Hello World” | festival --tts

hostname -I | festival --tts

# or install espeak

sudo apt-get install espeak

espeak -ven+f3 -k5 -s150 "Hello World"

# or Google Android TTS - PICO

sudo apt-get install libttspico-utils

pico2wave -w helloworld.wav "Hello World" && aplay helloworld.wav

Debian - Formatting a partition to EXT4

sudo mkfs.ext4 /dev/sda1 -L partitionname

Notes: You can get partition information by running: blkids

make sure to replace partitionname with the drive label you want

Debian / Raspbian High CPU NTFS

Okay, so this is a major limitation I've encountered with the Raspberry PI. Using a USB hdd with an NTFS partition is going to see a lot of high CPU usage. It seems to be the mount drivers. The only thing I've found to alleviate this completely is to make an EXT4 partition on the USB drive and WOW DID IT MAKE A DIFFERENCE!

Rapsberry PI and PocketSphinx error fix

http://robot.laylamah.com/?p=35

Lalymah seems to solve the issue of not getting audio into pocketsphinx: Error opening audio device plughw:1,0 for capture: Connection refused

Mixer load failed: Invalid argument FATAL_ERROR: "continuous.c", line 246: Failed to open audio device

To fix on the Raspberry PI, do the following: sudo apt-get remove pulseaudio -y sudo aptitude purge pulseaudio -y sudo mv /usr/include/pulse/pulseaudio.h /usr/include/pulse/pulseaudio.h.old

Recompile sphinxbase and pocketsphinx and you should be good to go

You could also try reading this one: http://www.rmnd.net/speech-recognition-on-raspberry-pi-with-sphinx-racke...

Microphone USB for Raspberry PI

Plug in your USB microphone.

Let’s open up an ALSA configuration file in vim: sudo vim /etc/modprobe.d/alsa-base.conf

Change the following line: options snd-usb-audio index=-2

To this: options snd-usb-audio index=0

Back in the shell, run: sudo alsa force-reload

Management in Trinidad and Tobago

Perhaps I have been "unlucky" but two organizations have greatly disappointed me during my working periods with them. They suffered the same disease which seems to be unfortunately plaguing some organizations and companies in Trinidad and Tobago. Indeed, it is a shame when managers and / or upper management use archaic methods such as cursing and embarrassment to get their way. I always believed that education removes ignorance but it seems that some human beings become more illiterate with education. It is quite ironic that those who behave this way are higher paid that their fellowmen. This is an injustice that I cannot come to terms with.

Please excuse me for not conforming to being "normal"

Pages