Home

Welcome! Log in or Join us

Forums The Open Grid OpenWrt - Asus WL-520GU

Subscribe to OpenWrt - Asus WL-520GU 19 posts, 5 voices , Tagged: open grid OpenWrt instructions build flash

Reply to topic
 

 
Samotage_300_medium
Jun 28, 2009 12:28am
555 posts

I'm using an OpenWrt as the hardware platform for the residential gateway, i.e. the box that allows the in home devices to chat with the internets and interact with the web application over RESTful web services.

UPDATES!

At the moment we are using the more powerful, and curiously cheaper WL-500GPv2 router.  This has 2x USB2.0 Ports, 32MB RAM and 16MB flash, twice the smaller WL-520GU.  The build is just the same, and there are some more bits to be added to build this out for 3G backhaul in adddiiton to ADSL or other.

So you want to build up one of these cheap little devices that pack a but of punch?  Here is my build procedure, which ends up as a nice little functional box with all the necessities like internets connectivity ssh, ready for the next step, the gateway app.

The hardware I am using is the Asus WL-520GU, a box with 4MB of flash memory, 16MB of Ram and a Broadcom CPU running around 200 Mhz, not bad for $50!   You can read more about this little puppy over at mightyohm, which also has a bunch of links to some great tutes on the setup, most of which are based around parts 3 & 4 of the wifi radio hack.

There is also a great bunch of info in the old OpenWrt wiki on this particular device

One great feature of the Asus box, is that it's "forgiving" so if (when) you brick it (...like I have a few times) it's easily brought back from the dead.

Setup the internal serial port

This requires opening of the device and soldering on a simple 4pin header.  Follow along from here, part 3 of the wifi hack which has pictures and lots of nitty gritty.

A backup

Now you can poke into the gubbins of the box, it's probably wise to know the backup of the Asus standard firmware.  Note, I found the download was nicer, better and sexier than the firmware that came in the box new!  You can get the Asus firmware here.

Getting the Image

Right now, I am building the OpenWrt images using the very neat and well designed cross compilation tools, available here this will download a tarball that if you take some panadol, and follow the instructions here you will end up with an image for your tasty little box.  This way lets you choose which things you want in your firmware image, and allows you to cross compile for other OpenWrt platforms.  Note, you will need a linux machine to take this puppy for a walk.

If you can't be fagged going through all this (and I can sympathise with that) you can just down load the image I made.  This has all the USB stuff and core packages necessary to get into the box and run the setup ready for the next stage - applications. 

This is the current SEGbox build, and has all the necessary pre-requisites to complete a build.

- has the above plus packages and tools required for the Aiko Gateway software written in LUA by @geekscape openwrt-brcm-2.4-squashfs_v0.13.trx

 

 
Samotage_300_medium
Jun 28, 2009 1:01am
555 posts

Flashing the OpenWrt

I was always a little reticent about the re-flashing of these puppies.  As it turns out, the process is simple and straight forward, and once done a couple of times, can even be successfully performed after a few beers.

This guide has some summary points of my procedure, though a more detailed walk through from mightyohm can be found here

To connect to the OpenWrt box, I use minicom, a nice little serial terminal program I use in ubuntu.  Set this up, so you can see what’s going on inside the little box. 

  1. Initiate “rescue” mode achieved by pressing and holding down the black restore button on the back of the box and powering it up.  This should start outputting the following messages as it’s internal tftp server kicks into gear:

    Reading :: TFTP Server.
    Failed.: Timeout occured
    Reading :: TFTP Server.
    Failed.: Timeout occured

    …these messages, like a T-800 acquiring it’s target will continue forever.

  2. Connect your PC’s ethernet connection to the LAN1 port of the OpenWrt box (WAN don’t work, but the other LAN ones may…) with the following hardwired config:

    ip:  192.168.1.185
    mask: 255.255.255.0
    gw: 192.168.1.1

    Make sure to disable any other of your PC’s internet connections or put them on another subnet to the OpenWrt. 

  3. With your PC connected to the little box in rescue mode, it’s time for the tftp client to be fired up on your PC

    Nav to the directory with the image and start the program with the following commands

    tftp
    trace
    timeout 5
    mode binary
    connect 192.168.1.1
    put openwrt-brcm-2.4-squashfs_v09.trx

    If all is good, you will see packet transfer and ack messages until all the bits of each byte of the image is shipped to the little box. If you see nothing, there is a good chance there is some kind of ethernet issue going on.

  4. Over in the OpenWrt corner, there should now be seen a proliferation of re-programming messages.

    Reading :: TFTP Server.
    TFTP_BLKLEN!!
    break!! last block!!
    Done. 1918724 bytes read
    Download of 0×1d4704 bytes completed
    Write kernel and filesystem binary to FLASH (0xbfc20000)
    Programming…
    copysize=1918724, amtcopy=1918724

    Note there will be a little wait while it’s “programming”.  Also, some of the numbers may vary.

  5. Sit back, it’s not like watching lotto numbers, as with this game if all’s well there should be a great chance of success!  Your winning ticket will look like this:

    done. 1918724 bytes written

  6. After this step, wait about a minute or so, then reboot your new OpenWrt box.  If you are lucky and all is good then you should be able to celebrate:

    10 oz Vodka, 10 oz Triple sec, 10 oz lime juice  Salute! Victory!
 
