Reef Central Online Community

Reef Central Online Community (http://www.reefcentral.com/forums/index.php)
-   Do It Yourself (http://www.reefcentral.com/forums/forumdisplay.php?f=3)
-   -   Howto: Use a Linksys Router as Wireless Reef Controller - WRRC (http://www.reefcentral.com/forums/showthread.php?t=484912)

barebottoms 12/10/2004 07:10 PM

WRRC = Free as in Beer - (Wireless Recycled Reef Controller)
 
Okay it is way too early as a functional device, but I accomplished my first hurdle today. I got the Free Belkin Wireless router (after rebates and YMMV dealio) to take my own image. No big deal, but it took me 3 days to get it accept my hacked filesystem.

Project Description:
-------------------------
Yeah yeah, there's been at least 50 million Reef Controller starts. This one will probably go the way of the dinosaurs too, but I always wanted an Open Hardware, Open Source project so even if it does you're free to make any changes you want. No commericial intent, keep it fair and don't skirt GPL like Sveasoft.

So my idea was to take a wireless AP and make it be a reef controller. A lot of the ones on the market run Linux already, it is a matter of finding the right one with enough information on getting into the box. The ASUS WL-500g would've been my first choice (with USB and Filesharing already built in), but the Belkin was free for me after rebate.

Communications:
----------------------
Since I'm starting with an AP, I will have Wireless and Ethernet on the device. I also needed a means to collect and control. I always liked 1 Wire Micro Lans, so the device needs to have serial or USB as well. Easy enough with the Broadcom based reference design AP's. Just a matter of enabling them on some APs.

Software:
-------------
This is the part where the most arguements take place on DIY reef controllers. So my idea is simple, do whatever you want. How my reef controller will work is as follows:

1) Use OWFS
http://owfs.sourceforge.net/
- http://owfs.sourceforge.net/WRT54G.html
- some one already went through the work to cross compile it on the WRT, so worst case is that I need to xcomplie for the Belkin if my model happens to use a different Kernel

2) Export the FUSE file system for OWFS and run whatever front end you want

On the system it self you will always have the real time data, so you can just do a simple script to Display on a 1 wire LCD which OWFS supports:

http://www.louisswart.co.za/1-Wire_Overview.html

3) OWHttp will give you access to the 1 Wire Devices from a remote browser.

With the exported OWFS you can write any type of front end you want to pretty up the output.

4) Control will go to a 1 Wire switch or relay board such as:
http://www.aagelectronica.com/aag/in...tml&lang=en-us

I've got schematics for several different ones, but don't know what I'll end up using since I only know basic electrons.

For the actual control, I will use cron on the embedded side so I can survive reboots etc. I'm really limited on space on the Belkin, so I man have to do a Server side control as well.

So that's my start, it's a proof of concept and it works. Just a matter of Cross compiling a few utilities, a bunch of scripts and a few brilliant EE types and slap the pieces together.

http://reefcentral.com/gallery/data/500/15092wrrc.jpg

usjaz 12/14/2004 09:00 PM

Interesting. I did a little reading of referenced HW and SW.

I think the MicroLan interface is definitely very interesting idea!

As for DIY linksys type wireless router, it is a cute little wireless platform. Unique features of this platform are Linux support, wireless connectivity, small embedded footprint and low cost, which are all great. However, battery backup is not included, so power failure must be dealt accordingly.

The 1-wire Reef controller software and 1-wire devices for this project are very generic and can be connected to any Linux supported computing device equipped with serial and USB. I would actually do the majority of the development work on a regular PC, where you have the luxuary of monitor/keyboard/disk space/tools.

When you get it working and tested on the PC, then cross compile for WRT... In another word, support both PC and WRT platform at the same time.

The relay you quoted only supports 60w switching, which is probably too low for lights/chiller/heater. Auxilary high wattage relays needs to be chained to it to be useful.

Alternatively, use I/O switch like DS2406 driving external relay would be a much better choice.

Other readily available 1-w parts:

1-wire temp precision sensor DS18S20

