How to handle multiple WIFi Switches

The Rocketry Forum

Help Support The Rocketry Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Crayok

Well-Known Member
TRF Supporter
Joined
Oct 23, 2017
Messages
131
Reaction score
103
Location
Calgary, Canada
A couple years ago the Kronos team launched a 1:20 scale Saturn V and onboard we had 5 Eggtimer wifi switches and a TRS unit. We used a board and sticky tape to mount 5 android and ios devices because we wanted to have one view of what state all the switches were in along with continuity. Well, we are starting a new project for next year and wanted to up the ante and come up with a better solution for the device board. Check out the video for the first attempt, with one ESP module talking to 4 switches.



Since the video I have added 4 ESP-01 modules each assigned to talk with 1 wifi switch or mini switch. and now there is no delay when switching between modules.

The circuit is pretty simple I am using a microchip 18f2525 controller, serial graphics display and a 74hc4052B multiplexer chip to chat with each of theESP modules. I did cheat with the ESP modules I was all ready to do the 3.3V supply and logic conversion until I found in the local electronics store, someone already made cheap nifty ESP adapter modules that did all the conversion, nice!!

The goal was to be able to control 8 switches and is doable just not with the small display I used for the prototype. Also want to add some meaningful labels rather than the SSID, say "Booster", "Sustainer" you get the idea. Cris mentioned that the team was coming out with some upgrades to handle the switch naming, that would be a good thing!!

And yes there will be some turn on/off sanity added back in just did not want to do that while setting up the code and debugging the system.

Enjoy
David
 
Last edited:
Amazing! Here my idea was to get 5 eBay special usb wifi adapters and try to get each browser window to use each adapter, this solution tickles the fancy much better.

Any plans to post source code down the line?
 
Hi Arpak
Any plans to post source code down the line?

So not sure where you are on the coding scale but posting code is very compiler dependant and of course the controller you are developing for. Some of the work for this project was actually developing the serial driver for the graphics display which will be posted in a forum over CCS way (my compiler) but what I can do is share what ESP commands I used. I have included the responses so you can parse and deal with the appropriate stuff. All the ESP AT command definitions below you can find over espressif way. some of the response also depend on firmware versions, module type etc.

https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf

Code:
AT+CWMODE=1

OK or ERROR

AT+CWJAP="WiFi_Sw_2945AA","13545727"
+CWJAP:3

FAIL

AT+CWJAP="WiFi_Sw_2945AA","13545727"
WIFI CONNECTED
WIFI GOT IP

OK

AT+CWJAP="WiFi_Sw_2945AA","13545727"
WIFI DISCONNECT
WIFI CONNECTED
WIFI GOT IP

OK

AT+CIPMUX=1

OK

AT+CIPSERVER=1,80

OK

AT+CIPSTART=4,"TCP","192.168.4.1",80
4,CONNECT

OK //TIME LAG AFTER THIS COMMAND MEANT FOR HTTP: GET() TO SEND RESULTS

Below is the GET response sequence snippet in C. AP_W is the module we are communicating with, but the most important are the three commands

C:
      if (WIFI_datas[AP_W].state)
         {
         fprintf(esp, "AT+CIPSEND=4,30\r\n");//72
         while(bgetc()!='>');//wait for cipsend ">" to complete
         fprintf(esp, "192.168.4.1/GET /off\?vc=%c%c%c%c\r\n",WIFI_datas[AP_W].test[0],WIFI_datas[AP_W].test[1],WIFI_datas[AP_W].test[2],WIFI_datas[AP_W].test[3]);//30
         }
      else
         {
         fprintf(esp, "AT+CIPSEND=4,29\r\n");//72
         while(bgetc()!='>');//wait for cipsend ">" to complete
         fprintf(esp, "192.168.4.1/GET /on\?vc=%c%c%c%c\r\n",WIFI_datas[AP_W].test[0],WIFI_datas[AP_W].test[1],WIFI_datas[AP_W].test[2],WIFI_datas[AP_W].test[3]);//29
         }
      fprintf(esp, "AT+CIPCLOSE=4\r\n");
 
Last edited:
Back
Top