Samotage_300_medium
Jun 28, 2009 1:29am
555 posts

Time for some Internetz

Let’s get our little box up and talking to the internet, a precursor step for the rest of the build.

One thing that’s really important is to give the device an ip address of 192.168.100.1 instead of 192.168.1.1 or other address likely to conflict with most home ADSL or other routers.  This is outlined in the config ‘interface’ ‘lan’ section below.

 

  1. Setup a password

    passwd  <pass>

  2. Give ’er a name (and timezone)

    edit:  /etc/config/system

    config system
            option hostname bifi # or whatever you would like to call your wrt.
            option timezone EST

  3. Config the network settings

    >>>add to the contents of /etc/config/network


    /etc/config/network
    config ‘switch’ ‘eth0’
            option ‘vlan0’ ‘1 2 3 4 5*’
            option ‘vlan1’ ‘0 5’

    config ‘interface’ ‘loopback’
            option ‘ifname’ ‘lo’
            option ‘proto’ ‘static’
            option ‘ipaddr’ ‘127.0.0.1’
            option ‘netmask’ ‘255.0.0.0’

    config ‘interface’ ‘lan’
            option ‘type’ ‘bridge’
            option ‘ifname’ ‘eth0.0’
            option ‘proto’ ‘static’
            option ‘ipaddr’ ‘192.168.100.1’
            option ‘netmask’ ‘255.255.255.0’
            option ‘gateway’ ‘192.168.100.1’

    config ‘interface’ ‘wan’               
           option ‘ifname’ ‘eth0.1’       
           option ‘proto’ ‘dhcp’          
                                                                                 

    >>>make the contents of /etc/config/wireless

    config wifi-device  wl0
            option type     broadcom
            option channel  5

    config wifi-iface
            option device   wl0
            option network  lan
            option mode     ap  #enables as an access point for others to conect
            # option mode     sta  # configures the router to connect to your network
            option ssid     <ssid> # the SSID of your network
            option encryption wep  # the encryption mode of your network
            option key    <key>  # add this line with your WEP key


  4. Test out SSH
    ssh -p22 root@<ip_addr>
    My ip_addr is 192.168.1.100 yours may vary.

 
Samotage_300_medium
Oct 11, 2009 6:33pm
555 posts

Mod for wifi backhaul

It’s kinda nice to be able to use the wifi on board the wrt to hook into your internetz tubing.  This is not only convenient, but practical.  It’s as simple as changing the network and wireless config.

The following are the current network and wifi config files we are using.  Note, this can also be done using the management GUI.

vi /etc/config/network

#### VLAN configuration
config ‘switch’ ‘eth0’
option ‘vlan0’ ‘1 2 3 4 5*’
option ‘vlan1’ ‘0 5’

config ‘interface’ ‘loopback’
option ‘ifname’ ‘lo’
option ‘proto’ ‘static’
option ‘ipaddr’ ‘127.0.0.1’
option ‘netmask’ ‘255.0.0.0’

config ‘interface’ ‘lan’
option ‘type’ ‘bridge’
option ‘ifname’ ‘eth0.0’
option ‘proto’ ‘static’
option ‘ipaddr’ ‘192.168.110.1’
option ‘netmask’ ‘255.255.255.0’

config ‘interface’ ‘wan’
option ‘proto’ ‘dhcp’
option ‘type’ ‘bridge’
option ‘ifname’ ‘wl0’
option ‘defaultroute’ ‘0’
option ‘peerdns’ ‘0’

 

>>> Then setup the wireless interface:

vi /etc/config/wireless