DS-2190 for lights dimming

DS2480B Serial->1wire converter for network reliability.


As far as software goes, you can write a daemon that does continueous monitoring and/or periodic evaluation. Or glue things together with cron as you suggested, but a single daemon that starts at every boot would be much more easy to debug and manage, and better reliability. It just has to be designed to deal with power failure. Cron job is nothing more than just periodic activation, which can be easily achieved with a daemon.

My background is in Linux embedded computing platform (everything from kernel/driver to userapps to web). I'm interested in your project and in contributing to it down the line.

barebottoms 12/14/2004 09:25 PM

Quote:

Originally posted by usjaz
Interesting. I did a little reading of referenced HW and SW.

I think the MicroLan interface is definitely very interesting idea!

Glad some one else see's the value in this.

Quote:

However, battery backup is not included, so power failure must be dealt accordingly.
Over at Linux Hacker, Hardware1 had it running in his car for a few hours. Nothing special just direct 12v from the lighter to the router. He did it several times turning off the car and starting it. He was monitoring the link on his pc and the wireless never stuttered. Another person crank the input up to 30V (I think). Several people have said the on board regulator is pretty good on the belkin. So I think a simple Gel Cell should keep this thing running. Hardware1's notes were that it draws 3.84 watt at 12v.

http://www.linux-hacker.net/cgi-bin/...age=0&Session=


Quote:


The 1-wire Reef controller software and 1-wire devices for this project are very generic and can be connected to any Linux supported computing device equipped with serial and USB. I would actually do the majority of the development work on a regular PC, where you have the luxuary of monitor/keyboard/disk space/tools.

Yeah I agree, that's why I think OWFS is such a nice 1 Wire Software package. It is so portable. I already run Digitemp on my and OWFS on my linux box, and really all it takes is writing even shell scripts to interface with OWFS. Plus because of my limited flash, I can always just export the OWFS to my linux box and have the scripts run agains the OWFS on the Router.

Quote:


When you get it working and tested on the PC, then cross compile for WRT... In another word, support both PC and WRT platform at the same time.

Already there. I have my Belkin console and have tested OWFS on it.

I've Xcomplied Busy Box for the Belkin (I guess it will work for WRT too), to make it small enough for the Belkin with Telnetd, HTTPD, NFS and the common bin utils.

On the OWFS page, there is already binaries to FUSE, OWFS, OWHTTD that has been XComplied for the WRT. Which just happens to run on the Belkin because it happens to have the same Kernel verison and uclibc version as the Linksys.

If you're going with the WRT as your platform, then it is easy. You just have to do the Buzzsaw extentions on it, and you're on your way.

With the Belkin, I had to strip a lot of software off the Stock firmware, rewrite my new image wrapped in it's special firmware header.

Quote:


The relay you quoted only supports 60w switching, which is probably too low for lights/chiller/heater. Auxilary high wattage relays needs to be chained to it to be useful.

I thought it was, I'm no EE. Looking through the spec I was thinking that I can just take that to drive yet another relay like an SSR for higher loads.

Quote:


Alternatively, use I/O switch like DS2406 driving external relay would be a much better choice.


Other readily available 1-w parts:

1-wire temp precision sensor DS18S20

DS-2190 for lights dimming


I'll probably need help with this. I've been collecting various samples and schematics from and for Dallas parts. The 4 channel AD converter is the one I can't wait to play with.

Quote:


DS2480B Serial->1wire converter for network reliability.

This is probably what I will put right into the Belkin if I can't get the USB interface working on it. This is also Paul Allfie (author of OWFS) suggestion for the WRT where they have the luxury of 2 serial ports.

Quote:


As far as software goes, you can write a daemon that does continueous monitoring and/or periodic evaluation. Or glue things together with cron as you suggested, but a single daemon that starts at every boot would be much more easy to debug and manage, and better reliability. It just has to be designed to deal with power failure. Cron job is nothing more than just periodic activation, which can be easily achieved with a daemon.

