Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Electronics : Arduino core for ESP32 WiFi chip
Author | Message | ||||
LadyN Guru Joined: 26/01/2019 Location: United StatesPosts: 408 |
I just wanted to clarify that the ESP32 WiFi chip has a functional Arduino core: https://github.com/espressif/arduino-esp32 When I get excited about the ESP32 WiFi chip when we discuss Arduino projects, I am not talking about the IDF toolchain but this Arduino core. In theory, your Arduino projects should continue to run on the ESP32 using the Arduino core for ESP32 WiFi chip. OF COURSE, hardware specific assumptions will need to be updated but you all knew that already! |
||||
mackoffgrid Guru Joined: 13/03/2017 Location: AustraliaPosts: 460 |
I've recently bought a ESP32 (I think its the 32 and not the 8266) but haven't played with it yet. How different is the ESP32 from the ESP8266? |
||||
LadyN Guru Joined: 26/01/2019 Location: United StatesPosts: 408 |
I REALLY LACK the hands on experience to answer this question properly and will let professionals do a better job. I believe that they are not comparable at all. The ESP32 is in a completely different league. The price is what excites me. The ESP32 is not even double the price of a ESP8266 hence the price/feature ratio is absolutely incomparable. I found this to be useful: https://makeradvisor.com/esp32-vs-esp8266/ |
||||
mackoffgrid Guru Joined: 13/03/2017 Location: AustraliaPosts: 460 |
looks like I got the wrong one ? ESP 8266 ? can you recommend an esp32 on Aliexpress or ebay? |
||||
LadyN Guru Joined: 26/01/2019 Location: United StatesPosts: 408 |
Yes that's not the ESP32 Andrew Hmm, I looked at my order history and the prices have gone up a bit but these are the two types I like to buy: https://www.aliexpress.com/item/Wifi-Bluetooth-Development-Board-Antenna-ESP32-ESP-32-REV1-CH340-CH340G-MicroPython-Micr o-USB-Lithium-Battery/32846143452.html https://www.aliexpress.com/item/ESP-32-ESP-32S-Development-Board-WiFi-Bluetooth-Ultra-Low-Power-Consumption-Dual-Cores-E SP32-Board/32959078656.html If you want to buy only 1 to test, get the second one. |
||||
mackoffgrid Guru Joined: 13/03/2017 Location: AustraliaPosts: 460 |
They're both ok with arduino IDE (windows)? I'll get one if that the case. 2 cores, that'll be interesting. Thanks Andrew |
||||
LadyN Guru Joined: 26/01/2019 Location: United StatesPosts: 408 |
Yes. The two boards I posted are not the same. One has an additional 4MB Winbond memory on it that might be useful for the Warpverter project but the other one I recommend has better pin routing that's very useful when starting off with these ESP32s |
||||
mackoffgrid Guru Joined: 13/03/2017 Location: AustraliaPosts: 460 |
Hi Natasha I haven't ordered one of those ESP32 modules yet. That last link you posted doesn't seem to work now. Could you look at the following link and confirm the suitability for arduino use. Do you have other suggestions - better options? ailExpress ESP32 Cheers Andrew |
||||
LadyN Guru Joined: 26/01/2019 Location: United StatesPosts: 408 |
Hi Andrew ! That model looks OK but it's not the best price. Try removing spaces from the links I posted - I JUST confirmed they still work. IT MIGHT be possible the filter results based of country? My first link uses CH340G and a 4MB Winbond flash - never used it as these are relatively new before but I have used a lot of the second link (and the one you posted) and they are painless. I THINK TinyT posted some results that bitbanging on these ESP32 are not reliable. He's right because they run RTOS but there is a RMT peripheral on these ESP32 that can be used to send out bitperfect waveforms so if you can explore that I would really appreciate it. I will be doing some ULP experiments myself for my solar power monitor |
||||
mackoffgrid Guru Joined: 13/03/2017 Location: AustraliaPosts: 460 |
Thanks, I have no specific project or target but the embeded wifi and bluetooth make it interesting for a start. The dual cores are also interesting, perhaps a positive and a negative. At the moment, the BluePill is my goto if you need good ADC and timing, at a price, and in a convenient form factor. Cheers Andrew |
||||
poida Guru Joined: 02/02/2017 Location: AustraliaPosts: 1419 |
the above aliexpress link is to the same sort of esp32 I bought. It works fine, using the Arduino software. I posted something here earlier about non-deterministic timing for pin i/o. You need to install a few extra things, to make it work within a vanilla Arduino install. follow info at https://github.com/espressif/arduino-esp32 I had no problems programming and running it. an example, that has reliable connection and reconnection the the wifi. It shows a simple web page and has two buttons, which control the LED and another GPIO pin. tap the button (on the mobile phone) and the LED lights up or dims. proof of concept stuff. #include <WiFi.h> #include <WebServer.h> /* Put your SSID & Password */ const char* ssid = "something"; // Enter SSID here const char* password = "its a secret.."; //Enter Password here WebServer server(80); uint8_t LED1pin = 4; bool LED1status = LOW; uint8_t LED2pin = 2; bool LED2status = LOW; void setup() { int t; Serial.begin(115200); pinMode(LED1pin, OUTPUT); pinMode(LED2pin, OUTPUT); again_plz: t=0; WiFi.disconnect(); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); t++; if (t > 10) goto again_plz; } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); for(t=0; t < 5; t++) { digitalWrite(2,HIGH); delay(100); digitalWrite(2,LOW); delay(100); } server.on("/", handle_OnConnect); server.on("/led1on", handle_led1on); server.on("/led1off", handle_led1off); server.on("/led2on", handle_led2on); server.on("/led2off", handle_led2off); server.onNotFound(handle_NotFound); server.begin(); Serial.println("HTTP server started"); } void loop() { server.handleClient(); if(LED1status) {digitalWrite(LED1pin, HIGH);} else {digitalWrite(LED1pin, LOW);} if(LED2status) {digitalWrite(LED2pin, HIGH);} else {digitalWrite(LED2pin, LOW);} } void handle_OnConnect() { LED1status = LOW; LED2status = LOW; Serial.println("GPIO4 Status: OFF | GPIO5 Status: OFF"); server.send(200, "text/html", SendHTML(LED1status,LED2status)); } void handle_led1on() { LED1status = HIGH; Serial.println("GPIO4 Status: ON"); server.send(200, "text/html", SendHTML(true,LED2status)); } void handle_led1off() { LED1status = LOW; Serial.println("GPIO4 Status: OFF"); server.send(200, "text/html", SendHTML(false,LED2status)); } void handle_led2on() { LED2status = HIGH; Serial.println("GPIO5 Status: ON"); server.send(200, "text/html", SendHTML(LED1status,true)); } void handle_led2off() { LED2status = LOW; Serial.println("GPIO5 Status: OFF"); server.send(200, "text/html", SendHTML(LED1status,false)); } void handle_NotFound(){ server.send(404, "text/plain", "Not found"); } String SendHTML(uint8_t led1stat,uint8_t led2stat){ String ptr = "<!DOCTYPE html> <html>\n"; ptr +="<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\">\n"; ptr +="<title>LED Control</title>\n"; ptr +="<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}\n"; ptr +="body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;} h3 {color: #444444;margin-bottom: 50px;}\n"; ptr +=".button {display: block;width: 80px;background-color: #3498db;border: none;color: white;padding: 13px 30px;text-decoration: none;font-size: 25px;margin: 0px auto 35px;cursor: pointer;border-radius: 4px;}\n"; ptr +=".button-on {background-color: #3498db;}\n"; ptr +=".button-on:active {background-color: #2980b9;}\n"; ptr +=".button-off {background-color: #34495e;}\n"; ptr +=".button-off:active {background-color: #2c3e50;}\n"; ptr +="p {font-size: 14px;color: #888;margin-bottom: 10px;}\n"; ptr +="</style>\n"; ptr +="</head>\n"; ptr +="<body>\n"; ptr +="<h1>ESP32 Web Server</h1>\n"; ptr +="<h3>nothing in particular</h3>\n"; if(led1stat) {ptr +="<p>LED1 Status: ON</p><a class=\"button button-off\" href=\"/led1off\">OFF</a>\n";} else {ptr +="<p>LED1 Status: OFF</p><a class=\"button button-on\" href=\"/led1on\">ON</a>\n";} if(led2stat) {ptr +="<p>LED2 Status: ON</p><a class=\"button button-off\" href=\"/led2off\">OFF</a>\n";} else {ptr +="<p>LED2 Status: OFF</p><a class=\"button button-on\" href=\"/led2on\">ON</a>\n";} ptr +="</body>\n"; ptr +="</html>\n"; return ptr; } wronger than a phone book full of wrong phone numbers |
||||
mackoffgrid Guru Joined: 13/03/2017 Location: AustraliaPosts: 460 |
Thanks Poida. I appreciate the head start. I can see the esp32 will be very useful for IOT etc. |
||||
Print this page |