config ‘wifi-device’ ‘wl0’
option ‘type’ ‘broadcom’
option ‘channel’ ‘5’

config ‘wifi-iface’
option ‘device’ ‘wl0’
option ‘encryption’ ‘psk2’
option ‘key’ ‘<your special key>’
option ‘ssid’ ‘<the SSID of your network>’
option ‘network’ ‘wan’
option ‘mode’ ‘sta’

 

 
Samotage_300_medium
Oct 11, 2009 6:40pm
555 posts

Aiko Gateway Installation

The Aiko Gateway allows the Aiko Node, which collects data and other things from the world to send it’s information back to the interenetz to this site and also to recieve commands from this site.  It acts as the go-between for all the devices in your home, office, school or building.

Aiko Gateway is open source, made by @geekscape on twittr,  and here geekscape 

We have forked the Aiko software for Smart Energy Groups and our version is available on github here 

For this to work, the aiko_gateway.lua module needs to be placed into the home directory of the root user on the wrt.  This file also needs to be made executable ;)

The rest of this is what’s needed to get this baby to work!

Configure WRT

Disable login splash and shell access on the internal serial port:

vi /etc/inittab

>>> comment out this line, the 0 index tty serial console port.
# tts/0::askfirst:/bin/ash —login

>>> Get ser2net properly translate serial data into IP data
vi /etc/ser2net.conf

>>> blow everything and add the line:
2000:raw:0:/dev/tts/0:38400

>>> config ser2net to start on boot
vi /etc/init.d/ser2net

> add the following:
#!/bin/sh /etc/rc.common
# Copyright © 2009 Geekscape Pty. Ltd.

START=70

start() {
  ser2net
}

stop() {
  killall ser2net
}

>>> change permissions:
chmod 755 /etc/init.d/ser2net
/etc/init.d/ser2net enable

>>> make firewall work

vi /etc/firewall.user

>>> add:
# Enable SSH (port 22) for remote access
iptables -t nat -A prerouting_rule -i eth0.1 -p tcp —dport 22 -j ACCEPT
iptables        -A input_rule      -i eth0.1 -p tcp —dport 22 -j ACCEPT

# Enable LuCI web server for remote access (port 8080)
iptables -t nat -A prerouting_rule -i eth0.1 -p tcp —dport 8080 -j DNAT —to 192.168.1.1:80
iptables        -A input_rule      -i eth0.1 -p tcp —dport 80   -j ACCEPT

# Enable Ser2Net for remote access (port 2000)
iptables -t nat -A prerouting_rule -i eth0.1 -p tcp —dport 2000 -j ACCEPT
iptables        -A input_rule      -i eth0.1 -p tcp —dport 2000 -j ACCEPT

>>> script to start lua:

vi /etc/init.d/aiko_gateway

#!/bin/sh /etc/rc.common
# Written by Sam Sabey @samotage 2010-10-01.  Released into the public domain.

START=95

start() {

  cd /root

  ./aiko_gateway.lua &

}

stop() {

  kill all aiko_gateway.lua

}

 

chmod 755 /etc/init.d/aiko_gateway
/etc/init.d/aiko_gateway enable>>>setup some necessary symlinks for the gateway to operate

cd /usr/lib/lua
ln -s /root/aiko_configuration.lua .

Then reboot and prepare for OpenWRT SEGbox goodness.

 

 

 

 

 
Dargs_medium
Oct 4, 2010 2:36am
46 posts

Hi. New to the whole OpenWRT world… Do you still recommend the ASUS WL-520GU?  Or is there a different make/model out there that’s more suitable?

Cheers

dargs

 

 
Samotage_300_medium
Oct 4, 2010 4:50am
555 posts

Hey Simon,

Unfortunately for the OpenWRT community, the 500GP-v2 has been discontinued, and the 520-GU soon to go the same way.  The 520 is a great, router, and one that I personally like very much for it’s easy of use and ready recovery from a bricked state.

Sam.

 

 
Samotage_300_medium
Oct 31, 2010 10:40pm
555 posts


opkg config

This is the OpenWrt new package management tool that superceeds ipkg.  It’s based on the openmoki work which has improved the older ipkg, so don’t fear if you see ipkg on the internets as the two are at the high level the same.

We need to setup the parameters for the tool, do this as follows:

vi /etc/opkg.conf

…and mod it to look like this:

 src/gz snapshots http://downloads.openwrt.org/kamikaze/8.09.1/br…
 dest root /
 dest ram /tmp
 lists_dir ext /var/opkg-lists
 option force_space