My background is in Linux embedded computing platform (everything from kernel/driver to userapps to web). I'm interested in your project and in contributing to it down the line.

Again I'll probably need help with this. I'm no programmer either :) But show me a sample or get me started, I usually can produce something that sort of works.

With regards to working on the pc for easier debugging, if you look at this link:

http://www.efn.org/~rick/work/f5d7230/

That's exactly the setup. He setups up a console and makes the router's bootloader boot off his pc. Reminds me of the vxworks loaders the Software Engineerers at my work uses, I guess it is the same idea here.

Let me know if you choose to go with the Belkin, I can give you all my notes on what it takes to make the image, what I stripped.. etc.. etc..

Either way, what ever hardware and software we come up with will work on any of these Broadcom reference design routers.

usjaz 12/15/2004 01:34 AM

Originally posted by barebottoms
Glad some one else see's the value in this.



Over at Linux Hacker, Hardware1 had it running in his car for a few hours. Nothing special just direct 12v from the lighter to the router. He did it several times turning off the car and starting it. He was monitoring the link on his pc and the wireless never stuttered. Another person crank the input up to 30V (I think). Several people have said the on board regulator is pretty good on the belkin. So I think a simple Gel Cell should keep this thing running. Hardware1's notes were that it draws 3.84 watt at 12v.

http://www.linux-hacker.net/cgi-bin/...age=0&Session=


Actually, I was refering to the fact the filesystem and application must be written in a fault tolerant fashion to survive reboot and power outage. In another word, they will not corrupt data and/or filesystems due to brown out. But, it is good to know belkin has a good power supply :) I have not look at the WRT Linux projects in detail, but I am aware its existence since linksys first came out with the linux based wireless router years back. I assume ppl of WRT platform had to deal with fault tolerant issue already. But knowing nothing of works already been done, here are a few things you can do: use a readonly filesystem for code store, use a journalling filesystem for data store, and self consistent check in apps, periodic and atomic commits, you can build a pretty reliable system out a regular computing platform without much hardware asist. I know that because I've done so for my day job :) I Our product functions just like linksys WRT, except ours is better ;) I meant, it cost 100 times more :) ... a satellite router system :)

One thing you have to watch out with a flash based storage, if you are planning to do any extensive data logging (ie. for graphing), you must calculate the wear on your flash. Depends on underlying flash chip, whether the wear leveling is done in the HW or by Linux software, you may have to limit amount of writes to the flash to avoid getting corrupted NAND cells. (ie. limit to 1 write per 30sec)


[/B]


Already there. I have my Belkin console and have tested OWFS on it.


Do you have any converter and/or 1-w devices hooked up already?


I've Xcomplied Busy Box for the Belkin (I guess it will work for WRT too), to make it small enough for the Belkin with Telnetd, HTTPD, NFS and the common bin utils.


I have contributed to busybox project before and also use it in the product I work on. Busybox is a perfect fit for a project like this.



On the OWFS page, there is already binaries to FUSE, OWFS, OWHTTD that has been XComplied for the WRT. Which just happens to run on the Belkin because it happens to have the same Kernel verison and uclibc version as the Linksys.



Ffor what we need to do here, uclibc would serve its purpose fine. This project can leveraging all existing precompiled binaries available for WRTs. In my particular experience, I had to recompile all tools against uclibc manually one by one. Some required modification, but that's beside of the topic :) but uclibc was buggy in one of critical functions for us -- a working implementation of runtime dynamic linking library. I had to back out to use glibc.



If you're going with the WRT as your platform, then it is easy. You just have to do the Buzzsaw extentions on it, and you're on your way.


Don't know what Buzzsaw extension is. Haven't looked at it yet.



With the Belkin, I had to strip a lot of software off the Stock firmware, rewrite my new image wrapped in it's special firmware header.


Understandable...



I thought it was, I'm no EE. Looking through the spec I was thinking that I can just take that to drive yet another relay like an SSR for higher loads.


That would work.


I'll probably need help with this. I've been collecting various samples and schematics from and for Dallas parts. The 4 channel AD converter is the one I can't wait to play with.


