mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-11-03 14:33:37 +03:00 
			
		
		
		
	Merge pull request #370 from Links2004/esp8266
add better docu and schematics for easy setup the ESP
This commit is contained in:
		
							
								
								
									
										63
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										63
									
								
								README.md
									
									
									
									
									
								
							@@ -206,6 +206,28 @@ Libraries that don't rely on low-level access to AVR registers should work well.
 | 
				
			|||||||
Pick the correct serial port.
 | 
					Pick the correct serial port.
 | 
				
			||||||
You need to put ESP8266 into bootloader mode before uploading code.
 | 
					You need to put ESP8266 into bootloader mode before uploading code.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Power Supply ####
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For stable use of the ESP8266 a power supply with 3V3 and >= 250mA is required.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Note
 | 
				
			||||||
 | 
					 - using Power from USB to Serial is may unstable, they not deliver enough current. 
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					#### Serial Adapter ####
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					There are many different USB to Serial adapters / boards.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Note
 | 
				
			||||||
 | 
					 - for full upload management you need RTS and DTR
 | 
				
			||||||
 | 
					 - the chip need to have 3V3 TTL (5V may damage the chip)
 | 
				
			||||||
 | 
					 - not all board have all pins of the ICs as breakout (check before order)
 | 
				
			||||||
 | 
					 - CTS and DSR are not useful for upload (they are Inputs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Working ICs 
 | 
				
			||||||
 | 
					 - FT232RL
 | 
				
			||||||
 | 
					 - CP2102
 | 
				
			||||||
 | 
					 - may others (drop a comment)
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
#### Minimal hardware Setup for Bootloading and usage ####
 | 
					#### Minimal hardware Setup for Bootloading and usage ####
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ESPxx Hardware
 | 
					ESPxx Hardware
 | 
				
			||||||
@@ -226,27 +248,44 @@ ESPxx Hardware
 | 
				
			|||||||
 - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module)
 | 
					 - Reset is also named RSBT or REST (adding PullUp improves the stability of the Module)
 | 
				
			||||||
 - GPIO2 is alternative TX for the boot loader mode
 | 
					 - GPIO2 is alternative TX for the boot loader mode
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
ESP01 example:
 | 
					###### esp to Serial
 | 
				
			||||||
 | 
					
 | 
				
			||||||

 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### Minimal hardware Setup for Bootloading only ####
 | 
					#### Minimal hardware Setup for Bootloading only ####
 | 
				
			||||||
ESPxx Hardware
 | 
					ESPxx Hardware
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| PIN           | Resistor | Serial Adapter |
 | 
					| PIN           | Resistor | Serial Adapter  |
 | 
				
			||||||
| ------------- | -------- | -------------- | 
 | 
					| ------------- | -------- | --------------- | 
 | 
				
			||||||
| VCC           |          | VCC (3.3V)     |
 | 
					| VCC           |          | VCC (3.3V)      |
 | 
				
			||||||
| GND           |          | GND            |
 | 
					| GND           |          | GND             |
 | 
				
			||||||
| TX or GPIO2   |          | RX             |
 | 
					| TX or GPIO2   |          | RX              |
 | 
				
			||||||
| RX            |          | TX             |
 | 
					| RX            |          | TX              |
 | 
				
			||||||
| GPIO0         |          | GND            |
 | 
					| GPIO0         |          | GND             |
 | 
				
			||||||
| Reset         |          | RTS*            |
 | 
					| Reset         |          | RTS*            |
 | 
				
			||||||
| GPIO15        | PullDown |                |
 | 
					| GPIO15        | PullDown |                 |
 | 
				
			||||||
