Shop OBEX P1 Docs P2 Docs Learn Events
Web interface — Parallax Forums

Web interface

FORDFORD Posts: 221
edited 2012-10-30 12:42 in General Discussion
Hi All,
As a bit of a newbie with web stuff, I was looking for suggestions for the simplest, cheapest and easiest to understand serial to ethernet web interfacing devices.

If anyone has any suggestions for some devices it would be very much appreciated,

Cheers,
Chris

Comments

  • max72max72 Posts: 1,155
    edited 2012-10-24 06:19
    I have a couple of roving networks RN-XV modules. They are WiFi to serial. X-bee footprint.
    So you need an extra configuration step to configure the wireless network (it starts with a default ad hoc setting).
    You can use the serial to WiFi module in place of the serial cable, with a telnet client ( I tested it and it is very easy to use).
    Otherwise you have a TCP/IP stack, so you should be able to process an html request simply parsing the strings with the serial port (I didn't test it yet, but by mistake a sent a web page request and the propeller received the data, so it looks promising).

    Massimo
  • stamptrolstamptrol Posts: 1,731
    edited 2012-10-24 06:44
    The PINK module from Netburner is an easy, well documented way to get microcontroller stuff to and from the web.

    The Lantronix XPORT is another possibility but I haven't used it myself.

    Cheers,
  • FORDFORD Posts: 221
    edited 2012-10-24 16:38
    Thanks for the suggestions,

    Will get moving with the Pink one I think,

    cheers,
    Chris
  • xanatosxanatos Posts: 1,120
    edited 2012-10-24 18:38
    The PINK firmware for the Netburner SB-70s works very well - I've used many of them myself and I have a lot of code if you have any issues. There is also some very specific firmware updating you'll want to do, but once it's done, you have a great number of variables that are web-accessible, and plenty of room to flash some fairly complex web stuff, complete with CSS, I-Frames and JavaScript that can give you a genuine "Application" feel if you want. They're great little devices. Give me a shout if you want any goodies for your interface when you're ready.

    Those roving networks RN-XV modules sound VERY interesting as well... going to go look those up now!

    Dave
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-10-25 08:06
    FORD wrote: »
    Hi All,
    As a bit of a newbie with web stuff, I was looking for suggestions for the simplest, cheapest and easiest to understand serial to ethernet web interfacing devices.

    If anyone has any suggestions for some devices it would be very much appreciated,

    Cheers,
    Chris
    If you want a compact solution (elongated RJ45 socket) that just works then go for the XPORT module. if you get them from the right place they are around $60 or so. I've been using them for years although lately I am considering other solutions but only because I need to support FTP from the Prop as well.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2012-10-25 16:31
    @xanatos, Could I possibly get some of that code you have? I just received my PINK today and want to test out various applications with it. My thoughts are home automation to start with and possibly some other remote internet projects.
  • xanatosxanatos Posts: 1,120
    edited 2012-10-25 19:23
    I'll send the code along hopefully by Monday (my daughter is getting married tomorrow!)

    Best,

    Dave
  • NWCCTVNWCCTV Posts: 3,629
    edited 2012-10-25 19:37
    Sounds good and congrats to your daughter. Next comes grandkids which, if you do not already have are a real blessing!!!
  • xanatosxanatos Posts: 1,120
    edited 2012-10-29 14:13
    Hi there,

    Things are returning a bit to normal, so I'm going to send along some of teh code as I find it. One of the cooler things I did with the PINK was to be able to use a web-interface to set the clock chip I use (a DS1302). The web interface writes to the NB Vars, and then I have a subroutine which reads those vars and writes the values to the DS1302. Here is the subroutine to do this:
    Set_Time:                               ' DS1302 Burst Write
    
      SEROUT TX, Baud, ["!NB0R61"]
      SERIN  RX, Baud, 100, Timeout, [HEX2 year]
      PAUSE 2
      SEROUT TX, Baud, ["!NB0R62"]
      SERIN  RX, Baud, 100, Timeout, [HEX2 month]
      PAUSE 2
      SEROUT TX, Baud, ["!NB0R63"]
      SERIN  RX, Baud, 100, Timeout, [HEX2 date]
      PAUSE 2
      SEROUT TX, Baud, ["!NB0R64"]
      SERIN  RX, Baud, 100, Timeout, [DEC1 day]
      PAUSE 2
      SEROUT TX, Baud, ["!NB0R65"]
      SERIN  RX, Baud, 100, Timeout, [HEX2 hrs]
      PAUSE 2
      SEROUT TX, Baud, ["!NB0R66"]
      SERIN  RX, Baud, 100, Timeout, [HEX2 mins]
      PAUSE 2
      SEROUT TX, Baud, ["!NB0R67"]
      SERIN  RX, Baud, 100, Timeout, [HEX2 secs]
      PAUSE 2
    
    
      HIGH CS1302                           ' Select DS1302
      SHIFTOUT DataIO, Clock, LSBFIRST, [WrBurst]
      SHIFTOUT DataIO, Clock, LSBFIRST, [secs, mins, hrs, date, month, day, year, 0]
      LOW CS1302                            ' Deselect DS1302
      RETURN
    
    
    Timeout:
      DEBUG "Server busy, Stand by...", CR   ' Serial Timeout - usually when server is being written to from web page.
      PAUSE 1000
      GOTO ResumeMain
    
    
    

    The beauty of the PINK is that it uses EVERYTHING that runs client-side on a user's browser, so HTML and CSS for really nice formatting, graphics (with somewhat of a limit due to space on the PINK), and JavaScript all do their usual thing, so function and look & feel can all be made really, really nice. Getting data from a web page form to the NB Vars is simplicity itself - basically just naming the form's inputs as the var number you want to stuff the data into.

    But with the Time-Setting routine I made for the PINK/DS1302, I went one step further by using JavaScript to obtain the computer's time and set those variables to teh proper values in the PINK.

    Here's the JavaScript I used for that:
    <SCRIPT LANGUAGE="JavaScript">
    function check(myForm) {
    
    	var dt=new Date(); 
    	var dy, mn, yr, hr, ms, date;
    	
    	dy=dt.getDate();
    	da=dt.getDay();
    	mn=dt.getMonth();
    	yr=dt.getFullYear();
    	hr=dt.getHours();
    	ms=dt.getMinutes();
    	sc=dt.getSeconds();
    	mn = mn + 1	
    	
    	yr = yr - 2000;
    	if (yr < 10) {yr = "0" + yr;}
    	
    	sc = sc + 6 // Fudge factor - accounts for time set delay as long as sync isn't pushed less than 7 secs before :59 
    	if (sc > 59) {sc = 59}
    	
    	//secs, mins, hrs, date, month, day, year
    	document.setForm.Nb_var33.value = 1;
    	document.setForm.Nb_var34.value = 99;
    		
    	document.setForm.Nb_var61.value = yr; <!-- Set Year -->
    	document.setForm.Nb_var62.value = mn; <!-- Set Month -->
    	document.setForm.Nb_var63.value = dy; <!-- Set Date -->
    	document.setForm.Nb_var64.value = da; <!-- Set Day num -->
    	document.setForm.Nb_var65.value = hr; <!-- Set Hour -->
    	document.setForm.Nb_var66.value = ms; <!-- Set Min -->
    	document.setForm.Nb_var67.value = sc; <!-- Set Secs -->
    	
    	return false;
    }
    	
    
    </SCRIPT>
    
    
    

    Of course the form in my HTML code is named setForm:

    [html]

    <FORM ACTION="#" NAME="setForm" METHOD="post">

    <INPUT TYPE="hidden" NAME="Nb_var33" MAXLENGTH=1> <!-- Data Change Flag -->
    <INPUT TYPE="hidden" NAME="Nb_var34" MAXLENGTH=12> <!-- Space to be activated (99 if time set)-->
    <INPUT TYPE="hidden" NAME="Nb_var61" MAXLENGTH=12> <!-- Start Year -->
    <INPUT TYPE="hidden" NAME="Nb_var62" MAXLENGTH=12> <!-- Start Month -->
    <INPUT TYPE="hidden" NAME="Nb_var63" MAXLENGTH=12> <!-- Start Date -->
    <INPUT TYPE="hidden" NAME="Nb_var64" MAXLENGTH=12> <!-- Start Day -->
    <INPUT TYPE="hidden" NAME="Nb_var65" MAXLENGTH=12> <!-- Start Hours -->
    <INPUT TYPE="hidden" NAME="Nb_var66" MAXLENGTH=12> <!-- Start Minutes -->
    <INPUT TYPE="hidden" NAME="Nb_var67" MAXLENGTH=12> <!-- Start Seconds -->

    <INPUT TYPE="submit" NAME="submit" VALUE="Synchronize Clock" onClick="check(this.form)">
    </FORM>

    [/html]

    And you'll note that I set var33 and 34 - those are the bits I designated to tell the Basic Stamp that there are new values available to be read. The stamp program continually checks for those bits to determine if it really needs to read anything, or just keep doing the other stuff I have it doing. Only if it sees a "1" on var33 does it take action on the values. This saves a lot of time and allows me to have the stamp doing a lot of other stuff.

    So these should give you a lot of goodies to work with. What I've given you here covers just about every aspect of getting data into and out of a PINK, between a computer and a Stamp. They are immensely cool little items.

    You'll have to carefully read the setup instructions on your PINK software for setting the IP address, etc. But once you have the firmware set up properly you should be able to start playing pretty quickly. Be sure to use a CROSSOVER cable if you're going directly from PC to PINK; use a regular cat5 cable if you're putting your PINK on your LAN.

    Let me know if you have any questions... happy PINKing!

    Dave
  • xanatosxanatos Posts: 1,120
    edited 2012-10-30 11:09
    NWCCTV wrote: »
    @xanatos, Could I possibly get some of that code you have? I just received my PINK today and want to test out various applications with it. My thoughts are home automation to start with and possibly some other remote internet projects.

    I also just discovered a plethora of my initial development files... let me know when you're done digesting the code above if you need more... :-)

    Dave
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-10-30 11:14
    You might regret just getting the simplest. Parallax's Spinnerette is a very good value at $60. You may quickly regret not having the extra stuff it offers.
  • xanatosxanatos Posts: 1,120
    edited 2012-10-30 11:21
    Hi Loopy - you may have a good point there. I just haven't yet used the Spinnerette, and NWCCTV specifically said he (?) was going forward with the PINK... but I myself want to check out the Spinnerette - can you off the top of your head give me an idea of what the Spinnerette offers that the PINK doesn't? Other than the simple coolness of it being propeller powered... :-)

    Dave
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-10-30 11:52
    For starters, the Spinnerette includes a Real Time Clock, then there is a microSDcard slot. There are also some general purpose pins that can be used for RS232 stuff or other low level control.

    And the kicker is that PropForth has gotten a rather complete tutorial to use it as well.

    So rather than just use a device to hook up the LAN to a serial port, you actually can have other things happen - like web pages, or data recording. or whatever. It will likely be the next thing I will purchase from Parallax as the value is just too good to pass up.
  • xanatosxanatos Posts: 1,120
    edited 2012-10-30 12:42
    That does sound good! The PINK can do web pages just fine, but the SD card is a big plus - and gpio is fantastic. So that's going onto my next purchase list as well. I have several products in the field using the PINK, all of which could probably be upgraded in interesting ways with the Spinnerette.

    Thanks Loopy!

    Dave
Sign In or Register to comment.