Shop OBEX P1 Docs P2 Docs Learn Events
Prop and WiFly Radio — Parallax Forums

Prop and WiFly Radio

T ChapT Chap Posts: 4,223
edited 2011-06-30 19:48 in Propeller 1
I have made some progress sorting out the WiFly GSX wifi radio over the weekend. I created an app to program the module over a local connection via TCP on a mac or pc. The module can also be be programmed via UART from the Prop or over TCP. There are a lot of things to learn still but I thought I would post some beginning stages progress since this seems like a very useful gadget that others might enjoy.

I have the module able to go to my website and read test.html file. The module will send or get data using a number of methods, including timers and UART control. It will allow the Prop to just send it data and have the data get sent to a destination as it arrives in user defined packet sizes. The new firmware allows putting files via FTP or getting FTP files.

I got the RN134 module which is a breakout board with easy connections for Tx/Rx and Rs232. I use only the Tx/Rx connected directly to the Prop. It does have 10 general purpose i/o's and 8 sensor inputs, all inputs can be configured to forward data over TCP.

I have connected the module to a router over WEP128 using a key. The hard part is figuring out what mode to use the radio in since there are several modes depending on your goals, then sorting out how to communicate with HTTP/php to the remote servers.

The module just sends whatever it receives from TCP straight to the Prop and the Prop can send it data and it will send it back out. I am told that php is the way to go for real time bi directional communication between a remote computer and the wifi radio>Prop.

The Wifly controller app is in Realbasic and cross platform. If anyone is interested I can post the RB files and application. Soon the the app will store pre-programmed setups for different configurations.
896 x 835 - 98K
325 x 478 - 32K

Comments

  • Heater.Heater. Posts: 21,230
    edited 2011-06-27 04:35
    T Chap,

    So how is this project going?

    I just stumbled here whilst googling for "wifly propeller". I'm surprised that there only one such thread and that there is no discussion going on because it sounds like a fun project.

    I'd also be interested in getting a Prop with wifly talking to my Android devices.
  • RS_JimRS_Jim Posts: 1,768
    edited 2011-06-27 05:23
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-06-27 22:41
    I am also interested in being able to send data from a prop over WiFi to an android or iPad device and then display it there. Not much free time tho :(
  • DonEduardoDonEduardo Posts: 54
    edited 2011-06-30 15:34
    I got my Android phone talking to the WiFly module to control my sprinklers. Works great when I'm out fixing the sprinkler heads and can remotely turn on/off the sprinklers and fix them right on the spot. The WiFly connects to a Prop via a simple serial connection. I had a circuit board made (my first one) that has the Prop, associated components, a prototyping area, and a pad layout that allows a dead-bug type installation of the WiFly module.

    The serial connection to the Prop shouldn't be a problem for most on this forum, so I guess the Java code on the Android would be the difficulty. It basically just opens a TCP socket with the WiFly module. I'll see if I can dig up the source code and upload.
  • tonyp12tonyp12 Posts: 1,951
    edited 2011-06-30 19:48
    I wrote a simple tcp server in C# that the Wifly talks to.
    it uses port 3000 but you can change that below and on the wilfy to any port.

    on the wilfy do this. (if you use a battery powered wifly, you should also use idle,sleep and wake)

    set ip host (your computer ip) without ()
    set ip remote_port 3000
    set sys autoconn 10
    save
    reboot

    You can use the tiny Quicksharp to compile the sourcecode.
    http://quicksharp.sourceforge.net/
    using System;
    using System.Net;
    using System.Net.Sockets;
    using System.Text;
    using System.Threading;
    
    
    public class SimpleTcpSrvr
    {
       public static void Main()
       {
          int recv;
          byte[] data = new byte[1024];
          IPEndPoint ipep = new IPEndPoint(IPAddress.Any,
                                 3000); // PORT 3000
    
          Socket newsock = new
              Socket(AddressFamily.InterNetwork,
                          SocketType.Stream, ProtocolType.Tcp);
    
          newsock.Bind(ipep);
          newsock.Listen(10);
          Console.WriteLine("Waiting for wifly client...");
          Socket client = newsock.Accept();
          IPEndPoint clientep =
                       (IPEndPoint)client.RemoteEndPoint;
          Console.WriteLine("Connected with {0} at port {1}",
                          clientep.Address, clientep.Port);
    
          data = new byte[1024];
          recv = client.Receive(data); 
          Console.WriteLine(
          Encoding.ASCII.GetString(data, 0, recv)); // should be *HELLO*
          
          Thread.Sleep(100);    // pause for 1/10 of a second. 
          
          string mystring = "dosomething\r"; // my string to send back
          data = Encoding.ASCII.GetBytes(mystring);
          client.Send(data, data.Length,
                            SocketFlags.None);          
                      
                            
          while(true)
          {
             data = new byte[1024];
             recv = client.Receive(data);
             if (recv == 0)
               break;
           
             Console.WriteLine(
                      Encoding.ASCII.GetString(data, 0, recv));
          }
          
          client.Close();
          newsock.Close();
       }
    }
    
Sign In or Register to comment.