Anyone wanna help a dummy With Simple LAN?

tmack

Member
I bought a simple Lan a while ago and have been busy with other projects since. I think Im really in need of basic help figuring out how to get what I want out of it. I am trying to be able to turn a series of like 10-12 leds on and off over the internet using the simple lan as an interface. With others help form here I have been able to make rs232 controllers. I also have Vbasic and can use that to control rs232 projects as well. I can access the homepage for my simple LAn. I'm trying to get it set it up so that the webpage in the Simple Lan has "buttons" on it so that when it is accessed and the button is pressed in the webpage it makes leds go on or off similiar to how the vbasic pogram I made turns them on using rs232 locally . Im sorry to say that what Ive read so far about the simple lan has been too advanced for me and just confuses me more. Any help would really be greatly appreciated.
 

MORA99

Senior Member
This is a relay controller using simplelan that I have been using for about 6months.

Its not buttons, but it shows the basics about setting the variables.
Theres some work todo to get a nice interface, this is only used by me so I dont care as much :)

Code:
<body bgcolor="#DCDCDC">
<META HTTP-EQUIV="refresh" CONTENT="5; URL=rrlay.html">

<!--
Note: When a port is high, the relay does not conduct - So low=on high=off
-->

<SCRIPT>
function writeStatus(val) {
 if (val == 0)
  return "ON";
 if (val == 1)
  return "OFF";
 if (val == 2)
  return "Cycling";    
}

function writeColor(val) {
 if (val == 0)
  return "#669933";
 if (val == 1)
  return "#FF3333";
 if (val == 2)
  return "#FFFF33";    
}

function listPort(id, title, val, varname) {
 document.write("<TABLE height=50 width=200 BODER=0 CELLSPACING='0'>");
 document.write("<TR height=50 bgcolor='");
 document.write(writeColor(val));
 document.write("'><TD width=30>"+id+"</TD><TD width=100>"+title+"</TD>");
 document.write("<TD width=70>");
 
 if (val == 0)
  document.write("<a href='rrlay.html?"+varname+"=1'>Turn off</a><br>")
 
 if (val == 1)
  document.write("<a href='rrlay.html?"+varname+"=0'>Turn on</a>");
 
  if (val == 0)
 document.write("<a href='rrlay.html?"+varname+"=2'>Cycle</a>");
 
 document.write("</TD></TR></TABLE>");
}

</SCRIPT>



<center><font size="24px" color="navy"><b>Ethernet relay controller</b></font><br><br>

<TABLE BODER=0 CELLSPACING="5">
<script>
document.write("<TR><TD>");
listPort(1,"Cerebro","0","At_var20");
document.write("</TD><TD>");
listPort(2,"Futte","0","At_var21");
document.write("</TR><TR><TD>");
listPort(3,"WLAN","0","At_var22");
document.write("</TD><TD>");
listPort(4,"Modem","0","At_var23");
document.write("</TR><TR><TD>");
listPort(5,"100mbit","0","At_var24");
document.write("</TD><TD>");
listPort(6,"gbit","0","At_var25");
document.write("</TR><TR><TD>");
listPort(7,"Zyxel","0","At_var26");
document.write("</TD><TD>");
listPort(8,"FAN","0","At_var27");
document.write("</TD></TR></TABLE>");
</script>
</TABLE>

<br><br>
<!--
<a href="index.htm?At_var20=1&At_var21=1&At_var22=1&At_var23=1&At_var24=1&At_var25=1&At_var26=1&At_var27=1">Turn off all</a><br>
<a href="index.htm?At_var20=0&At_var21=0&At_var22=0&At_var23=0&At_var24=0&At_var25=0&At_var26=0&At_var27=0">Turn on all</a><br>
-->
And the long unoptimised picaxe code

Code:
#picaxe 28x1
setfreq m8

SYMBOL pin=b3
SYMBOL var=b4

SYMBOL temp=b5
SYMBOL temp2=b6
SYMBOL temp3=b7

'portc7 is used instead of out0 which is used for simplelan
LOW portc 7

''Works without disconnect
''but could give a little extra speed to disable ?
'disconnect

sertxd ("BOOT",cr,lf)


'Read from eeprom to simplelan
for temp=20 to 27
temp3 = temp + 60
read temp3,temp2
serout 0, t1200, ("!AT0W",temp,":",temp2, CR)
next


do
'handle all outputs
pin=0
var=20
gosub switchoutput

pin=1
var=21
gosub switchoutput

pin=2
var=22
gosub switchoutput