A/D will be nice to implement PH and ORP probe. :)


This is probably what I will put right into the Belkin if I can't get the USB interface working on it. This is also Paul Allfie (author of OWFS) suggestion for the WRT where they have the luxury of 2 serial ports.


Not sure which part to use for USB<->1wire connection. Is there a part you have in mind?



Again I'll probably need help with this. I'm no programmer either :) But show me a sample or get me started, I usually can produce something that sort of works.


That's the DIY spirit! :(

I am programmer by training, I can definitely offer your help with SW. As with HW, I know enough to be dangerous :)


Let me know if you choose to go with the Belkin, I can give you all my notes on what it takes to make the image, what I stripped.. etc.. etc..


Hmm... let me see if I can find the old linksys box I used to have .... Or else I'd have to buy a new belkin.

Barebottom, which part of the country are you in?

barebottoms 12/20/2004 06:09 PM

I've managed to fry 1 router already. I found my DS9097u but couldn't figure out how to power it since it robs power from CTS/RTS lines. So now I'm waiting on parts to use the DS2480.

As for the File System, I'm going to log to ramfs. I have to figure out if the data is actually worth keeping. If so, I might just do a simple udp write to a remote collector.

I made a mistake, Buzzsaw = Buzzbee's shell scripts for the WRT.

I've also picked up a WRT at Best buy since I blew up the other router. I really think this is going to work out great.

I'm sure I can collect the data, just need to know what to do with it at this point. I think you're right that I'll need a deamon of some type.

I have to think about software design now. Not the fun part for me. It needs to be modular for "event types", "input (sensor)" and "output (action)". That's about as much thought as I've put into it so far.

I'm north of you in the SF Bay area.

BeanAnimal 12/20/2004 11:02 PM

geze.. I just purchased a atmega128 and have been pouring through a ton of dallas datasheets.....


and threw out a bunch of the same APs the other day.... never occured to me to hack them.

Keep us informed, I would like to know how the 1 wire stuff works out.

As a side note... can somebody come up with a ammeter circuit to monitor the power consumtion of devices and send it to an A/D for logging?

barebottoms 12/20/2004 11:05 PM

From my collection of 1 wire sensors that I hope to implement some day.

http://www.simat.enta.net/1w-rtpm.html

usjaz 12/21/2004 12:59 AM

Good, we are on the same page then :) I picked up a WRT54G from BB too :) for this project. Anyways, How did you fry your other router?

I got WRT54G, if you got WRT54GS, you would have double amount of memory and flash... Which one did you get?


I have read a bit more of the storage layout on these routers. You can use the NVRAM to store things, just have to be selective....

Which 1-w parts do you have or plan to acquire at the moment? What's the initial plan of attack, what do you think is the first or the easiest thing to get working as a start? Temperature probe? relays?

Assuming all these will be controlled over DS2480.

About data collection, once you collected data, you can use RRDtools (round robin database) for archiving and to automatically generate realtime graph to be exported directly via web page.

cheers,

-jaz



Quote:

Originally posted by barebottoms
I've managed to fry 1 router already. I found my DS9097u but couldn't figure out how to power it since it robs power from CTS/RTS lines. So now I'm waiting on parts to use the DS2480.

As for the File System, I'm going to log to ramfs. I have to figure out if the data is actually worth keeping. If so, I might just do a simple udp write to a remote collector.

I made a mistake, Buzzsaw = Buzzbee's shell scripts for the WRT.

I've also picked up a WRT at Best buy since I blew up the other router. I really think this is going to work out great.

I'm sure I can collect the data, just need to know what to do with it at this point. I think you're right that I'll need a deamon of some type.

I have to think about software design now. Not the fun part for me. It needs to be modular for "event types", "input (sensor)" and "output (action)". That's about as much thought as I've put into it so far.

I'm north of you in the SF Bay area.


barebottoms 12/21/2004 01:16 AM

I've sampled these from Maxim:

