Shop OBEX P1 Docs P2 Docs Learn Events
Some basic questions on the Spinneret — Parallax Forums

Some basic questions on the Spinneret

T ChapT Chap Posts: 4,223
edited 2011-12-26 12:17 in Accessories
I need to add ethernet/LAN connedtivity to one or more Prop based systems. The idea is to do something similar to what I can do with RS485 or with a Wifly (wifi/uart) interface. With RS485, I can daisy chain numerous systems together, assign an ID to each, and communicate to any or all devices from a master device. In this configuration, all devices can only respond to a request from the master. In the case of the Wifly wifi device, it gets set up with it's own IP, it can autoconnect to the LAN after setting its parameters, and it connects to the Prop device via UART. What I am looking to do is come up with an optional ethernet based method to connect one or more Prop devices, so that on the LAN, a device can be connected to a router and communicated with from a master device on the LAN.

What I would like to find out is, can I connect the Spinneret with a simple rx/tx connection to main Prop, so that the Spinneret can be configured by the main Prop device. The most basic thing to configure in the Spinneret from the main Prop device would be the IP that the Spinneret uses on the LAN. The main Prop can tell the Spinneret to use IP 192.168.1.1 for example. Then when the Spinneret appears on the LAN, any other device can send a packet to the device, the Spinneret sends the packet to the main Prop, which parses the packet, performs checksum, acts on the Opcode etc. There is no memory left to add code for an onboard Wiznet add on, there are only 2 pins available for rx/tx, so an external option is required.

I will order one of these and test it out, but was hoping someone could confirm that it will accomplish the goal which is to replicate the RS485 and Wifly.

Thanks, for any comments.

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-12-20 05:36
    What I would like to find out is, can I connect the Spinneret with a simple rx/tx connection to main Prop, so that the Spinneret can be configured by the main Prop device.
    Yes, with any of the serial port objects.
    There is no memory left to add code for an onboard Wiznet add on, there are only 2 pins available for rx/tx, so an external option is required.
    I disagree, a basic TCP device takes less than 2,500 longs of memory. That include the W5100 driver, serial port driver, and logic for 4 concurrent port requests.
  • T ChapT Chap Posts: 4,223
    edited 2011-12-20 06:30
    Mike, to clarify, on my main Prop board, there is no memory left to add anymore software to directly talk to the Wiznet. So the ethernet connection has to be with a second device(Spinneret). I was hoping to use my existing code to parse a packet on the main board, so just substitute the Spinneret for the RS485 chip so to speak. The idea being to make the Spinneret become a UART device that the main board talks to.
  • T ChapT Chap Posts: 4,223
    edited 2011-12-25 12:43
    I have read over most of the material on the google link, including the Httpserver. Thanks to you guys for making this project happen! The servebeer examples are great for getting started. On the Wifly wifi module connected to a Prop, I can connect to it with an application on the LAN, and send raw data to it, the Wifly will accept ascii or hex input, and send the packet to the Prop. I would like to be able to send raw data to the Spinneret also after connection is made, have the Prop parse the packet, do a checksum, respond with an ACK, then close the connection. Is there some method already in the indirect or httpserver that would allow this type of non html operation? Secondly, in a case like the door unlocking thread, what would be a good method to secure the device from unwanted users? I am sure there are different levels of security, but I am speaking of something simple, like password access per connection. Thanks
  • Mike GMike G Posts: 2,702
    edited 2011-12-25 16:57
    HTTPServer is a web server and it uses the HTTP protocol to process HTTP transactions. Therefore, as stated in the tutorial, the server parses an HTTP request and returns an HTTP response. This makes it real easy to use a standard web browser.

    There's no reason to use HTTP for your project. You could go with basic socket programming; open a socket, send some data, process the data, and send a response. Everything you need is in the HTTPServer or the Indirect driver. Essentially, just remove all the HTTP protocol stuff. It's similar to processing buffered serial data. You will have to find a way to get the packets to the server - custom client code.
  • T ChapT Chap Posts: 4,223
    edited 2011-12-25 19:11
    Thanks Mike for the help. Sounds good.
  • Mike GMike G Posts: 2,702
    edited 2011-12-25 19:30
    If I get a chance, I'll wire up a simple socket example.

    Don't hold me to it... Kinda' have a few irons in the fire right now.
  • Mike GMike G Posts: 2,702
    edited 2011-12-26 06:23
    Attached is a basic TCP socket programming example using the minimal HTTPServerBase and a client console application, Program.cs, written in C#.
  • T ChapT Chap Posts: 4,223
    edited 2011-12-26 07:52
    Mike that is awesome of you to post that, many thanks. I will dive into this later today.
  • T ChapT Chap Posts: 4,223
    edited 2011-12-26 12:17
    Mike, I will have a Spinneret in a few days, I forgot to mention that I don't have one yet to test.

    I have a gadget that already has code to parse RS485 packets. I am adding the Wifly wifi module and Spinneret to allow ethernet and wifi access, which will use the same packet parsing protocol once the data is in the Prop. The Spinneret and Wifly will operate either as an HTTP server, or as simple connection between devices on the local network that can send packets between each other via TCP/IP. I like your code that will allow the variables to be sent to the server from a remote PC in the /00/00/00/00/00/00 manner, this will work great for the server mode.

    Here is a video that shows the concept of non-server type use of wifi, when I get the Spinneret the ethernet option will be just one of 3 methods to send packets or allow access remotely via HTTP. I'll post a demo of the Spinneret also when it is running.

    https://www.youtube.com/watch?v=sSMNqzlnagk
Sign In or Register to comment.