Icecast2 and the Raspberry Pi

Icecast2 is a free audio streaming server which supporting the shoutcast protocol. MPD is a music player daemon which serves as a backend for playing audio. MPD uses the shoutcast library to stream to icecast2. Fortunately, Raspbian MPD is compiled with libshout and also mp3 support by default so we don’t have to build any custom packages. MPC is a command line client to control MPD, for example to manage playlists or to start/stop playing a song.

This website provides a good explanation on how to add Icecast2 to the Raspberry Pi

http://www.t3node.com/blog/streaming-audio-with-mpd-and-icecast2-on-raspberry-pi/

MPC and MPD will have to be installed first along with ensuring audio is set up correctly.

Advertisements

Siemens TC35 Mobile Phone and Arduino Project Part 2

The easiest way to try out the TC35 is to connect it via a Serial to USB connector lead. These leads can be obtained from eBay for about £1.50 in August 2014.

A power supply is needed, I used a 5 volt 1.0 amp supply and although a 2 amp supply is recommended this only seems to be needed when transmitting voice. You will need a terminal program like RealTerm or Putty, both are free to download, but I prefer RealTerm.

You need to determine the Com port being used, so plug the USB to Serial lead into the PC and open up the Windows Control Panel. Click on the System / Hardware / Device Manager Tab and look for the Ports, (Com and LPT) make a note of the port used by the USB to Serial lead. Mine showed USB – SERIAL CH340 (Com7). Later versions of Windows , from Windows 7, should find the driver automatically. Earlier versions will need a driver which you can normally find on the Internet, I just searched for ‘driver for CH340’.

Now open up the terminal program, enter the port and speed details (9600 for the TC35). Make sure a SIM card has been inserted and connect the Serial to USB connector. Apply power to the TC35, the top left LED will light. Press the button and the top right LED should light up, flashing ON for 600 ms then OFF for 600 ms. This shows the unit is activated, but not connected to a Network. If the flash rate changes to a brief flash, followed by a long pause it shows the unit has connected to a Network. My unit has never connected automatically and I always manually connect it.

In your terminal program type AT followed by ENTER, the unit should respond with OK if not check the connections and that the correct port and speed have been entered. Type AT+COPS=? And the available networks will be listed. The five digit code is made up of 234 for the UK and 33 for Orange, 15 for Vodaphone and 10 for O2. To manually connect to your service type:
AT+COPS=1,2,23433 for Orange, or AT+COPS=1,2,23415 for Vodaphone. Note you can only connect to the network supported by your SIM, although an EE card will connect to Orange, One2One and TMobile.

To confirm you are connected the LED will flash briefly with a long pause. Type AT+CREG? And the response should be 0,5 to show the network was connected manually.

Once you have confirmed that the unit is working correctly you can move on to controlling it with an Arduino.

How to give the Raspberry Pi a Static IP Address

I use my Raspberry Pi in a header less mode over WiFi, but every time I turned it on I found that a different IP address had been assigned. This made life a little difficult, so I searched the internet for an answer.

I found many suggestions , and eventually found a method that worked for me. First run the WiFi Config from the desktop and get the wireless working. Restart the Pi with
sudo nano shutdown -r now

Watch on the monitor screen and when the request for password comes up just look above this and the current IP address is shown mine was 192.168.1.9 this will depend on how many other devices are connected to the router. Start the desktop up and confirm that an entry for your network has been created

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

There should be an entry showing your network details, for example

ssid= “your SSID” etc

Now you need your gateway address, this can sometimes be found printed on your router or you can enter

sudo route -nee

Make a note of the gateway address. Now you need an unused IP address, try to keep this well clear of addresses assigned by your router. Try 192.168.1.255 and check this is not used by

ping “192.168.1.255” -b

Stop at any time with Ctrl C.

If it does not say Destination Host Unreachable then try 192.168.1.254 etc until you find a free address. Now you need to edit the interfaces file

sudo nano /etc/network/interfaces.  Find the line after allow -hot plug wlan0 that reads

iface default inet dhcp

And change this to

iface default inet static

And add the following lines

address 192.168.1.255 # use your address here
netmask 255.255.255.0
gateway 192.168.1.1. # use your address here

Save the file and exit nano.

Reboot your Pi with sudo shutdown – r and check your new IP address has been used with

sudo ifconfig

And check the block wlan0

Siemens TC35 Mobile Phone and Arduino Project Part 1.

choosing a SIM card
Not all SIM cards work equally in the TC35 and my results (August 2014) are as follows:

O2 and those networks using O2 such as GifGaf and Tesco do not work, in fact the O2 card shut the TC35 down as soon as I tried to access it.

Vodaphone Looked like it might work but could not be activated until credit is added. As I was unwilling to add £10 just to try it out I abandoned this network.

EE, which includes Orange, One 2 One and T Mobile This SIM card arrived ready activated and worked with no problems. The SIM did not need activating and worked in receive mode without adding any credit. It came with a Top Up card and once I had added £5 I was able to send SMS messages from the TC35 in response to messages sent from my phone.

Asda Mobile This is my favourite. Asda now use the EE network and their card comes with a small amount of credit. The card is activated by sending a text message or making a phone call. You have to request a Top Up card and this takes about a week to arrive. In August 2014 the rates were much better than EE! £5 credit gives 2000 text messages over a 30 day period. At the end of this period text messages cost 4p compared to 12p from EE!

None of the network providers web sites was easy to follow if all you wanted was a pay as you go SIM and did not want to attach a debit or credit card to the phone number.

Bluetooth on the Raspberry Pi

I successfully used a tutorial from ThinkPenguin.com to get Bluetooth operational on my Pi.

https://www.thinkpenguin.com/gnu-linux/bluetooth-usb-adapter-setup-raspbian-raspberry-pi

I have a number of bluetooth adaptors and eventually found one that worked. I was able to send a picture from my phone to the Raspberry Pi using bluetooth.