DS9490R - USB to 1-Wire/iButton Adapter
DS2405 - Addressable Switch
MAX406 - Single, Dual, Quad, 1.2uA Max, Single-Supply Op Amps
DS9503 - ESD Protection Diode with Resistors
DS2408 - 1-Wire 8-Channel Addressable Switch
DS2450 - 1-Wire Quad A/D Converter
DS2438 - Smart Battery Monitor
DS2480B - Serial 1-Wire Line Driver with Load Sensor

I already have a bunch of the DS18S20's and the DS9097U serial interface.

I fried the Belkin by trying to take the 5v after the power supply to power the DS9097, but I didn't have a diode at the time and I guess when RTS went high, it went back to the RX on the Belkin TTL serial port.

I got the WRT54g, since it was only $35 after the rebates, I don't think we need the extra flash or memory yet.

Temperature would be the easiest I think. We can always look at the code for Digitemp, or OWFS natively will do Temperature conversion.

I'm waiting on my Schmartboards:

http://www.schmartboard.com/index.asp?page=products

Right now to build the DS2480 interface.

Then, I figured the first thing is get both serial ports working. I think leave console on ttys0 and put the DS2480 on ttys1.

Next figure out how we want to layout the FS, list of variables. I'm looking to see if RRD will port to this thing easily, if it does then we have a simple database for measurements. <-- disregard, didn't catch that you already mentioned RRD in your post.

I guess when can put the RRD files in RAMFS, then do a export of over nfs if we really want backup and historical data.

Further down the line, for the Webserver on the device itself, I'm not too worry about. It does cgi, so when ever command line tools we come up with can easily be integrated (which I think is how they actually set the nvram variables with "nvram" command). I'm sure at this stage everyone will be jumping to volunteer to pretty things up on the interface :).

usjaz 12/21/2004 02:02 AM

You still didn't tell me which part of the country you are in :)

BeanAnimal 12/21/2004 09:24 AM

I will look into the power monitor designs. I have not read the article but will do so as soon as I get a chance. I ordered a bucnch of current transformers from allelectronics but have yet to tinker with them. I found circuits also, but most measured between 2 and 10 amps.

I think I would like to implement the design to monitor single devices instead of (or in addition to) total power strip consumption.

The idea would be to simply use a timed polling of the devices (a few times a second or something) to get a running average of power consumtion. A simple 'realtime' graph would be displayed.

usjaz 12/21/2004 01:49 PM

I think it'd be cheaper to buy a "Kill a watt" device for 29 bucks for power consumption monitoring,but then you won't be able to monitor it say from the web :)

barebottoms 12/22/2004 12:14 AM

Northern California, SF Bay Area. You even replied and quoted to my previous post with location. :)

It looks like RRDTools might not cross compile. It seems to want IEEE Math. I did a bit of digging, but at one time it was a port on OpenBSD for Alphas. According to the kernel maintainer, MIPS doesn't do the the true IEEE math, but should not be needed for RRDTools.

I'm also looking into SQLite if I can't get RRDTools to compile. If it RRDTools does compile, do we need the graphics libs? I guess it won't hurt, but I think it will make the tools a lot bigger. Provided there is a way to compile with out the jpeg, gd support.

barebottoms 01/02/2005 12:56 AM

Some progress.

1 Wire to Serial Interface completed. I can read temperature off a DS18S20 on the 1 wire bus now.

There is the DS2480B, Dual Serial MAX232 and the WRT54G all connected.

http://reefcentral.com/gallery/data/...lete-board.jpg

Here is just the DS2480B interface. My first attempt at soldering an SOIC, turned out to be a piece of cake. I prototyped it on a Schmartboard. Ended up using 6 rows of vias, which 2 of them are the power and ground busses. I have plenty more room to prototype more Dallas IC's on the remainder of the board. Not bad for a $5 2"x2" board.

http://reefcentral.com/gallery/data/...092ds2480b.jpg

barebottoms 01/12/2005 03:27 PM

Wiki Launch thanks to bigreddastud.

http://bytality.com/wrrc/index.cfm