save, and update the system.

opkg update

you should witness:

Downloading http://mightyohm.com/files/kamikaze-2.4/package…
Connecting to mightyohm.com (72.32.209.132:80)
Packages.gz          100% |*******************************|  8326  -:-:— ETA
Inflating http://mightyohm.com/files/kamikaze-2.4/package…
Updated list of available packages in /var/opkg-lists/snapshot

The location http://downloads.openwrt.org/kamikaze/8.09.1/brcm-2.4/packages/

has a huge range of installable packages for you to install. :)

 
Icon_missing_medium
Oct 27, 2011 1:09pm
3 posts

Hi Sam,

I have a D-Link DIR-615, Will the openwrt-brcm-2.4-squashfs_v0.13.trx you had compiled work with this router?

Or will I need to complie my own?

 

Thanks

Bill

 
Samotage_300_medium
Oct 31, 2011 12:46am
555 posts

Hey Bill,

This device I think uses the Atheros chipset and the Broadcom one above won't work.  You can check the OpenWRT tables of hardware here!

http://wiki.openwrt.org/toh/start#d-link

We are working on building an image for the Dragino hardware, which we are planning to use for the V2 SEGmeters!

Thanks,
Sam. 

 
Icon_missing_medium
Oct 31, 2011 2:26am
3 posts

Hi Sam,

I had a spare D-Link 615 and I was able to load DD-WRT on it successfully.  However I haven't been able to load OPEN-WRT successfully.

Is there an Application that I can run on a windows PC that can upload the data to the site?  I am thinking of using an existing windows PC that is collecting data from a weather station.

 

Thanks

Bill

 
Samotage_300_medium
Oct 31, 2011 5:20am
555 posts

Hey Bill,

If you can get DDwrt running on it, it's likely that an Atheros version for OpenWRT should work?  I will be certainly posting back here when we get our Atheros image all rolling!

While not windows people at SEG, it's possible to setup Lua on Windows:

http://code.google.com/p/luaforwindows/

And then mod our gateway to run there:

https://github.com/samotage/Aiko/tree/master/SE...

Or roll your own?

Thanks!

Sam.

 

 
Icon_missing_medium
Oct 31, 2011 5:46am
3 posts

Thanks Sam,

I now understand  that this is a purely linux solution.  

I should of paid more attention when you asked if I had any Linux skills.  I was more focused on learning how to program the Arduino.

Unfortunately I don't have any Linux skills or an old ASUS router lying around.

Thanks for your help.

Regards

Bill

 
Icon_missing_medium
Mar 13, 2012 4:38pm
1 post

Olá Olá!! I talk from Portugal and I would be very interesting to know which solution you suggest at this moment concerning hack a router ro zigbee. Even if the brand is different from Asus we can apply the same reciep as ladyana???

 
Samotage_300_medium
Mar 13, 2012 9:27pm
555 posts

Hey Xaral,

We ran out of Asus routers last year, and about to release our version 2 very soon!  This has Dragino runningnOpenWrt with the new Attitude Adjustment firmware,molds a bunch of cool stuff including the V2 SEGmeter!

There are also a bunch of Zigbee things on the way too. :D

Sam,

@samotage

 
Icon_missing_medium
Apr 2, 2012 11:04am
12 posts

Hi Samotage,

 So when is soon for V2. Need the extra ports and have to save some cash.

V1 running perfectly, forgettable.

Mano

 
Samotage_300_medium
Apr 5, 2012 2:32am
555 posts

Hey Mano,

We have just moved into our new offices, and one of the next things is setup of the photography space for the V2 gear.  It's all working really well and ready for prime time, so keep an eye out!

It's also likely we will send a mail to everyone when the SEGshop is open, together with a special members onlu discount coupon :D

Thanks!

Sam,

@samotage 

 
Icon_missing_medium
Apr 12, 2012 3:46pm
12 posts

Will do, ta

 
Samotage_300_medium
Jan 17, 2013 12:39am
555 posts

Some shortcuts for re-building your SEGbox ;)

Asus 520-GU devices

WiFi Connection firmware:

https://smartenergygroups.com/segbox/segbox_28_...

Ethernet connection firmware:

https://smartenergygroups.com/segbox/segbox_28_...

This should make life easier!

Log in to reply to this topic

Forums The Open Grid OpenWrt - Asus WL-520GU

copyright © 2008 Smart Energy Groups pty ltd