Posts Tagged ‘Linux’

Sneak peek at my finished Wifi Radio project!

Thursday, May 28th, 2009

While I’m busy working on part ten of my series on building a wireless router-based DIY streaming internet radio, I couldn’t resist sharing a few photos of the finished project.

If you want to see the radio in person, stop by Expo Hall Booth 166 at the Maker Faire in San Mateo, CA this weekend.  I’ll be there to demonstrate the radio and answer questions!

Finished Wifi Radio

Finished Wifi Radio

Finished Wifi Radio

Finished Wifi Radio

Building a Wifi Radio – Part 9, A Few Odds and Ends

Wednesday, May 27th, 2009

This is the ninth part of an ongoing series about building a low cost, open source streaming internet radio based on the ASUS WL-520gU Wireless Router.  If you haven’t already, check out the previous parts (see the links at the end of this article) for some background about the project.

In part eight, we added a tuning control for the radio.  Now we can change to any of ten preset stations on the radio by adjusting the position of a potentiometer connected to our AVR microcontroller.   The LCD display we built in part seven lets us know what stream we’re listening to and the artist and title of the current song.  This project is coming together very nicely!

Before we put the final touches on this project in part ten, there are a few miscellaneous chores to take care of:

Fixing /etc/config/wireless:

Last time, we tweaked /etc/config/network to assign a static IP address to the LAN (ethernet) ports of the router.  This allowed us to directly connect a computer to the router via an ethernet cable and get a shell prompt, regardless of the state of the serial console or the wireless connection of the router.  Unfortunately, I made an omission in the setup instructions which may prevent this from working correctly.

To fix this, modify /etc/config/wireless as follows (changes are in bold, use your wireless network information in place of my example):

config wifi-device  wl0
    option type     broadcom
    option channel  3

    # REMOVE THIS LINE TO ENABLE WIFI:
    # option disabled 1

config wifi-iface
    option device   wl0
    option network  wan
    option mode     sta  # configures the router to connect to your network
    option ssid     MyNetwork # the SSID of your network
    option encryption wep  # the encryption mode of your network
    option key	XXXXXXXXXX  # add this line with your WEP key in place of X...X

The only change is to set “option network” to “wan” instead of “lan”.  This minor change tells the router to separate the wireless interface of the router from the LAN/ethernet interface and allows the router to acquire two separate IP addresses, one for each interface.

Launching mpd automatically at startup:

Manually launching mpd every time the router boots is a drag.  You can automate this by creating a symbolic link to /etc/init.d/mpd from the /etc/rc.d directory, as follows:

root@OpenWrt:~# ln -s /etc/init.d/mpd /etc/rc.d/S93mpd

Now every time the router boots, mpd will be started automatically as part of the boot process.  (That was easy!)

Boot script for the user interface:

Assuming we want a dedicated internet radio that doesn’t require user intervention to operate, the scripts for the LCD display and tuning control should also be launched at startup.  This will ensure that upon applying power, the radio will boot into a state where a stream is playing and the user interface is active.

First, we need to create a simple boot script.  Create the file /etc/init.d/AVR with the following contents:

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
START=99
start() {
sleep 5    # make sure boot process is done, no more console messages
/root/interface.sh
}

To launch the script at boot, create a symbolic link as follows:

root@OpenWrt:~# ln -s /etc/init.d/AVR /etc/rc.d/S99AVR

Every time the router boots, the user interface will automatically start, mpd will start playing the selected stream based on the tuner position, and the AVR microcontroller (assuming it is still connected to the serial port) will update the LCD display and watch the potentiometer for any changes in position.

Tweaking the firewall configuration:

This is actually optional, but it can be pretty useful while hacking on the router.  As presently configured, the router blocks incoming requests on the WAN, which now includes the wireless interface.  This prevents us from using ssh or telnet to log into the router over our wireless network.  While we can still get a shell by connecting an ethernet cable to one of the LAN ports on the router, it is often more convenient to access the router across your wireless network.

The file /etc/config/firewall controls the firewall settings.  We’ll be modifying this file.

Open the file in vi and scroll down to this section:

config zone
    option name        wan
    option input    REJECT
    option output    ACCEPT
    option forward    REJECT
    option masq        1

Edit the “option input” line so that it looks like this:

config zone
    option name        wan
    option input    ACCEPT
    option output    ACCEPT
    option forward    REJECT
    option masq        1

Now restart the firewall (or just reboot the router):

root@OpenWrt:~# /etc/init.d/firewall restart

You should now be able to ssh or telnet into the router over your wireless network.

Enable SSH:

By the way, if you want to access the router with ssh instead of telnet, just set a root password.  The telnet daemon will be disabled (for security reasons) and replaced with an SSH daemon instead.  You can do this with the “passwd” command.

root@OpenWrt:~# passwd
Changing password for root
New password: *****
Retype password: *****
Password for root changed by root
root@OpenWrt:~#

Log out of your telnet session and use ssh to log back in with your favorite ssh client (don’t forget to tell the client to use the username “root”).