pin=3
var=23
gosub switchoutput

pin=4
var=24
gosub switchoutput

pin=5
var=25
gosub switchoutput

pin=6
var=26
gosub switchoutput

pin=7
var=27
gosub switchoutput

pause 500

'Save status every ~1min
b10 = b10 + 1
if b10 = 250 then
GOSUB saveeeprom
b10 = 0
endif

loop



switchoutput:
'Read 20(var pos) and 1 (pin number) from shared vars
SEROUT 0, t1200, ("!AT0R",#var)
SERIN [1000,timedout1],0, t1200, #b0
timedout1:
SEROUT 0, t1200, ("!AT0R",#var)
SERIN [1000,timedout2],0, t1200, #b1
timedout2:
SEROUT 0, t1200, ("!AT0R",#var)
SERIN [1000,timedout3],0, t1200, #b2

if b0 = b1 and b1 = b2 then
'sertxd ("Switching ",#pin," ",#var," to ",#b0,cr,lf)

if b0 = 0 then
if pin = 0 then
low portc 7
else
low pin
endif
endif

if b0 = 1 then
if pin = 0 then
high portc 7
else
high pin
endif
endif

if b0 = 2 then
if pin = 0 then
low portc 7
else
low pin
endif
pause 10000 '5sec at 8mhz
if pin = 0 then
high portc 7
else
high pin
endif
serout 0, t1200, ("!AT0W",#var,":","1", CR) 'Set status back to 1
endif
endif

timedout3:
RETURN


saveeeprom:
'Save to eeprom
for temp=20 to 27
temp3 = temp + 60
read temp3,temp2

SEROUT 0, t1200, ("!AT0R",#temp)
SERIN [1000,ttimedout1],0, t1200, #b0
ttimedout1:
SEROUT 0, t1200, ("!AT0R",#temp)
SERIN [1000,ttimedout2],0, t1200, #b1
ttimedout2:
SEROUT 0, t1200, ("!AT0R",#temp)
SERIN [1000,skipsave],0, t1200, #b2


if b0 = b1 and b1 = b2 then
if b0 = 2 then 'Dont save while cycling
goto skipsave
endif

if temp2 != b0 then
write temp3,b0
endif
endif
skipsave:
next
RETURN
 
Last edited:

tmack

Member
Im sorry to be so dumb but what do I do with that now? Thanks alot for the help . Does it turn one relay on and off?
 

tmack

Member
Cool, Im not sure how to update the pages on it but I should be able to figure it out. I really appreciate the help with this Mora. I dont know why this eludes me I'm missing a step in my understanding somewhere with this . Being able to get something working should do alot to help me figure out what I want to on it so thanks.
 

MORA99

Senior Member
If you search the forum theres a few old topics about it.

But you need the software from the cd (or the website), then click find, and you can then upload new webfiles.

index.htm will be showed as default, if you name them something else you have to write that in the url too.
 

steliosm

Senior Member
mccormack, I can put up some stuff to help you out but in a few hours since it's already past my bed time (its 4:25 in the morning here).
 

steliosm

Senior Member
mccormack, you need to create the new HTML pages and update the SimpleLan. In those pages you can create the buttons you need to control stuff. When an action happens you can save a value in the module's register which you can afterwards read with PicAxe. You need to have a X1 part since the timeouts in the serin command will be very helpfull.

You also need to remember that when an updates happens in the SimpleLan (eg. button pressed) the SimpleLan will update a specific register which you can check. So, you need to have a loop in you code to check this register every few seconds. For example:

check_updates:
' Make a small pause for the loop
pause 1000
' Send out the command for the status register
hserout 0, ("!AT0ST")
' Get a reply back and store it in the scratchpad RAM at location 100
hserin [1000, check_updates],100,1
' Read the value from location scratchpad RAM location 100
ptr = 100
let b1 = @ptr
' Check the bit9 to see if an update happend
if bit9 = 1 then
gosub web_update
endif

When an update happens, bit9 will be '1'. After that, you need to go through all the register you are using in your HTML page for storing data for the buttons and check their values for any changes.

web_update:
' Check all the registers (5,6,7,8). These register can have up to 16bytes of data
hserout 0,("!AT0R05")
hserin [1000, check_updates],1,16
hserout 0,("!AT0R06")
hserin [1000, check_updates],17,16
hserout 0,("!AT0R07")
hserin [1000, check_updates],33,16
hserout 0,("!AT0R08")
hserin [1000, check_updates],49,16
gosub check_values
return

check_values:
' Start reading the values from the Scratchpad RAM
' and set the Pins accordingly
return


This is the basic idea in order to receive feedback from the SimpleLan, Certainly not as simple as updating the module with your data (e.g. temperature). I hope I helped you a bit.
 

tmack

Member
ARG., Now I cant log in to my simple lan. I don't remember setting a password before but I must have done it. Of course I can't figure out how to reset it either. Has anyone Used a picaxe to reset their simple lan? I tried sending this from an 08 to a simple lan just as a test to try and change the Ip but it didnt work:

pause 5000
SEROUT 0,t2400,("!ATOCIP:192.168.1.104",CR)
 
Last edited:

steliosm

Senior Member
This is in the Datasheet:

9. Recovery
If the Username and Password are lost or forgotten, the recovery.bs2 BASIC Stamp file is
provided under &#8220;C:\Program Files\Avcom TEC, LLC\SimpleLan\Recovery\&#8221;. Running
this file will reset all the network connection settings and the Username and Password to
the original default settings.
The network connection must be unplugged while this file is run. A debug prompt will
display "Configuration has finished" when the file is done running. The file should be
edited to match your BASIC Stamp module (Stamp directive and pin and baud rate for
SEROUT). After the recovery file has been run, another BASIC Stamp file should be
loaded into the Stamp module before resetting the power.


You could see what is the data that you have to sent to simplelan to reset it.
 
Last edited:

tmack

Member
Ive been trying that but cant seem to get it to work.

I dug out an old BS2 put the code in from there ,changed it from bs2p heading to bs2, connected it to my simple lan, unplugged it from my network and wah lah ....Nothing changed. I tried it several times with no luck. Has anyone ever rest theirs. I know noone is probly dumb enough to lose their password except me.....
 
Last edited:

steliosm

Senior Member
Are you sure you are following the directions carefully?
The Datasheet says tha you have to load the file in your BS connect it with SimpleLan and after the message load another file in the BS before power cycling the SimpleLan.
 

lbenson

Senior Member
I had circumstances where the SimpleLan PC software couldn't find the SimpleLan device through my router--I had to connect it directly to the laptop with a crossover cable (and change lan adapter IP settings). How do you have it connected? Does the software find the SimpleLan?
 

tmack

Member
"Are you sure you are following the directions carefully?
The Datasheet says tha you have to load the file in your BS connect it with SimpleLan and after the message load another file in the BS before power cycling the SimpleLan." Hmmm
I havent done the "load another file" part.

So:
connect BS2 to simple lan properly
disconnect my network cable
I load the code in the BS2 thats mentioned in the manual
connect it to the simple lan
after I get the message back
load just any old program into the bs2???
power cycle the simple lan?

If that seems to be the case Ill try it when I get home. Thanks ALOT
 

tmack

Member
BACK ON TRACK. Got my new simple lan so I think Im back on track. Mora, for the simple lan itself, All I have to do is load the code you wrote into it?
 

MORA99

Senior Member
yes the html code should be saved in a file called rrlay.html and sent to simplelan
you should then be able to see a small table on http://ip/rrlay.html

I didnt use index.html to make at least some security
 

tmack

Member
I finally made time to finish this and I am having some problems. I took the HTML code and saved it as rrlay.html. I then loaded that into my Simple Lan . I pulled up the IP /rrlay.html and all I have is a mess. It looks like the back color is as it should be but 1/2 of my code is also there in the document when I pull it up on my simplelan. Any ideas what I am doing wrong?
 

tmack

Member
Actually, I figured that part out. I Looked at the code carefully. Some spots had the URL as "HTML " some had "HTM". I just made it all match and saved it that way. That part seems to be working now. (I used HTM). I can't get the picaxe side working now. I think that it may be because I am using a 28x protoboard. The output is going through a ULN2803A So Its not going to be serial.I think I have to solder it in between the 28x1 and the 2803 and then I will get serial data out(I think).I have the rest of the output pins going into a little LED board that I made . I tested it and it works so the only thing I can think of ,is that the Simple Lan wont send out the data to my 28x1 to make the leds light if the 28x1 isn't sending it anything because its not attached to the correct place. Does that make sense? I also see that I accidentally sent 5V to the P8 of the simepl Lan. Anyone know If that will wreck anything on it? Thanks for any help.
Couple bonus questions:
Does it matter that I'm using a breadboard ?(I don't think so)
Does it matter to the rs232 signal that on the protoboard the input is going through a 10K resistor ?( I think so)
thanks!
 
Last edited:
Top