I'm still adding content. I'm trying to explain, show and document everything. Make the content easy to understand.

So post comments and questions.

barebottoms 01/12/2005 03:43 PM

Looks like X-10 firecraker will run on this box. Just did a quick x compile and it looks good. I'll test with a module when and if I find one.

sagitariuscbc 01/14/2005 12:12 AM

barebottoms- i have a brand new one in the box.
it was a freebee a while back from the X-10 site.
it is described as a 4 pc. FireCracker Interface Kit, CK18A-C
can you use this? it's yours if the answer is yes.
shawn!~)

barebottoms 01/14/2005 12:15 AM

X-10 is evil! :) I don't want it, but if you can let me borrow it to test in case I can't find mine, that would be great.

aka_BigRed 01/14/2005 07:34 AM

Sounds like you've been scarred for life by X10 :)

I posted a thread over on thereeftank.com in our local aquarist section, and one of the guys said he's a Linux admin and he may be able to help if you need it.

his handle's the_colonel over there.

BeanAnimal 01/14/2005 11:22 AM

anybody get a power monitor working yet? I looked at the national designs... but have yet to wind my own 1800:1 current transformer... hrmm wonder why :P

There has got to be an easier way! I have a garbage UPS (cyberpower) that reports current draw via the serial port. (as do most UPS). I think I will hack into this thing.... unless somebody else wants to revers engineer it.

Bean

aka_BigRed 01/14/2005 05:29 PM

Quote:

Originally posted by BeanAnimal
anybody get a power monitor working yet? I looked at the national designs... but have yet to wind my own 1800:1 current transformer... hrmm wonder why :P

There has got to be an easier way! I have a garbage UPS (cyberpower) that reports current draw via the serial port. (as do most UPS). I think I will hack into this thing.... unless somebody else wants to revers engineer it.

Bean

Dallas makes a couple 1-wire chips that monitors current & voltage: (DS2760 DS2761 DS2762) all are made for High-Precision Li+ Battery Monitoring. I would think we could use these?

http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3950

I was trying to look up the PH voltage put out by the probe circuit, and I thought it's pretty low. (can't remember exactly off the top of my head).

I think interfacing the DS2762 & PH circuit for correct voltages will be the challenge.

????

barebottoms 01/14/2005 06:27 PM

Bean I'm not that far yet, but can't we get one from:
http://www.coilcraft.com/sen60tr.cfm
to avoid the manual labor.

badpacket 01/14/2005 08:09 PM

Darn you, thats my idea!!! :)

BTW, for anyone interested in the Bay Area, I started a group off of the Atmel avrfreaks.com site, though it is still not really doing much of anything.

http://microcontroller.meetup.com/2/



Quote:

Originally posted by BeanAnimal
geze.. I just purchased a atmega128 and have been pouring through a ton of dallas datasheets.....


and threw out a bunch of the same APs the other day.... never occured to me to hack them.

Keep us informed, I would like to know how the 1 wire stuff works out.

As a side note... can somebody come up with a ammeter circuit to monitor the power consumtion of devices and send it to an A/D for logging?


BeanAnimal 01/14/2005 10:29 PM

did you get a price for the CT? I found a place that will wind custom toroids 2 for $10 plus materials or something like that.

http://www.adsinfo.com/quickcoil.html

I need to find a way to do this cheap, as I want to monitor each device and it's current draw.

LIEBERT makes power strips that monitor total draw for the strip. The strips are ethernet enabled and use SNMP to report paarameters. They are kinda spendy $500+ I think.

barebottoms 01/14/2005 10:49 PM

Code:

          1            100            250            500            1,000            2,500            5,000            10,000+
CS2106        $ 7.50        $ 6.40        $ 5.10        $ 3.60        $ 3.32        $ 3.10        $ 2.80        Quote

Wasn't sure if that is the right one, but there's the price for that one.

Or maybe hack a Kill-A-Watt if they are only $29, can probably take the line to the LCD

There is also a Watt's Up device that has serial outputs for data logging. $139


All times are GMT -6. The time now is 03:16 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.