raspberry pi webradio with mpd and mpc via linux shell and droid for android

12370184313_d14bed8fb4_o

Even when the audio quality from the raspberry pi on board audio card is maybe not that excellent it is still much better than the bad signal I get so far away from my favorite station in town radio dreyeckland. I did make me a fully functional Web Radio from a raspberry pi. Here are some useful steps to get into it…i love it…

You should first check if your on board sound card from the pi is working well:

aplay /usr/share/sounds/alsa/Front_Center.wav sudo nano /etc/mpd.conf

If it is not playing a sound you can visit this Troubleshooting page to get solved the problem.

Having sound you can start installing mpd which is a music player daemon. To connect to the daemon you need a client. There are really a lot of available clients for any computer system or mobile phone. I started with the shell client mpc.

sudo aptitude update
sudo aptitude install mpd mpc alsa-utils

Lets configure something.

sudo vim /etc/mpd.conf

I removed everything in the file and simply entered the configuration from elecc. Maybe make a backup from the original file.

music_directory "/var/lib/mpd/music"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
pid_file "/var/run/mpd/pid"
sticker_file "/var/lib/mpd/sticker.sql"
user "mpd"
input {
 plugin "curl"
}
audio_output {
 type "alsa"
 name "onboard"
}
mixer_type "software"
audio_buffer_size "4096"
filesystem_charset "UTF-8"
id3v1_encoding "UTF-8"

restart…

sudo service mpd restart

and create a playlist where your radio streams will be inside

sudo vim /var/lib/mpd/playlists/playlist.pls

like this

[playlist]
NumberOfEntries=4
File1=http://www.rdl.de:8000/rdl
Title1=rdl
File2=http://swr.ic.llnwd.net/stream/swr_mp3_m_swr3a
Title2=SWR3
File3=http://ndrstream.ic.llnwd.net/stream/ndrstream_n-joy_hi_mp3
Title3=N-Joy
File4=http://radigo01.nci.de:8000/high_q
Title4=Radio Gong

Be careful not to insert urls with .mp3 or .pls ending. Simply download those files open them in a editor and take out the real link to the stream.

Look if mpc is working

mpc

well. If yes something like this should appear.

volume:100% repeat: off random: off single: off consume: off

To load your radio playlist make the following

mpc load sender.pls
mpc play 1

The Number links to the radio station you have defined in the playlist.pls file before.

To stop the play

mpc stop

And some realy important especially if you playing around with adding new radio station is to clear your playlist before loading a new one. If you do not the mpc client will overloaded again and again with same playlist.

mpc clear

The cool stuff now is even that you can connect to your mpd daemon via your android smart phone. I installed Droid MPD Client from the Play store and simply configured the server address to my pi IP. To get out your IP from the PI you can type

ifconfig

Well that’s all and now I am looking forward going more into hardware details creating me a fully web radio like plingbloot did it.

Raspberry Pi as dhcp-server on eth0 via wlan0

12019760875_23bdd7fe2c_c
I have a small hackerspace in my cellar where I have a lot of old pc’s which I use for testing and programming. Cause my Router ist upstairs and I don’t wanna make a hole in the wall I created me a dhcp server out of a raspberry pi which is connected trough wlan to my Internet. I found a well descriped method in german here from gehaxelt.

 

 Network Interfaces

There we must configure 2 devices:

  1. Wlan0 (trough Wlan USB Stick) which is connected to the Internet and gets the IP from the DHCP Router
  2. Eth0 (onboard Lan from the Pi) which is getting the IP static

12019760875_23bdd7fe2c_c

Eth0 is taking the IP 192.168.3.1 but you can choose any other IP Configuration. You should check before if this IP ist used in your local Net. You must edit your “Interfaces”:

sudo vim /etc/network/interfaces
#Loopback
auto lo
iface lo inet loopback

#wlan0 connected to internet
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid "yournameofwlanSSID"
wpa-psk "yourpassword"

#eth0 onboard lan
auto eth0
iface eth0 inet static
address 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
gateway 192.168.3.1

After updating the interfaces file I did have to add the IP to eth0 trough the shell:

ifconfig eth0 192.168.3.1

So I could make a restart of networking:

sudo /etc/init.d/networking restart

A normal restart did bring me later the dhcp server not to run.

 

 Configure DHCP Server

sudo apt-get install isc-dhcp-server

For your DNS Server which administers all the IPs to the names I recommend you to first use the google Namesserver. You can keep it but you can also change later. You normally should find trough your configuration page from your router.

A testping to the DNS should definitly work well:

ping 8.8.8.8

After installation of the dhcp-server you must configure the dhcp configuration:

sudo vim /etc/dhcpd/dhcp.conf

I think the fastest is to uncommit everything and put this code here on the end:

authoritative;
subnet 192.168.3.0 netmask 255.255.255.0 {
  range 192.168.3.10 192.168.3.250;
  option broadcast-address 192.168.3.255;
  option routers  192.168.3.1;
  option domain-name "local";
  option domain-name-servers 8.8.8.8, 8.8.4.4;
  default-lease-time 600;
  max-lease-time 7200;
}

Make a restart:

sudo /etc/init.d/isc-dhcp-server restart

Hopefully it starts without any problems. If yes you can look for the logfile:

tail -f /var/log/syslog

When everything went well to this point you should be now able to connect any computer with LAN cable to the raspberry pi and it will generate a IP for the computer. What is still missing is the routing from the Internet to your eth0.

 

Portforwarding

You should perform the following actions:

sudo echo 1 > /proc/sys/net/ipv4/ip_forward