Stay tuned!

Wifi Radio Enclosure - Google Sketchup Model

That’s it for now.  Stay tuned for the final part in this series, part ten, in which I’ll talk about what it took to turn this Sketchup model into a real wooden case for the radio!

Update: Part ten (the final part in the series) is now online.

ESC Beagle Board Class Wrapup

Thursday, April 2nd, 2009

This week I attended the Build Your Own Embedded System (BYOES) classes at ESC 2009.

The BYOES classes were primarily focused on the Beagle Board, an ARM Cortex-A8 based single board computer developed by engineers at Texas Instruments.

When I picked up my conference registration on-site, I also received a Beagle Board dev kit which included a 2GB SD card, a Class 1 Bluetooth USB adapter, and a tiny box containing a brand new Rev C2 Beagle Board.  This was pretty exciting, given that the C2 boards haven’t even hit Digikey yet, making me one of a select group to have a C2 board!

Here’s a photo of the kit as provided by ESC.

Rev C2 Beagle Board

The classroom was full of LCD monitors, keyboards, mice, and USB hubs – but no computers.  This is where the Beagle Board comes in.

ESC Beagle Board Class

The first step was to plug the peripherals into the board, as shown below.  The HDMI interface for the LCD is at the upper right of the board, while the SD card and USB host port is on the left.  The bottom of the board has a DC power jack and the USB OTG port which we used later.  The whole board is actually powered via USB – the other end of the cable with the DC plug goes into the USB hub, and the hub powers everything.  Pretty cool.

Rev C2 Beagle Board running Android

The classes were fantastic.  I saw lots of really impressive demos, including some really neat 3D graphics using the onboard OMAP35x SGX 2D/3D graphics accelerator.

I particularly enjoyed the Monday morning class, led by Beagle Board designers Jason Kridner and Gerald Coley.  Jason gave an overview of both the impressive feature list of the board and the large development community behind beagleboard.org.  Gerald talked about the hardware development process, including some of the difficulties with the OMAP3 processor, which uses PoP technology.  The system memory chip is soldered to pads on top of the CPU, which is then soldered to the PCB.  Not surprisingly, this process took some optimization to get right.

Some observations:

  • While the Beagle Board was developed by engineers at Texas Instruments, TI does not officially support the board, which is more of a technology demonstration.  Instead, people using the board can go to the beagleboard.org community for support, where there is a vibrant community of volunteer developers.
  • The philosophy behind the hardware is “Bring your own”.  The board contains a minimum set of peripherals and you attach what you want.  Apparently most eval boards contain a lot of features people never use (cameras, wireless interfaces, etc.) and tend to force desigers into using only the “supported devices”.
  • The hardware is open source.  You can download gerbers, Allegro files, schematics, etc from their site.  (Sadly, no Eagle files, although the 6 layer PCB wouldn’t be supported by the cheap/free versions of the Eagle anyway.)    You can develop products based on the Eagle board and just stick copies of the design into your own PCB, or develop your own design.
  • The Beagle Board is not recommended/supported for use in production hardware.  It’s for evaluation only.  If you develop a product, you’re supposed to handle your own PCB builds, etc.  The good news is, you can call up their contract manufacturer (CircuitCo) directly and get a batch of Beagle Boards made if you want to use the hardware as-is.
  • The communiy is very good about having mutliple avenues for discussion and collaboration.  They are leveraging lots of old and new technologies: IRC, a wiki, a mailing list, delicio.us social bookmarking, RSS, etc etc etc.  All of these are accessible from beagleboard.org.

You can download the class slides and an SD card image at http://beagleboard.org/esc

Lastly, the Beagle Board runs Android.  It also runs Linux distros like Angstrom and MontaVista, among others!

Rev C2 Beagle Board running Android

Looking for Asus WL-520gU Wireless Router Hacks

Thursday, March 12th, 2009

Have you created a project or hack based on the Asus WL-520gU or WL-500gP Wireless Routers?

It doesn’t matter if it was inspired by my project or developed independently – I’d love to hear from you!

I’m putting together a talk for NOTACON and I’d like to feature as many projects as I can to spread the word about how powerful, flexible, and affordable these routers are, especially when coupled with a Linux package (DD-WRT, Tomato, OpenWrt, etc.) and USB devices.

If you’d like to have your project included in the talk, leave a comment or contact me directly.

New Flickr Pool: Asus Wireless Router Hacks

Sunday, March 1st, 2009

New projects utilizing Asus wireless routers as tiny Linux computers are popping up with increasing frequency, so I started a Flickr pool for these creative individuals to post and share their cool hacks.  Have you hacked an Asus wireless router, such as the WL-520gU or the WL-500g Premium V2, into something more?  Take some pics and add them to the pool!

www.flickr.com

items in Asus Wireless Router Hacks More in Asus Wireless Router Hacks pool

Flickr: Asus Wireless Router Hacks


www.flickr.com
mightyohm More of mightyohm