Any suggestions about using an NSLU2 instead?

Discussion about my Wifi Radio project at http://mightyohm.com/wifiradio/ or my WL-520gU talk at NOTACON.
knchris
Posts: 1
Joined: Thu Jun 11, 2009 9:14 am

Any suggestions about using an NSLU2 instead?

Post by knchris »

I've got a couple spare NSLU2s doing nothing and thought I'd try to build an internet radio using one. There's no wifi of course, but OpenWRT works on it and I can add a USB wireless card assuming there are linux drivers for the ones I have. Any gotchas I need to be worried about before I start? I soldered on the serial port header last night but don't have a cable yet.

Thanks
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Any suggestions about using an NSLU2 instead?

Post by mightyohm »

Should be doable, and I'm pretty sure it has been done before.

There's some info here: http://www.nslu2-linux.org/wiki/HowTo/SlugAsAudioPlayer

You won't be able to use the files on this site because the architecture is different, but assuming you are comfortable compiling your own kernel, you should be fine. :D
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Any suggestions about using an NSLU2 instead?

Post by Schwabinger »

Hello,

I started my project using a nslu2 "slug" a view weeks ago.

I installed SlugOS 5.3 beta on a 4 GB stick (excellent description on how to do that in unslung.org: http://www.nslu2-linux.org/wiki/SlugOS/ ... ugOSSystem)
Installed a Delock USB 7.1 sound adapter (12,- Euros)
Made soundcard work (see link "SlugAsAudioPlayer" above).
Installed MPD and MPC (mpc is from an "optware feed". See last step of the os install docu above)
Configured xinetd service "podcast-bounce", so I can add stations in the "m3u" or "pls" syntax. Excelllent solution!
(http://mpd.wikia.com/wiki/Hack:podcast-bounce)

Now my slug plays radio stations like a charm. When playing, it uses between 50% and 90% of the CPU.

root@linksys:~# mpc play 10
BBC World Service English
[playing] #10/15 0:00/0:00 (0%)
volume: 20% repeat: off random: off single: off consume: off
root@linksys:~#



Ordered an arduino starter kit ... now the challanges will start. The last time when I used a soldering iron I was a boy, about 40 years ago ....

Will be continued.

Schwabinger
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Any suggestions about using an NSLU2 instead?

Post by mightyohm »

Is SlugOS based on Debian or another Linux distribution? I wonder if it's anything like the firmware I used to run on my Buffalo Linkstation.

Also, is Linksys still making the NSLU2? If so, that must be one of the longest selling hackable Linux platforms out there, aside from the WRT54G...
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Any suggestions about using an NSLU2 instead?

Post by Schwabinger »

I dont think it is based on Debian, because on http://www.unslung.org you find a seperate distribution "DEBIAN/NSLU2".
SlugOS is described here:
http://www.nslu2-linux.org/wiki/SlugOS/HomePage

The nslu2 isnt produced any more. Ebay-prices are quite high in Germany: a used slug still sells for about € 35,- (ca $50).
One reason might be the excellent documentation that you can find online.

In comparison, a new WL-520gu sells for about €55,-.

Regards,

Schwabinger
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Any suggestions about using an NSLU2 instead?

Post by Schwabinger »

A good friend came over today for a late thanks giving dinner. After some drinks he soldered the tree pins for the serial port to the board.
First it did not start ... but then we pressed the battery in a little harder ... and now it plays music again.

Time for the arduino to come.


Schwabinger
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Any suggestions about using an NSLU2 instead?

Post by Schwabinger »

Hello,

so, Arduino arived today.
I connected it to the serial port on the slug board.
Between Arduino's TXT and Slug's RX I soldered a 10K resistor to take care of the voltage difference.

On Arduino, I installed the following sketch, which sends the pot's position to the serial port:

Code: Select all

void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue, DEC);
}
In the serial console of the Arduino one sees now the pot's reading: a value between 0 and 1023.

On the slug unfortunately I see the following:

root@linksys:~# head -n 1 < /dev/ttyS0
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

I then started the program "minicom" on the slug and switched into "Kermit" mode. There I could see, that Arduino is actually sending readable numbers like 312.

Any ideas how I can get the numerical value in a variable (for tuning the station)?

Schwabinger
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Any suggestions about using an NSLU2 instead?

Post by Schwabinger »

First Success - Tuning works!

With the help from the arduino forum I found out, that this character "ÿ" signals a reset on the arduino side's serial port.
So the slug was sending data that made the arduino board interrupt the communication.

As a first fix I just unpluged the wire that sends data from the slug to the arduino ... and now I can receive the Pot's position on the slug and use it in an interface script.

By turning on the pot's knob, I can choose between about 40 stations. Very cool.

At the moment playing:

====>
Radio Luxembourg
31
====>

Next steps will be to learn how to configure the serial port on the slugs side, so that a two way communication can take place.

The Sluguino wants a display, too ...

Regards

Schwabinger
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Any suggestions about using an NSLU2 instead?

Post by mightyohm »

Do you know why the slug is sending the yyyy?

How do you have the 10K resistor wired? I don't know if this will work reliably, you might need a proper level shifter to get better results. Maybe this is why you are seeing strange characters...
Schwabinger
Posts: 49
Joined: Sat Dec 04, 2010 12:04 am
Location: Munich, Germany

Re: Any suggestions about using an NSLU2 instead?

Post by Schwabinger »

Hi,

I just soldered the 10k resistor in the wire that goes from arduino's TX to slug's RX pin.

A few days ago I found a solution that seems to work stable:

When the slug enters runlevel 3, a script is started that loops until it gets a proper input from /dev/ttyS0.
Then the loop exits and a script myinterface.sh is started:

Code: Select all

#!/bin/sh
# set -x
case "$1" in
  start)

/bin/beep -r 5
inputline=123
     until inputline=$(echo $inputline | grep -e "^tuner: ")
    do
/bin/kill -9 $(pidof SCREEN)
/bin/sleep 20
/usr/bin/screen -d -m -L /usr/bin/minicom
/bin/sleep 15
inputline=$(head -n 1 < /dev/ttyS0)
/bin/beep -r 1
   done
/bin/beep -r 3
/root/myinterface.sh > /root/debug
exit 0
;;
  stop)
echo -n "stopp das Ding"
;;
esac
exit 0
myinterface.sh is more or less the script interface.sh form your solution. I only removed the part where the playlist is created from scratch every time you start the script.

I use "screen" to start minicom in the background. This was the only solution with which I was able to active serial port /dev/ttyS0.

Now I can start and use the radio without any ssh putty connection :-)


Schwabinger
Post Reply