Say IP address of Raspberry-Pi at startup

This application is tested in Raspbian OS and Rapberry Pi 2 board. I am using my Pi as a root user to avoid sudo use.

First step is to install text to voice software so that we and listen the text we type in Speaker/ Headphone.. For that espeak module should be installed which is well suited for this purpose.

1    sudo apt-get install espeak

After the installation check it by entering the command in the prompt:

1    espeak Hello

Do not worry if the volume is Low or noise or the screen showing some error message. If it say hello then you can proceed for the next step.

Now we need to read the IP address assigned to Raspberry Pi and read that out using espaek.

Create a file named sayIP and keep in /etc/init.d/sayIP make the file executable

#! /bin/sh -e
 #Craeted by Nanda on 26-Jan-2016 
 echo "Starting script sayIP " 
 private=`hostname -I` 
echo $string | espeak -p 80 -s 100 # -p is pitch def 50 -s is words/sec def 160 
 ;; stop) 
 exit 0 

The next step is open the shell and type in

cd /etc/init.d/./sayIP

If you can able to hear that out then this step is successful. The next step is to automate when you start the Raspberry Pi. Navigate to following path and copy the sayIP file under the path in executable mode.

cd /etc/network/if-up.d/ sayIP

Now go to /etc/network/interface file and add a line post-up /etc/network/if-up.d/sayIP

auto lo
iface lo inet loopback
iface eth0 inet dhcp
#iface eth0 inet static
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
post-up /etc/network/if-up.d/sayIP

Now restart raspberry pi and you should able to hear the IP address

Enjoy the audio from gentleman . Still looking for a lady voice from eSpeak J


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s