-
• #2
There is a flag (ssid hidden) for this listed in the AT commands for the ESP8266.
- AT+CWSAP_CUR – Current config of softAP mode
AT+CWSAP_CUR – Set configuration of softAP mode, won’t save to Flash
Example AT+CWSAP_CUR="ESP8266", "1234567890", 5, 3
Command AT+CWSAP_CUR?
Response +CWSAP_CUR:, , , , ,
Parameters
string, ESP8266 softAP’ SSID
string, range: 8 ~ 64 bytes ASCII
channel id
0 OPEN
2 WPA_PSK
3 WPA2_PSK
4 WPA_WPA2_PSK
maximum count of stations that allowed to connect to ESP8266 soft-AP
range: [1, 4]
Broadcast SSID by default
0 broadcast SSID of ESP8266 soft-AP
1 do not broadcast SSID of ESP8266 soft-AP
Command AT+CWSAP_CUR=, , , [, ][, ]
Response
OK
ERROR
Parameters The same as above.
Notes
This command is only available when softAP mode enable.
ESP8266 softAP don’t support WEP.
This configuration will NOT store in Flash.
Espressif
https://cdn.sparkfun.com/assets/learn_tutorials/4/0/3/4A-ESP8266AT_Instruction_SetEN_v0.30.pdf
- AT+CWSAP_CUR – Current config of softAP mode
-
• #3
Thank you for your reply, but I don't think I can use this with existing Espruino (JavaScript) functionality.
-
• #4
Perhaps if you post your code we can figure out how to implement the AT commands that you need to hide the SSID.
Attached code snippet shows how I've implemented additional AT commands for other purposes mDNS.var mDNS="AT+MDNS=1,\"bob\",\"http\",8080\r\n"; function mysend(a){ Wifi.at.cmd(a, 1000, function(d){console.log(d+"xxx");}); } //var ddata=""; function test(){ if(Hardware===1)Serial=Serial2; if(Hardware===0)Serial=Serial4; if(Hardware===1){ digitalWrite(B9,1); // enable on Pico Shim V2 Serial.setup(115200, { rx: A3, tx : A2 }); //Pico } if(Hardware===0)Serial.setup(115200, { rx: C11, tx : C10 }); //espruino board console.log("Start connection process"); var wifi = require("ESP8266WiFi_0v25").connect(Serial, function(err) { if (err)return 1;// throw err; Wifi=wifi; console.log("Reset the ESP8266"); wifi.reset(function(err) { if (err)return 1;// throw err; Wifi.at.cmd("AT+CWMODE_CUR=3\r\n", 1000, function(d){console.log(d+"xx1");}); Wifi.at.cmd("AT+CIPMUX=1\r\n", 1000, function(d){console.log(d+"xx2");}); console.log("Connecting to WiFi"); wifi.connect(SSID,key, function(err) { if (err)return 1;//throw err; wifi.getIP(function(l,ip){ console.log("IP= ",ip,"\n\r"); console.log("WiFi Connected "); mysend(mDNS); //HTTP or Network Server goes here serveHTML();
-
• #5
Looking at the source code, it doesn't appear to be implemented. This is where it should be:
https://github.com/espruino/Espruino/blob/master/libs/network/esp8266/jswrap_esp8266_network.c#L704
It doesn't look horribly complicated to add. It seems that we would have to add a new property to the configuration of the parameters as an access point. From what I can see, the ESP8266 API does support the functional capability so really what would be required would be exposing that through Espruino.
-
• #6
This link on the Espruino site talks about a StartAP function for ESP8266
http://www.espruino.com/ESP8266_WifiUsage
1-alt. Create an access pointUsing the ESP8266 is not recommended in general because its functionality is very limited and you'll have to reconnect to the AP whenever something bad happens, but it's a handy mode if you're out on the road and don't have an AP you can use to get internet access. To get that going use:
var wifi = require("Wifi");
wifi.disconnect()
wifi.startAP("my-ssid", {password:"my-password"});Searching the ESP8266WiFi_0v25.js module there is no current startAP function implemented.
One other issue is the Firmware and SDK version of the ESP8266 you are using. Older versions may not support some of the newest AT commands. This would involve flashing the chip to the newer version.
-
• #7
Looking at a different module
http://www.espruino.com/modules/EspruinoWiFi.js
This looks like the relevant place to make the modification./* Create a WiFi access point allowing stations to connect. ssid - the AP's SSID options.password - the password - must be at least 8 characters (or 10 if all numbers) options.authMode - "open", "wpa2", "wpa", "wpa_wpa2" options.channel - the channel of the AP */ exports.startAP = function(ssid, options, callback) { options = options||{}; if (!options.password || options.password.length<8) throw new Error("Password must be at least 8 characters"); var enc = options.password?"3":"0"; // wpa2 or open if (options.authMode) { enc={ "open":0, "wpa":2, "wpa2":3, "wpa_wpa2":4 }[options.authMode]; if (enc===undefined) throw new Error("Unknown authMode "+options.authMode); } if (options.channel===undefined) options.channel=5; turnOn(MODE.AP, function(err) { if (err) return callback(err); at.cmd("AT+CWSAP="+JSON.stringify(ssid)+","+JSON.stringify(options.password)+","+options.channel+","+enc+"\r\n", 5000, function(cwm) { if (cwm!="OK") callback("CWSAP failed: "+(cwm?cwm:"Timeout")); else callback(null); }); }); };
-
• #8
Would be nice if it could be added!
Thank you @ClearMemory041063 and @Kolban for explaining!
-
• #9
@ClearMemory041063 I tried to use espruino.com/modules/EspruinoWiFi.js as source in a project in the Espruino WebIDE but I never got it to work. It seems that it is using pins A13 and A14 which are not supported on an ESP8266.
When I used Fiddler to see where exactly a module is being loaded when I do a require("Wifi") I saw nothing being loaded from Internet. When you load another module, for example through a require("DS18B20), there is network traffic to http://www.espruino.com/modules//DS18B20.min.js
So, I am not sure how to do this.
If anyone can help me getting started, I would appreciate it very much!
-
• #10
Are you attempting to do this entirely on an ESP8266 itself, or with an Espruino board + an ESP8266?
The EsprunoWifi module is for the Espruino WiFi, and expects those extra pins to control whether the WiFi module is powered. For ESP8266+Espruino, the
ESP8266WiFi_0v25
module provides a function calledcreateAP
- which does the same thing and could be modified to do what you need.But if you're doing this on a raw ESP8266, it's going to need some tweaks in the C code @Kolban pointed at.
-
• #11
Thanks Gordon for clarifying where the changes need to occur.
from the Esp8266_at_instrunction_set_env1.5.4_0.pdf
AT+ CWSAP – Configuration of softAP mode
[@deprecated]. Please use AT+CWSAP_CUR or AT+CWSAP_DEF instead.AT+CWSAP_CUR – Set configuration of softAP mode, won’t save to Flash
Example AT+CWSAP_CUR="ESP8266", "1234567890", 5, 3
Command AT+CWSAP_CUR?
Response +CWSAP_CUR:, , , , ,
Parameters
string, ESP8266 softAP’ SSID
string, range: 8 ~ 64 bytes ASCII
channel id
0 OPEN
2 WPA_PSK
3 WPA2_PSK
4 WPA_WPA2_PSK
maximum count of stations that allowed to connect to ESP8266 soft-AP
range: [1, 4]
Broadcast SSID by default
0 broadcast SSID of ESP8266 soft-AP
1 do not broadcast SSID of ESP8266 soft-AP
Command AT+CWSAP_CUR=, , , [, ][, ]ESP8266 softAP don’t support WEP.
AT+ CWSAP_DEF – Set configuration of softAP mode, save to Flash
Example AT+CWSAP_DEF="ESP8266", "1234567890", 5, 3
Command AT+CWSAP_DEF?
Response +CWSAP_DEF:, , , , ,
Parameters
string, ESP8266 softAP’ SSID
string, range: 8 ~ 64 bytes ASCII
channel ID
0 OPEN
2 WPA_PSK
3 WPA2_PSK
4 WPA_WPA2_PSK
maximum count of stations that allowed to connect to ESP8266 soft-AP
range: [1, 4]
Broadcast SSID by default
0 broadcast SSID of ESP8266 soft-AP
1 do not broadcast SSID of ESP8266 soft-AP
Command AT+CWSAP_DEF=, , , [, ][, ]
Response
OK
ERROR
Parameters The same as above.
Notes
This command is only available when softAP mode enable.
ESP8266 softAP don’t support WEP.
This configuration will store in Flash system parameter area. -
• #12
@Gordon I was going to do the change for ESP8266+Espruino, so I guess I need to be at ESP8266WiFi_0v25 module. Can you explain why I don't see that the require("Wifi") doesn't seem to generate any traffic to the modules folder on http://www.espruino.com?
-
• #13
Some 'modules' are part of the Espruino binary and requiring them makes them accessible in JavaScript object / programming name space.
-
• #14
If you are running Espruino on an ESP8266 the code is part of the binary flashed to the device and will require one of the ESP8266 GURUs to make the changes and recompile the code.
If you are using the ESP8266 from another Espruino device through a serial port the code is in the module on the website.
To make the changes copy the module from the website and paste it into a file to edit.
On WebIDE options page create a project directory (if you haven't already). Put your edited module in the project.modules directory. Suggest that you rename the module and change the name in your test code. When modules load WebIDE looks in several locations for the file, one being the project modules directory.
As a first edit insert a console.log("It's me"); into the function you are going to change and see if you are on the right track by running your test code.For ESP8266+Espruino, the ESP8266WiFi_0v25 module provides a function called createAP
-
• #15
I think the
Wifi
module is only when Espruino is running on the ESP8266 itself? As @allObjects said, some modules are built into the Espruino firmware (likehttp
for instance) - and that is one of them. -
• #16
If you cannot find the module in espruino.com/modules (and not in your IDE's sandbox/modules folder), it is a built-in module.
-
• #17
Finally found some time to pick this up again. Sending the sample in http://www.espruino.com/modules/ESP8266WiFi_0v25.js doesn't work. I understand that this was created for the Espruino on ESP8266. Correct?
I am using a NodeMCU and it breaks on A2 and A3 (not defined). I converted the original line from the example to:
Serial2.setup(115200, { rx: NodeMCU.D9, tx : NodeMCU.D10 });
where it was:
Serial2.setup(115200, { rx: A3, tx : A2 });
The sample stops at
Connecting to ESP8266 =undefined Connecting to WiFi Connected >Uncaught Error: CIPSTART failed (Timeout) at line 1 col 72 ...'CIPSTART failed (Timeout)'); ^ in function called from system
The sample code I used is:
Serial2.setup(115200, { rx: NodeMCU.D9, tx : NodeMCU.D10 }); console.log("Connecting to ESP8266"); var wifi = require("mywifi").connect(Serial2, function() { wifi.reset(function() { console.log("Connecting to WiFi"); wifi.connect("my own ssid","password", function() { console.log("Connected"); require("http").get("http://www.espruino.com", function(res) { console.log("Response: ",res); res.on('data', function(d) { console.log("--->"+d); }); }); }); }); });
It seems to break on the get() of http://www.espruino.com. Any ideas?
Edit: I created an Espruino IDE project for this in a folder on a local drive.
-
• #18
.espruino.com/modules/ESP8266WiFi_0v25.js was (initially) created for the combination of an original or PICO Espruino board - or similar - with no Wifi on-board and a (classic) ESP8266 (ESP-01). Espruino an ESP8266 are communicating with each other over serial USART. The version indicator 0v25 for the JS module on the Espruino side matches up with the version of the firmware on the ESP8266 - namely the AT commands and sequencing of the communication.
With the advent of Espruino 'directly' on ESP8266 ESP-01 (and ESP-12 or a-like), Esruino uses a different, dedicated - bult-in module. The Espruino firmware / binary - which is flashed onto the ESP8266 - includes the Wifi stack of ESP8266.
-
• #19
Thank you @allObjects. I understand that I have no option to modify code for the Wifi to make the hidden SSID a possibility? One of the firmware maintainers has to do this?
I don't see an option to start an ESP8266 with Espruino as access point with a hidden SSID? Would this even be possible?
Thanks!