Open the file:

sudo vim /etc/sysctl.con

and remove the # from

net.ipv4.ip_forward=1

and finally add a roule to the iptables as following:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Now it should be possible to get a internet connection trough the LAN cable on the raspberry pi.

Fix it for reboot

mkdir /home/pi/router
cd /home/pi/router
sudo iptables-save > ./iptables.tbl

shell script

sudo nano /etc/network/if-pre-up.d/iptables

with

#!/bin/sh

#Iptables 
iptables-restore < /home/pi/router/iptables.tbl
exit 0

and change the rights

sudo chown root:root /etc/network/if-pre-up.d/iptables
sudo chmod +x /etc/network/if-pre-up.d/iptables
sudo chmod 755 /etc/network/if-pre-up.d/iptables

Thats it. Have fun. Next time I will gonna try to make a onion pi.

how to repair crashed/damaged usb sticks and find new usage for them

11773449026_387d51dcd4_c

I think everybody can tell the same story: “Oh no I cant access anymore my data on the usb stick.”

Or sometimes you feel like a Yogi trying to get the usb stick contacted well with your feed or knee during you wanna access some data.

Well, I did collect three usb stick which did have strange behaviour. So I opend them and on stick I could realy see that there are the main contacts to the usb plug seems to be broken. On the other sticks I could not real see broken contacts. I have soldered all contacts on all three sticks and voilá it brings me access back to 1 1GB and 2 8GB Sticks. I was realy happy not even of finding realy missed data where I was looking since years for that. It was also cool to see that the sticks are working well after this simple soldering. It did take me just some minutes to fix that problem.

11772778253_4d2b50c200_c

Now after I have opend the sticks I was asking myself what new use I could give them. I found in my garage some polyester resin which is normaly used for fixing metall damages on your car. I found out that this did work realy well for inserting your usb stick into some hole or plastical behaviour. And of course I did not only create me a new mp3 music usb stick for my car. I did even add the lightning gadget. So you never now when you are inna outback and need a mp3 usb stick and wanna try to make a fire…

11772595965_615f48049f_c

Raspberry Pi easy to built paper case aka punnet

11609077795_b5bbde3e9b_c

Are you also sometimes addicted to all those cool gadgets you can buy for your electronical boards? You can buy a raspberr pi for cheap, sure! But taking all those gadgets on the end makes the pi most of the time not cheap anymore. So looking for a fast and usefull diy case for the pi did bring me to the Punnet case – A home printable cardboard case for your Raspberry Pi. You can simply download the pdf print, fold, glue and ready is your case.

Update: Of course you can find paper cases for arduino too! Its called arbo. Dand did you know that there is a project called paperduino? They use a card board instead of a pcb. It realy looks simple. Even the wiring on the back is not getting you in trouble.

Getting back control trough your Samsung Galaxy Ace GT S5830 with superuser & link2SD

11588519344_7f17b5985b_c

Using a 2GB micro SD Card and having only 180 MB internal storage let you get in trouble after some time for sure. There are a lot of detailed tutorials about solving this problem with link2SD. I wanna give you a real short summary for the steps I did.

1. Make a backup
2. become root
2a. take the udp_1.zip file
2b. power off mobile
2c. power on and additional press the home button as long you where asked for
2d. apply update from sd card
2e. yes
2f. reboot
3. check if you are root with the root checker app
4. format the new micro SD into 2 seperate primary partitions of FAT32 where the ending partition can be 512 – 2048MB big, I used gparted in linux
5. insert new micro SD card in mobile
6. install link2SD
7. start it and use FAT32 when asked
8. reboot
9. use link2SD to move apps from your internal storage

moreless thats it.

after doing this my mobile can now breath again. the possibilities of link2SD are real big. be carefull, its now possible to crash your system

8Rad by Nico Jungel crazy shit

SAMSUNG

I have just seen this on the werkstatt-lastenrad.de wiki page. And I must say WOW what crazy shit. That is definitly a real new view into transportation issues. I just see a aluminium box at the back like a normal transport car. Supported by 4 engines in the backside, imagine 4x750Watt of brushless power…put the drivers in a futuristic rounded plastic housing and it would get hype and even some people would not recommend that this is a bike anymore. Nico thats a real crazy idea and I definitly like it ;-) Sounds like the start of just another great crowdfunding campaign. It would be definitly interesting to develop such a prototyp to see what is possible with that.

11425561926_cb9377a5dd_c

start

DIY handy steady cam Samsung Galaxy S4

11407366405_8d56f05565_c

Very fast and short hack. Simple but usefull to get your smartphone into a controlled mobile action cam. The aluminium bars can be folded. I think the steady cam needs to become more smaler and the design should get more usefull for folding the steady cam in pocket size. In the moment it fulfilled the need. There are several youtube videos online which describe the building of the steady cam in similar way. Total coasts have been around 10 EUR.

Tweet Blender Test Behaviour

I just played around and I am faszinated from that tool and the possibilities you can have using the Twitter hashtag results…Definitly I have to play around much more with it. I am wondering if there is even a php-tool for creating just a hashtag homepage excluding and combinig severeal hashtags to get out a certain contant for your homepage. For example creating such queries and generating out of that statistical data would be realy interesting: (#Freiburg OR #Lörrach OR #Basel) AND (#Event OR #Party OR #Underground) NAND (#Classic OR #Boring OR #Yuppis) -> results are counted seriously somehow -> the more the people talk about it it appears at the top of the list. Is there any API or moreless written code available to start programming? Could not find yet anything.