Pages

Wednesday, January 21, 2015

MACHIUKA WIFI RADIO PROJECT pag.5

Part III - THE SOFTWARE - cont

5.Install sound related drivers/applications
Now, as I said, we'll use madplay for playing audio streaming from radio stations, because is less resource consumming than mpd. On my initial stages I've installed mpd & mpc, but I give up. The sound was horrible (because it forced the limits of the router I guess). I spent almost half a day at the time, but of no use. It was easier for me to make a web interface for madplay than to configure mpd to act properly on my router.
For the recording feature, I've installed streamripper application, a very good one.
The commands are:
  • opkg update
  • opkg install kmod-usb-audio
  • opkg install madplay
  • opkg install streamripper
  • opkg install wget
Power off the router, connect the USB sound card to the speakers, power on the router and test madplay.
wget -O - http://205.164.62.15:9010/ | madplay -
Pay attention that is wget -O, not wget -0 (zero)
Now you must be able to hear the sound of music in your speakers.
6.Put in place the custom made applications
To obtain the best results of our WiFi Radio, we need some custom made applications
There are some on the router side and a couple of others one the Arduino side, as follows:
ON THE ROUTER SIDE
Name of the applicationPathDescription
a.The web interface files
play.cgi/www/cgi-bin/nmsradio/the main web interface for controlling our WIFi radio. A short presentation could be seen on youtube
changechannel.sh/www/cgi-bin/nmsradio/changing the radio stations through the command received from play.cgi
alarm.cgi/www/cgi-bin/nmsradio/web interface for setting the alarms
setalarm.sh/www/cgi-bin/nmsradio/setting the alarms according to the parameters received from alarm.cgi
record.sh/www/cgi-bin/nmsradio/stream the content of the current playing radio station on a location on USB disk
b.The Arduino interface files
interfata.sh/www/cgi-bin/nmsradio/It's similar to play.cgi, only it interpret the IR codes received from Arduino
radioIR/etc/init.d/Start at boot the interfata.sh file
ceasArduino.sh/root/scripts/Send to Arduino, via Ethernet, the current time (it runs in crontab every minute)
metals.php/www/php/Send the silver quotation to Arduino. It's called from interfata.sh when a dedicated remote control button is pressed
valuta.php and cursValutar.php/www/php/Send some currency quotation from Romanian National Bank to Arduino. It's called from interfata.sh when dedicated remote control buttons are pressed
c.The common files
radio/etc/config/Store the variables used by applications (ex. current station, current volume, etc.)
posturi/etc/config/Store the radio station list. It could be modified in order to put or delete stations.

Note:All the files with the .cgi or .sh extensions must be executables. In order to do that you must type:chmod +x /pathToFile/filename.ext. Where filename.ext is the name of the file (ex. play.cgi). Also radioIR file must be executable.
If you want to use php files you need to install php to your router:
  • opkg update
  • opkg install php5
  • opkg install curl
  • opkg install php5-mod-curl
  • opkg install php5-fastcgi
  • opkg install php5-mod-json
ON THE ARDUINO SIDE
Name of the applicationDescription
a.Arduino Pro Mini with ENC28J60 Ethernet Module
EthernetReceiveData.inoDisplay on the 4 digits 7 elements LED the 4 numbers received from router
b.Arduino Pro Mini with USB to serial breakout board
IRSendingCodes.inoSend to the router the remote control codes when a button is pressed

Note:
  • Depend on your remote control, the codes may vary. Modify it accordingly.
  • The IP address of my router is 192.168.0.67
  • The IP address of Arduino Pro Mini is 192.168.0.15

For your convenience, you may download all the files from HERE

No comments:

Post a Comment