| CH_PD         | PullUp   |                |
 | 
					| CH_PD         | PullUp   |                 |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Note 
 | 
					* Note 
 | 
				
			||||||
	- if no RTS is used a manual power toggle is needed
 | 
						- if no RTS is used a manual power toggle is needed
 | 
				
			||||||
	 
 | 
						 
 | 
				
			||||||
 | 
					#### Minimal hardware Setup for running only ####
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ESPxx Hardware
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| PIN           | Resistor | Power supply    |
 | 
				
			||||||
 | 
					| ------------- | -------- | --------------- | 
 | 
				
			||||||
 | 
					| VCC           |          | VCC (3.3V)      |
 | 
				
			||||||
 | 
					| GND           |          | GND             |
 | 
				
			||||||
 | 
					| GPIO0         | PullUp   |                 |
 | 
				
			||||||
 | 
					| GPIO15        | PullDown |                 |
 | 
				
			||||||
 | 
					| CH_PD         | PullUp   |                 |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					###### minimal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					###### improved stability
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Issues and support ###
 | 
					### Issues and support ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Forum: http://www.esp8266.com/arduino
 | 
					Forum: http://www.esp8266.com/arduino
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								doc/ESP_improved_stability.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/ESP_improved_stability.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 18 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								doc/ESP_min.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/ESP_min.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 6.5 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								doc/ESP_to_serial.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/ESP_to_serial.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 21 KiB  | 
@@ -46,6 +46,9 @@ ESP8266WiFiClass::ESP8266WiFiClass()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void ESP8266WiFiClass::mode(WiFiMode m)
 | 
					void ESP8266WiFiClass::mode(WiFiMode m)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    if(wifi_get_opmode() == (uint8)m) {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    ETS_UART_INTR_DISABLE();
 | 
					    ETS_UART_INTR_DISABLE();
 | 
				
			||||||
    wifi_set_opmode(m);
 | 
					    wifi_set_opmode(m);
 | 
				
			||||||
    ETS_UART_INTR_ENABLE();
 | 
					    ETS_UART_INTR_ENABLE();
 | 
				
			||||||
@@ -357,10 +360,14 @@ void ESP8266WiFiClass::_scanDone(void* result, int status)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int8_t ESP8266WiFiClass::scanNetworks()
 | 
					int8_t ESP8266WiFiClass::scanNetworks()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if ((wifi_get_opmode() & 1) == 0)//1 and 3 have STA enabled
 | 
					    if(_useApMode) {
 | 
				
			||||||
    {
 | 
					        // turn on AP+STA mode
 | 
				
			||||||
        mode(WIFI_AP_STA);
 | 
					        mode(WIFI_AP_STA);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        // turn on STA mode
 | 
				
			||||||
 | 
					        mode(WIFI_STA);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int status = wifi_station_get_connect_status();
 | 
					    int status = wifi_station_get_connect_status();
 | 
				
			||||||
    if (status != STATION_GOT_IP && status != STATION_IDLE)
 | 
					    if (status != STATION_GOT_IP && status != STATION_IDLE)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -532,9 +539,12 @@ void ESP8266WiFiClass::beginSmartConfig()
 | 
				
			|||||||
    if (_smartConfigStarted)
 | 
					    if (_smartConfigStarted)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((wifi_get_opmode() & 1) == 0)//1 and 3 have STA enabled
 | 
					    if(_useApMode) {
 | 
				
			||||||
    {
 | 
					        // turn on AP+STA mode
 | 
				
			||||||
        mode(WIFI_AP_STA);
 | 
					        mode(WIFI_AP_STA);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        // turn on STA mode
 | 
				
			||||||
 | 
					        mode(WIFI_STA);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _smartConfigStarted = true;
 | 
					    _smartConfigStarted = true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,6 @@ wl_status_t ESP8266WiFiMulti::run(void) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                WiFi.getNetworkInfo(i, ssid_scan, sec_scan, rssi_scan, BSSID_scan, chan_scan, hidden_scan);
 | 
					                WiFi.getNetworkInfo(i, ssid_scan, sec_scan, rssi_scan, BSSID_scan, chan_scan, hidden_scan);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
                bool known = false;
 | 
					                bool known = false;
 | 
				
			||||||
                for(uint32_t x = 0; x < APlist.size(); x++) {
 | 
					                for(uint32_t x = 0; x < APlist.size(); x++) {
 | 
				
			||||||
                    WifiAPlist_t entry = APlist[x];
 | 
					                    WifiAPlist_t entry = APlist[x];
 | 
				
			||||||
@@ -152,7 +151,17 @@ bool ESP8266WiFiMulti::APlistAdd(const char* ssid, const char *passphrase) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    WifiAPlist_t newAP;
 | 
					    WifiAPlist_t newAP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    newAP.ssid = (char*) malloc(strlen(ssid));
 | 
					    if(!ssid || strlen(ssid) > 31) {
 | 
				
			||||||
 | 
					        // fail SSID to long or missing!
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if(passphrase && strlen(passphrase) > 63) {
 | 
				
			||||||
 | 
					        // fail passphrase to long!
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    newAP.ssid = (char*) malloc((strlen(ssid) + 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(!newAP.ssid) {
 | 
					    if(!newAP.ssid) {
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
@@ -161,16 +170,14 @@ bool ESP8266WiFiMulti::APlistAdd(const char* ssid, const char *passphrase) {
 | 
				
			|||||||
    strcpy(newAP.ssid, ssid);
 | 
					    strcpy(newAP.ssid, ssid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(passphrase && *passphrase != 0x00) {
 | 
					    if(passphrase && *passphrase != 0x00) {
 | 
				
			||||||
        newAP.passphrase = (char*) malloc(strlen(passphrase));
 | 
					        newAP.passphrase = (char*) malloc((strlen(passphrase) + 1));
 | 
				
			||||||
 | 
					        if(!newAP.passphrase) {
 | 
				
			||||||
 | 
					            free(newAP.ssid);
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        strcpy(newAP.passphrase, passphrase);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(!newAP.passphrase) {
 | 
					 | 
				
			||||||
        free(newAP.ssid);
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    strcpy(newAP.passphrase, passphrase);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    APlist.push_back(newAP);
 | 
					    APlist.push_back(newAP);
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user