ESP 32 and ESP 8266 libs
-
Is it possible to use the liberaries for ESP32 and ESP8266 for the M5 stack?
I'm thinking about WiFimanager and ArduinoOTA liberaries. would be so mnice to just add these to my projects
-
HI Kryten,
I believe this should be possible although some changes need to be made to the code to make it M5Stack compatible.
Also perhaps not all functions are available yet for the ESP32 chip itself (& thus also the M5Stack).
For example, re. Arduino core for ESP32, analogWrite is not available yet but is being worked on.
However apparently most of that framework is available. See:
https://github.com/m5stack/azure_iothub_arduino_lib_esp32/blob/master/hardware/espressif/esp32/README.mdPerhaps someone else can add more to this....
Check the link below to visit the EXCELLENT "macsbug" blog for an example of changes made to esp32 code to make it run on M5Stack...... ( esp32-spaceshooter ) . Most changes are minor.
Use Chrome if you need it translated from Japanese, otherwise it may be hard to read. : >
https://macsbug.wordpress.com/2018/01/12/esp32-spaceshooter-with-m5stack/
-
Well I got the Arduino OTA working ( well it compiled anyways). And I really like the WiFi manager for the 8266 as it lets us move the device without having to reflash with new WiFi settings.
-
After looking long and hard at the WiFisetting example I think that is similar to the WiFi manager for esp8266
Will have to test it to see.
EDIT:
After testing I see that the M5Stack wont connect to the WiFi. -
At least the example for WiFi settings is not working at all for me. :(
Will have to try something else
-
@JimiT Thanks for the space invader, that is cool. I will also try to add sound like in the old days
-
Hi Kryten,
I haven't had a chance to try the space invaders yet... Mario Bros seems to work OK though. Doom has also been tested by others. Sound will be limited with the unit as is, but with the coming sound module hopefully that will be addressed.
You are trying the M5Stack's built in example sketch "WiSettings" - yes ?
For me, it all looks good but after entering wifi password... the M5Stack restarts and says "Waiting for WiFi Connection.... and then "Timed out". Is this what you are experiencing ?
I've tried a few things - checking router is using WPA2 Personal , standing right next to wifi box, tried on PC, iphone and ipad.....
I have also tried this previously with the same outcome.
It appears that the phone or ipad can connect to the M5Stack as an access point - they get an IP like 192.168.4.2 or 192.168.4.3 - but the M5Stack can't get out to the internet. Connection is always "timed out".
Is this your experience too, more or less ?
To me, it seems like my wifi router is perhaps not receiving or accepting the wifi credentials when sent by the M5Stack.
Can anyone add to this ?
-
@JimiT
Hi JimiTYes, I just tried to do the regular WiFi.begin(ssid,pwd) and that worked great.
I made it work. (jay me!)Change in code:
the setup was wrong (original code):void setup() {
m5.begin();
preferences.begin("wifi-config");delay(10);
if (restoreConfig()) {
if (checkConnection()) {
settingMode = false;
startWebServer();
return;
}
}
settingMode = true;
setupMode();
}My correction:
void setup() {
m5.begin();
preferences.begin("wifi-config");delay(10);
if (restoreConfig()) {
if (checkConnection()) {
settingMode = false;
startWebServer();
return;
} else {
settingMode = true;
setupMode();
}
}
}Missing code tags..
Basically the setup was connection but since the settingMode = true and setupMode() is added after we try to connect. It jumps out of connection mode.And do you have a link to Mario Bros?
-
@kryten
Hey thanks that looks like nice work...I updated the sketch with your suggestion and it compiled correctly..... I did get it to connect successfully to the internet and got to the STA page. Excellent.
However before I got that to work I had another issue as my password contained a pipe ( | ) symbol, which was not being transferred to the URL link correctly (perhaps as it wasn't on the list at the bottom of the sketch - String urlDecode).
Anyway, ultimately I changed the wifi password to remove the pipe & the correct password was then being fed into the url when I enter in the password.... & correct password & SSID on M5Stack screen.
Unfortunately after reloading the revised sketch it has gone back to "timing out" despite reflashing again using "pong"and then re-loading the revised sketch....
Curious ? Seems I will need to work on it a bit more. Worked b4 though !
RE. Mario Bros..... For me, this sketch came loaded when i bought the FACES modules (which includes a core unit). However you can get the NES_EMU software from github but from what it says you will need a copy of the ROM file. Have not tried loading it myself.
https://github.com/m5stack/M5Stack-nesemuYou might also be interested to check out the DIY controller shown on this review video recently posted on twitter by "Live Sparks": https://youtu.be/ThuaCke6c34
-
The pipe is %7C url encoded. So adding
s.replace("%7C", "|");
at the end will let you use your pipe in the password.
I will look in to the nes emulator.
-
@kryten
Thanks - I had actually used that technique and from what I can tell it seemed to work fine (no errors) - I just decided to simplify my password anyway...Next..... My SSID had a blank space in it.... I removed that. Still "timed out".
-
@kryten
This is working for me now.... using the original code.Removed space from SSID and earlier on had removed the pipe (|) in my password [although this could have been managed as suggested above]. Adjusted wifi router settings for WPA/WPA2 - Personal(Recommended) from "Automatic" to "WPA2-PSK" specifically. Connected to M5Stack via webpage , entered wifi settings... it retarts. Failed to connect to wifi. Restarted M5Stack again... no connection. Try again - this time connection is successful.
Each time I restart M5Stack now it establishes a wifi connection very quickly.
-
@jimit
I have tom many things connected to my WiFi to bother with canhing any router setup. And my esp8266's always connects. I figured it was best to fix this in code rather than doing workaround with WiFi.
-
I can't get this example to work. I modified the setup to:
[code]
void setup() {
m5.begin();
preferences.begin("wifi-config");delay(10);
if (restoreConfig()) {
if (checkConnection()) {
settingMode = false;
startWebServer();
return;
} else {
settingMode = true;
setupMode();
}
}
}
[code]
I tried two SSID's, with and without spaces. There are no non-alpha or special characters in my password. -
@kryten
Fair enough... is a pain changing setups. Definitely better to change it in code where possible. But as you are no doubt aware, fixing the pipe in the password was straight forward, but fixing the issue of having a space in the SSID looks more involved..... If the ESP8266's will handle the space in the SSID, perhaps some of the code used on the ESP8266 can be transplanted to solve this ?Or, as per the discussion in the following link, you could try using IDF... or try connecting to another access point just as a test. https://github.com/espressif/arduino-esp32/issues/836
Also, I could only successfully connect using the original code from the M5Stack Examples - not the modified code.
-
Have you tried the original code from the M5Stack Examples folder ? This modified example did not work for me.
As I just mentioned above, the original code worked for me once I had removed the space from my SSID.
It wont connect until you connect to the M5Stack webpage, enter your wifi details and allow it to restart... then it should connect. Try a few times if it doesn't work first time. Third time was the charm for me.
-
@JimiT @ispybadguys
I wil lhave to try this once more. But my office has a space in the pwd. Would be really nice to have it work with space as well.
-
While not ideal, an alternative option may be to setup another wifi router on the network and set it up without the space in the SSID.