1-Wire Wireless Router

Synopsis:

Linksys makes a marvelous wireless router, the WRT54G.
It runs embedded linux, and the source is freely available. You can
make an unauthorized and unsupported modification to add 1-wire support
to the router. Basically, each router can act as a high-speed,
intelligent 1-wire controller. Here's how!

The Hack

Jim Buzbee very cleverly adds a mini distribution to the
router. See his page
for full explanation. This is a simple script that adds user tools,
like busybox, telnet, etc to make the router accessible. The nice part
is that the router is not harmed, a reset restores it to pristine state.

OWFS is 1-wire
filesystem
for linux that allows 1-wire access for linux. It is quite
light-weight, and will run from the ram disk.

Chrstian Magnusson is modifying OWFS for the WRT54G, based on
his experience getting owfs to run on coldfire processors. This is
quite a feat considering that he is changing glibc to uClibc, processor
architecture, memory and mutex handling, and filesystem organization.

Hardware

Serial ports

There are several discussion on the web for accessing the hardware of
the WRT54G and adding serial ports. Rod Whitby

DS2480B

At least in theory, it should be possible to add the DS2480B directly
to the board. Here is a rough schematic:

The idea behind this circuit is
taking the serial outputs from the circuit board header (WRT54G v2 and
WRT54GS, not earlier versions). The 3.3V is stepped up by the MAX883,
and DS2480B negotiates with the 1-wire bus, the capacitors are for
signal conditioning (from the MAX883 datasheet) and the diodes (you can
use the DS9503) protect the circuit from attempts to drive the data
line too low. Additional note: Rev4 of the circuit uses shottky diodes
and a 7805
voltage regulator. Power source is from the power to the box, not the
3.3V on the serial header.

On Wed, Jun 17, 2009 at 6:59 AM, Plich Konrad wrote:
> Please note that schematic http://owfs.sourceforge.net/rev4.png linked on
> the page http://owfs.sourceforge.net/WRT54G.html has mistake: 1-wire bus
> schould be connected to PIN2 of DS24080B and not to PIN3 - this one is NC.
>
> Second mistake is connected with PIN 6 - acording to DS2480 data sheet it
> should be conected to +5v for 3.3V serial operation.
>
> Please correct it - in this form the picture can spoil a lot of time for
> careless people (like it did for me :-)

Circuit Improvements

David Lissiuk of Springbok
writes:
I'd suggest the use of Shottky diodes for the line protection instead
of IN4004 (faster response). Putting optocouplers and DC to DC in the
circuit would protect the Linksys from anything that happened to the
1-wire side. (Maybe as an optional components?) The addition of
switchable line filter on the 1-wire side of the DS2480 would be
appropriate also to remove the need in some situations. Need to look
closer at the Linksys for other suggestions.

Available as Kit or Assembled

David Lissiuk has announced availability
of a working circuit for modifyiong the Linksys router. He includes
better protection, optional sensors, and a second serial port.

Software
(works for both DS2480B direct circuit and serial port with adapter)

If you just want to try owfs by uploading the binaries to RAM
(without upgrading your firmware) follow the instructions below:

If you want to upload and start owhttpd only, then you could
start
the script:

host> ./upload-owhttpd [host]

Try http://192.168.1.1:3001/
after the script has finished. You should now see the 1-wire devices
connected to your router.

If you want to upload all owfs files, including fuse-module,
owfs,
owhttpd and some start-scripts, then you have to install
wrt54g-0.51.tar.gz from Buzbee's website first. (see above)
Download it from http://www.batbox.org/wrt54g-linux.html,
unpack and
install it. (and eventually modify wrt54g.sh for local conditions)

You should now be able to install the owfs-files with the
script called

If you want to create graphs on all temperature sensors, then start
temploggerd.

/ # run-temploggerdStarting temploggerd/ #

Visit http://192.168.1.1:8000/temploggerd/
after the script has finished. You should now see a list of all 1-wire
devices, and the links will display graphs of all temperature sensors.
If you want to change the generated web-pages, then you could edit the
template
files before starting temploggerd. Some of the template-files are:

Visit http://192.168.1.1:8000/temploggerd/
after the script has finished. You should now see a list of all 1-wire
devices, and the links will display graphs of all temperature sensors.
If you want to change the generated web-pages, then you could edit the
template
files before starting temploggerd. Some of the template-files are:

NOTE: These packages require you to have OpenWRT installed on
your router.

I can't recommend OpenWRT to users without any experience of
Linux, shells-script experience. There are NO web-interface to
configure all network settings, so you should have some knowledge and
read the documentation, FAQ and examples at OpenWrtDocs, OpenWrtFaq and the forums.

Set your router configuration BOOT_WAIT=1. Don't upgrade your
firmware until this is done!!! The OpenWRT project has a good page
which helps you set the BOOT_WAIT
configuration.

Make sure to read the OpenWRT documentation on http://wiki.openwrt.org/OpenWrtDocs
before you flash the new firmware. Go to the
"Administration->Firmware" tab and select the path where you have
the .bin file. Upgrading the firmware could take up to 5 minutes. DON'T
reboot or power-off the router during this procedure!

First time OpenWRT is booting (after the firmware-upgrade),
it will setup and prepare the jffs2 partition. This could take 1-2
minutes. Be patient and wait....

When filesystems are created, you have to reboot your router
once more to mount the filesystems in read/write mode. This reboot is
neccesary to do since you are going to install new packages. You should
be able to login with telnet and reboot it manually when it's ready.

(Note: libpthread, kmod-fuse, libfuse, fuse-utils, librrd1, rrdtool1,
rrdcgi1 will also be installed due to dependencies)
(Note: ntpclient or rdate should set the date if the router reboots. If
not, the graphs won't show correct date)

Try starting owfs and temploggerd manually (after setting
date):

/etc/init.d/S60ntpclientrun-owfsrun-temploggerd

(Default settings for the scripts could be changed in /etc/default/*)

Visit http://192.168.1.1/temploggerd/
after the scripts has finished and the rrd-file is created (could take
30 seconds).
You should now see a list of all 1-wire devices, and the links will
display graphs of all temperature sensors.
If you want to change the generated web-pages, then you could edit the
template
files in /usr/share/temploggerd/templates/ before
starting temploggerd. Some of the template-files are:

To upgrade all installed packages to the latest version, just
run the commands:

ipkg updateipkg upgrade

Since there are startup-scripts for all applications, you
should be able to reboot your router and have owfs and temploggerd
automatically restarted.

All files generated from temploggerd are saved in /var/lib/temploggerd/
as default. Those files are lost if router reboots since it's located
in the ramfs partition. Therefor I added the config-parameters
"backup_dir" and "backup_freq" in /etc/temploggerd.conf
which tell temploggerd to copy all files from /var/lib/temploggerd/
to /opt/backup (in flash-disk) once per hour for example.
This method will increase the lifetime of the flash-memory and give you
the possibility to save the rrd-files if you reboot the router. You
could of course make a cronjob to copy the files from /var/lib/temploggerd/
to /opt/backup/temploggerd/ for example, if you feel more
comfortable with that. Remember that a startup-script should then copy
the backup files to /var/lib/temploggerd/ before starting
temploggerd.