Shop OBEX P1 Docs P2 Docs Learn Events
VERY USEFUL new addition for the Spinneret and WebServer_W5100 — Parallax Forums

VERY USEFUL new addition for the Spinneret and WebServer_W5100

WildatheartWildatheart Posts: 195
edited 2013-02-09 17:01 in Accessories
With a bit of imagination and a little hardware, doggiedoc can now give us a way to tip the feed bowl, or turn the feed screw that feeds his chickens via the internet. Can you imagine how plump those 'lil suckers are going to be?

The real reason for this thread is to draw attention to Mike's recent work that offers pin-state switching on the Spinneret board running WebServer_W5100. Currently this gem is buried in a thread that may go unnoticed.

EDIT: Working example - see post 18

Comments

  • Ken GraceyKen Gracey Posts: 7,387
    edited 2013-01-30 09:37
    Thank you Wildatheart for bringing this detail to the surface, and for recognizing the importance of MikeG's contribution to the WizNet tools we make. Mike has invested a huge effort into producing a quality source code base. And to see people like doggiedoc running using it for such practical applications as the chicken coop shows that it's universally useful.
  • doggiedocdoggiedoc Posts: 2,239
    edited 2013-01-30 09:44
    I can second that applause! Mike has been pivotal in my successes thus far. I'm learning more every day.

    Paul
  • Mike GMike G Posts: 2,702
    edited 2013-01-30 10:31
    All, thanks for the kind words.

    Wildatheart, back link JavaScript snippet. I'd use a regular old anchor tag though.
    <input type="button" value="Close Window" onclick="window.history.back()">
    or
    <input type="button" value="Close Window" onclick="window.history.back(-1)">
    

    doggiedoc, I'm working on an update for you which is related to the stuff Wildatheart is taking about. It will make the Coop Code a bit more robust and extensible.
  • WildatheartWildatheart Posts: 195
    edited 2013-01-30 11:16
    Thanks again, Mike. Now I can either close the Window or close the website. There seems to be no bottom of your goodie bag.

    If the folks risk trying the now VERY EASY to use Spinneret, and if Parallax can keep enough of 'em on hand, I think we'll begin to see some interesting applications.
  • WildatheartWildatheart Posts: 195
    edited 2013-01-30 12:49
    Okay... I can see a potential security problem at the coup. You guys have been hitting my site pretty hard this morning - you dump a bit and then run off without turning off the LED. But that's expected cuz you can't see the LED. Now, what if the doc rigs this up to his chicken coup... Understand where I headed with a security issue here? I'm wondering what it'll take to get real time video feedback. If that's not possible, the doc might have to wire up a timer to close the coup door again.
  • doggiedocdoggiedoc Posts: 2,239
    edited 2013-01-30 13:22
    Oh I'm pretty sure I'll let the other Propeller automate that process. No real need to open and close it manually. Now ventilation, that's another story. :D
  • WildatheartWildatheart Posts: 195
    edited 2013-02-01 19:38
    Mike, after reviewing the W5100 datasheet, I'm thinking that it takes 4 separately sent instructions to set the state of the 4 user pins. If that's the case, how fast could 4 programmatically generated instructions be sent, and would all 4 transmissions arrive in the same time interval as the total transmission rate interval? I'm hinting at extracting 16 channels out of the 4 - perhaps 32 channels if pin 23 could be tapped.

    For fun I added some sample javascript to display a numeric keypad. Although its functional as a keypad, it isn't yet operational with your work. Hopefully I'll be able to touch-enter the pin number and then touch "pin" (same for the pin-state), and then touch submit. The purpose for the addition is to enter data quickly from a cell phone or touch screen.

    After a couple of days experience with pin.htm, it continues to work flawlessly.
  • doggiedocdoggiedoc Posts: 2,239
    edited 2013-02-02 04:20
    Mike G wrote: »
    doggiedoc, I'm working on an update for you which is related to the stuff Wildatheart is taking about. It will make the Coop Code a bit more robust and extensible.
    Awesome! I'm very pleased with the new code base! The coop page seems very robust now!
  • Mike GMike G Posts: 2,702
    edited 2013-02-02 06:27
    Mike, after reviewing the W5100 datasheet, I'm thinking that it takes 4 separately sent instructions to set the state of the 4 user pins. If that's the case, how fast could 4 programmatically generated instructions be sent, and would all 4 transmissions arrive in the same time interval as the total transmission rate interval? I'm hinting at extracting 16 channels out of the 4 - perhaps 32 channels if pin 23 could be tapped.
    I'm not totally following... You can send whatever instruction you like to the Spinneret and have the Spinneret do whatever you like in one request - if you like. The format of the command is completely up to you.

    For example, the changes to WebServer_W5100 affect a single pin because that was your requirement. Packing 4 pin addresses and 4 states into the same XML wrapper is no problem. However, this changes the original requirement and therefore the logic on the Spinneret must change as well. Instead of dira[pin] := x use a range expression dira[23...27] := %11111, see page 105 in the Propeller manual.

    The speed of successive commands is the larger of user's button click speed or the 1ms resolution of the SetInterval() command.

    Concurrent requests require multiple clients. A single client can send one request after another but it cannot send parallel requests. The packets may or may not arrive at the same time or in a different order than originally sent.
  • WildatheartWildatheart Posts: 195
    edited 2013-02-02 10:45
    The ability to set the state of an LED via the internet has intrigued me since first reading your tutorial a long time ago. Recently, when I discussed the desire to do the same with your new WebServer_W5100, you quickly responded with the very user friendly pin.htm.

    Any remarks I may have posted regarding pin-state control were intended to reference your discussion of led.htm for WebServer_W5100. With that now resolved, and thinking about the 4 user pins available, it occurs to me to attach a 4 to 16 bit decoder (74154-style IC) to the 4 user pins for expansion to give us 16 user pins. Your online and running example led me to believe that 4 separate sets of instruction needed to be transmitted to set the state of the 4 user pins.

    You’ve gone the extra mile to give us pin.htm, so I’m not asking for more – I just thought I’d be advantageous to set the state of ALL 4 user pins at the same (or nearly the same) time.
  • Mike GMike G Posts: 2,702
    edited 2013-02-02 11:15
    You’ve gone the extra mile to give us pin.htm, so I’m not asking for more – I just thought I’d be advantageous to set the state of ALL 4 user pins at the same (or nearly the same) time.
    [Scrathing my head] But I gave you the answer in post 10...???

    I'm a teach a man to fish kinda' guy. I'd rather present concepts with light examples so folks are armed with the knowledge to make their own way. I tried to point you to the LED answer but that didn't work to well. By giving you pin.htm, I did you a great disservice, but I was hoping to trigger your learning process. Trust me, I'm not the sharpest tool in the shed - ask my wife. The knowledge I bring to the Spinneret comes from 15+ years of mistakes (experience). And, It takes me a long time to learn stuff, it always has. However, I have a strong desire to know stuff. I spend a lot of time figuring stuff out and experimenting.

    I promise if you reread post 10 and give it a shot on your own and still can't figure out how to solve the problem, I'll give you the solution.
  • WildatheartWildatheart Posts: 195
    edited 2013-02-02 12:19
    We're on the same page when it comes to learning, Mike. To prove it, I managed to get google earth to load, open at a specific point, set a functional drag and drop pin, and display the lat and long after the pin is moved - a major accomplishment for me! So I do understand the value of spending a lot of time experimenting and figuring things out. Sure, I'll spend some time with the details in post 10 - didn't mean to give the impression otherwise.
  • Mike GMike G Posts: 2,702
    edited 2013-02-02 14:26
    I built the thing and well I guess I should share. Get the latest WebServer_5100.spin and the attached HTML file. Just unzip and drop the epin.htm file on the SD card.
    600 x 977 - 64K
  • WildatheartWildatheart Posts: 195
    edited 2013-02-02 18:25
    I can't resist a challenge... so I wired 4 leds to the Spinneret board this afternoon and found the necessary section of code in Webserver_5100. I've been giving it the good 'ole college try but haven't arrived yet. Just now noticed epin.. back shortly.
  • WildatheartWildatheart Posts: 195
    edited 2013-02-02 19:33
    WOW! If the application and project guys miss this one they're missing a heck of a powerful tool for their goodie bag. With this I'll get a few extra hours of sleep tonight and be alert for the game tomorrow. I owe you a good project that I'll list in the projects forum soon. The new WebServer_5100, W5100, and epin.htm work perfectly.

    Thanks again, Mike.
  • Mike GMike G Posts: 2,702
    edited 2013-02-03 05:33
    Small Update: Added direction register (DIR) to the XML document and web page.

    The examples in this thread highlights exactly how I always intended the Spinneret to function, as a light weight XML service. I never intended to serve up web pages with graphics and cool CSS.

    For a moment, think about the concept of separation of data from user interface using light weight XML services over the well established HTTP protocol. The Spinneret's only job in life is to read/write state; sensor reading or in this case Propeller PIN state. The state information is received in easy to consume XML and send via HTTP. What that does for ya, is allow developers to communicate with the XML services in a variety of client applications. The client app could be something written in C, .NET, Java... Since, HTTP is not platform specific, it will work on any OS.

    The example in this thread uses a web page as the client application. JavaScript handles the XML service and updates the page. It just happens the web page came from the Spinneret SD card. The client application could exist anywhere on any server or desktop that has access to the Spinneret XML services.

    This concept creates a distinct separation between data and user interface. Writing Spinneret applications in this style produces extensible reusable code. That's my 2 cents...
  • Mike GMike G Posts: 2,702
    edited 2013-02-03 06:01
    I'll leave the site up for a while so folks can play around.
    http://spinneret.servebeer.com:8080/epin.htm
  • WildatheartWildatheart Posts: 195
    edited 2013-02-03 07:08
    If P24 - P27 are bidirectional I/O, and if I apply 3.3vdc to P25 through a 470 ohms resistor, and if I submit -1 Read Value Only, should I be expected to read the then current state of the 4 pins or is the read value that's returned the last pin-state submitted?
  • WildatheartWildatheart Posts: 195
    edited 2013-02-03 07:31
    All's fine. Did away with the resistor. 16 channels in - 16 channels out!
  • Mike GMike G Posts: 2,702
    edited 2013-02-03 07:41
    If P24 - P27 are bidirectional I/O, and if I apply 3.3vdc to P25 through a 470 ohms resistor, and if I submit -1 Read Value Only, should I be expected to read the then current state of the 4 pins or is the read value that's returned the last pin-state submitted?
    The open source spin code reads the DIRA, INA, and OUTA registers to populate the XML response. The DIRA[n] is set to an output when setting the PIN(s) High/Low. In this demo, the DIRA register is read only and controlled by the spin code. If you require control over the DIRA register, then you'll have to add the logic.

    I updated the web page attached to post #14. IE had a problem with the JavaScript.
  • Mike GMike G Posts: 2,702
    edited 2013-02-03 08:15
    Darn, I fixed IE then busted FIrefox where you could no longer view the XML response. The HTML is updated once again and attached to post #14. Browsers.... eh
  • WildatheartWildatheart Posts: 195
    edited 2013-02-06 17:52
    Please see "DIY Web enabled PLC" in the Projects forum for a working example of WebServer_W5100 + epin + Parallax Digital I/O board.

    Thanks for all the help, Mike.
  • doggiedocdoggiedoc Posts: 2,239
    edited 2013-02-09 17:01
    Please see "DIY Web enabled PLC" in the Projects forum for a working example of WebServer_W5100 + epin + Parallax Digital I/O board.

    Thanks for all the help, Mike.

    Here is link. :D
Sign In or Register to comment.