WIFI RS 21 Module set up on Raptor

Hi, to everyone! This is the first time i am trying to set up the WIFI RS 21 Module on Raptor X1 Socket.
I am on 4.3.6 firmware 2014 R5.

Here is a code sample i use:


 private static WiFiRS9110 netif; 

        void ProgramStarted()
        {
            NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
            NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
            // I use 1 socket
            netif = new WiFiRS9110(SPI.SPI_module.SPI2, (Cpu.Pin)37, (Cpu.Pin)32, (Cpu.Pin)7, 24000);
            netif.Open();
            netif.EnableDhcp();
            netif.EnableDynamicDns();
            netif.Join("SSID", "Password");

            while (netif.IPAddress == "0.0.0.0")
            {
                Debug.Print("Waiting for DHCP");
                Thread.Sleep(250);
            }

When i run the project in debug mood it throws an exception (This interface type is already created.)

on this line of code:



What am i doing wrong? How to determine the pins i shoul use to initialize wifi rs 21 on every "S" socket?

@ Alex Bilityuk - That exception seems to imply you have the module connected in the Gadgeteer designer. If that is the case, you don’t need to construct it yourself.

1 Like

@ John -
Yes, the module was hooked up in designer. Can you share a code sample how to use WIFI RS 21 in AP mode with static IP? Thank you!

Also it would be very nice to know how to set an http server on it.

@ Alex Bilityuk - It works the same as any other of our network modules. I believe you can call, if you connect it in the designer only, wifirs21.UseStaticIp(). Then take a look at the System.Http assembly.

@ Alex Bilityuk - CodeShare is a great thing as for example @ .Peter. has a working sample project in there that uses the wifi module with a Raptor https://www.ghielectronics.com/community/codeshare/entry/962 all the code you need is in there.

Thank you for reply guys! But i can’t set up the Access Point connection on this module. I need your help. There is no documentation for this wifi module acess point set up.

I am trying this code:


void ProgramStarted()
        {
            NetworkChange.NetworkAvailabilityChanged += (a, b) => Debug.Print(DateTime.Now + " Network availability = " + b.IsAvailable.ToString());
            NetworkChange.NetworkAddressChanged += (a, b) => Debug.Print(DateTime.Now + " Network address change ");

            WiFiRS9110.NetworkParameters ACCESSPOINT_PARAMS = new WiFiRS9110.NetworkParameters();
            
            ACCESSPOINT_PARAMS.Channel=2;
            ACCESSPOINT_PARAMS.Key = "MySecret";
            ACCESSPOINT_PARAMS.Ssid = "RaptorBOT";
            ACCESSPOINT_PARAMS.NetworkType = WiFiRS9110.NetworkType.AccessPoint;
            ACCESSPOINT_PARAMS.SecurityMode = WiFiRS9110.SecurityMode.Wpa2;
            
            wifiRS21.NetworkInterface.Open();
            wifiRS21.UseThisNetworkInterface();
            wifiRS21.NetworkInterface.EnableDhcp();
            wifiRS21.NetworkInterface.EnableDynamicDns();
            
            
            //Work As AP
            wifiRS21.NetworkInterface.EnableStaticIP("192.168.0.65", "255.255.255.0", "192.168.0.65");
            wifiRS21.NetworkInterface.StartAdHocNetwork(ACCESSPOINT_PARAMS);
            

            // Waiting for an address
            while (wifiRS21.NetworkInterface.IPAddress == "0.0.0.0")
            {
                Debug.Print(DateTime.Now + " Waiting for network address ...");
                Thread.Sleep(250);
            }

but on this line it throws exception: You must specify an Ad-hoc network type to create an Ad-hoc host


wifiRS21.NetworkInterface.StartAdHocNetwork(ACCESSPOINT_PARAMS);

Share with a working code sample please…

@ andre.m -
I want to set up the module in Access Point mode, not in Ad-Hoc mode. Because my android smartphone doesn’t use ad-hoc connection. After i would like to run http server on Raptor and handle robo commands from my smartphone.

I don’t need to connect to existing wlan…

Just help me please to set up this method:


  WiFiRS9110.NetworkParameters ACCESSPOINT_PARAMS = new WiFiRS9110.NetworkParameters();
  ACCESSPOINT_PARAMS.NetworkType = WiFiRS9110.NetworkType.AccessPoint;

GHI guys can confirm please does the RS 21 module support Acces Point mode or not? How to use it? There is no code working code samples…

            wifiRS21.NetworkInterface.EnableDhcp();
            wifiRS21.NetworkInterface.EnableDynamicDns();
            
            
            //Work As AP
            wifiRS21.NetworkInterface.EnableStaticIP("192.168.0.65", "255.255.255.0", "192.168.0.65");
            wifiRS21.NetworkInterface.StartAdHocNetwork(ACCESSPOINT_PARAMS);

So for a start, simplify your code. In an Access Point scenario, you don’t enable DHCP or Dynamic DNS.

@ Brett -
Already tried to initialize it without dhcp and dynamic dns enabled. The same exception on this line it throws: You must specify an Ad-hoc network type to create an Ad-hoc host


wifiRS21.NetworkInterface.StartAdHocNetwork(ACCESSPOINT_PARAMS);

@ John-
Hi, John! Can you reproduce my issue and share a working code sample of setting up the WIFI RS21 Module in Access Point mode. I really can’t find a solution, not in codeshare, not in google search.

Thank you!

the rs21 can not be configured as an access point.

It sounds very very bad for me! I’ve bought a lot of modules and Raptor for my project… This module is pretty expensive, and i learn that i am not able to use it in my project. Why do i need this module so? I have no idea… I am very upset.

you can buy a mini wifi router and use it to setup your wireless network. these small travel routers can be purchased for around $25US.

@ Mike -
Thank you for advice, but it is not comfortable to place it on my chassis, it will take too much space i think and will need an additional power supply.

Is there any other embed wifi modules already tested on raptor and with an Access Point option and multiple socket connections?

I am using multiple ESP8266 modules in AP, client and AP+client modes. There are a bunch of them out there from getmolecule.net (Justin), from munderhill, and from Adafuit. They only require, at minimum, two UART lines, a GPIO for reset, 3v3 power and Gnd and they are cheap as dirt.

They use a serial AT protocol and I have published a library to nuget and github. They support up to five connections (client or server). No SSL though.

1 Like

This module is based on RS9110-N-11-22-05 redpine signals chip/
I found the folowing information in the official datasheet of this chip:

Also this chip support AT commands via UART. It seems like there is a way to set an AP mode on it.

Dear GHI employees, can you clarify the question please…

You may not recognise the subtle difference, but just because the hardware can support it doesn’t mean the vendor who sells it will support all features.

You say you are upset - what led you to believe that you could use the module in the way you intended ? Perhaps it’s your expectation that’s the challenge here.

further, the quoted specification only says it can become an AP to configure or upgrade firmware. it does no say it supports establishing a wifi network.

@ Brett -
I think you are right about my expectations.

Ok. I am going to use Ad-Hoc connection on my PC not on smartphone. I need to buy a ESP8266 as macalsyn suggested.

@ Alex Bilityuk - The other posters in the thread are correct. The module can be used to connect to another Access Point (AP) or it can create its own Ad Hoc network. NetworkType.AccessPoint and NetworkType.AdHoc are both returned when you call Scan and are used to signal which type of network was found. NetworkType.AdHoc can also be used when calling StartAdHocNetwork. We do not support the module acting as a true access point.

1 Like