IOT Based Home Automation
Info: 24255 words (97 pages) Dissertation
Published: 13th Dec 2019
Tagged: Internet of Things
Table of Contents
CHAPTER ONE: INTRODUCTION 1
1.1 Background 1
1.2 Problem statement 1
1.3 Objectives of the study 1
1.3.1 Main objective………………………………………..1
1.3.2 Specific objectives ……………………………………..1
1.3.3 Research questions……………………………………..2
1.4 Research questions 2
1.5 Justification 2
CHAPTER TWO: LITERATURE REVIEW 3
2.1 Home automation 3
2.1.1 What is Home automation?………………………………..3
2.1.2 Convenience…………………………………………4
2.1.3 Safety…………………………………………….4
2.1.4 Energy Savings……………………………………….4
2.2 Internet and IoT 5
2.3 ESP8266 WiFi module 6
2.3.1 Technical Overview…………………………………….7
2.3.2 Features……………………………………………8
2.3.3 Parameters………………………………………….8
2.3.4 Ultra Low Power Technology……………………………….9
2.3.5 Major Applications……………………………………..9
2.3.6 Pin Description………………………………………10
2.3.7 Microcontroller Unit……………………………………10
2.3.8 Firmware & Software Development Kit………………………..11
2.3.9 AT Commands………………………………………12
2.4 Atmega 328P Microcontroller 23
2.4.1 Overview ………………………………………….24
2.4.2 Block Diagram ………………………………………25
2.4.3 Features …………………………………………..27
2.4.4 Pin Description ………………………………………28
2.5 Liquid Crystal Display(LCD) 30
2.5.1 Pin Description ………………………………………30
2.5.2 Working ………………………………………….31
2.6 Relay Driver ULN2003 32
2.6.1 Overview ………………………………………….33
2.6.2 Features …………………………………………..33
2.6.3 Pin description ………………………………………33
2.6.4 Applications ………………………………………..34
2.7 Relays 35
2.7.1 Overview ………………………………………….36
2.7.2 Electromechanical Relay Construction …………………………37
2.7.3 Electrical Relay Contact Tip Materials …………………………38
2.7.4 Electrical Relay Contact Types ……………………………..39
2.7.5 Electrical Relay Contact Configurations ………………………..40
2.8 Voltage Regulator ICs 42
2.8.1 IC 7805…………………………………………..42
2.8.2 IC 1117…………………………………………..43
2.9 Proteus 45
2.9.1 Introduction ………………………………………..46
2.9.2 Product Range Overview ………………………………..47
2.9.3 Library Facilities ……………………………………..47
2.9.4 Routing …………………………………………..48
2.9.5 Verification ………………………………………..50
2.9.6 3D Visualisation……………………………………..50
2.9.7 Output Formats ………………………………………51
2.10 Arduino IDE 52
2.10.1 Introduction ……………………………………….53
2.10.2 Writing Schetches ……………………………………53
2.10.3 Libraries …………………………………………58
2.10.4 Third-Party Hardware ………………………………….58
2.10.5 Serial Monitor ………………………………………58
2.11 Webpage (HTML page) 59
2.11.1 Elements of webpage ………………………………….60
CHAPTER THREE: METHODOLOGY 61
3.1 Block Diagram 61
3.2 Components Required 62
3.2.1 Hardware Requirements …………………………………62
3.2.2 Software Requirements ………………………………….62
3.3 Circuit Schematic 63
3.4 PCB Layout 64
3.5 Home Automation layout 65
3.6 Microcontroller Code 65
3.7 Working 69
CONCLUSION 70
FUTURE WORK 70
REFERENCES 71
CHAPTER ONE: INTRODUCTION
1.1 Background
IOT (Internet of things) based home automation systems mainly focus on controlling the home electronic devices through internet whether you are outside or inside your home. Home automation provides an individual the ability to remotely or automatically control things in the home. A home appliance is a device or instrument designed to perform a specific function, especially an electrical device, such as lights, fan, television, refrigerator, etc for household use.
Automation is today’s fact, where things are being controlled automatically, usually the basic tasks of turning on/off certain devices and beyond, either remotely or in close proximity. Automation lowers the human judgment to the lowest degree possible but does not completely eliminate it. The concept of remote management of household devices over the internet from anywhere, any time in the world today can be a reality. Assume a system where from the office desk, the user could view the status of the devices and decides to take control by tuning on the cooling system, say the air conditioner, and switches on or off some of the lights. This user could walk back home and only finds a very comfortable, pleasant home.
1.2 Problem statement
Many individuals are dependably moving from place to put because of business requests. A few people can spend two or three days from their home leaving all their family unit apparatuses with no sort of observing and control. A few gadgets are left connected to power attachments though others should be connected to and out of energy attachments at various interims relying upon the time. This requires a person to physically take care of each of the gadgets autonomously every once in a while. All such observing and control should be possible without fundamentally being around or inside the home. A few gadgets if not controlled appropriately devour a great deal of vitality which prompts additional consumption on power. In this way I propose to plan a web based home mechanization framework which will empower one to remotely deal with his/her machines from anyplace, at whatever time.
1.3 Objectives of the study
1.3.1 Main objective
To design an IOT based home automation system for controlling home appliances.
1.3.2 Specific objectives
- To examine and recognize the weakness of present home automation systems
- To implement IOT based home automation at lower cost
- To design a flexible IOT based wireless home automation system
- To simulate and test the designed system
1.3.3 Research questions
- How can home appliances be controlled remotely by means of the web?
- How energy efficiency can be achieved?
- How can a gadget’s status be changed remotely by means of the web?
- How can a Internet based home automation system be intended to settle the distinguished shortcomings?
1.4 Scope of the study
My area of interest is to control home appliances remotely using the internet. This project focuses on the controlling of a lights and a fan. With lights and a fan, switching on and off will be considered. Even we can connect any other electrical loads which require 220V A.C supply to run.
All the loads are connected to A.C mains through electromagnetic relays, which are controlled using a microcontroller. These loads are switched on and off as per the commands sent to the microcontroller by the user.
1.5 Justification
Today, a few people flee from their zones of living arrangement and now and again need to travel and avoid their homes for two or three days. Accordingly, there is no get to and control of the family unit machines left at home yet there is a need to monitor the status and conduct of a few apparatuses. For manual control, an individual ought to either always move forward and backward amongst home and work put or have a specialist for every one of the gadgets. Be that as it may, having a chaperon won’t not take care of the issue as by and large the gadgets are such a variety of and circulated to be proficiently, physically controlled by one individual. The machines might be circulated in a few rooms of the house which may require a person to move starting with one room then onto the next each other time attempting to screen and control such apparatuses. Such sort of control may end up being exceptionally frenzied.
On the off chance that a computerized framework is planned, it will decrease on the time, influence wastage and cash required for a man to take care of each of the gadgets at his/her home. With a specific end goal to have accommodation and diminishment in the additional costs brought about in controlling machines at home, paying little mind to whether one is around or far from his/her home, a remote control framework, if outlined can empower the client to consequently control such apparatuses. In this way there is a need to outline a computerization framework in order to mechanize the control of family unit apparatuses.
CHAPTER TWO: LITERATURE REVIEW
2.1 Home automation
2.1.1 What is Home Automation?
Home automation is the residential extension of building automation. It is the automation of the home, housework or household activity. Home automation using the Internet of things is the way that all of our devices and appliances will be networked together to provide us with a seamless control over all aspects of our home and more.
Home automation has been around from numerous decades as far as lighting and straightforward apparatus control, and just as of late has innovation gotten up to speed for the possibility of the interconnected world, permitting full control of your home from anyplace, to end up noticeably a reality. With home automation, you direct how a gadget ought to respond, when it ought to respond, and why it ought to respond. You set the calendar and the rest is mechanized and based off of your own inclinations therefore giving comfort, control, cash investment funds, and a general more brilliant home. Home automation can likewise aware you of occasions that you might need to think about immediately while you are gone like water holes and sudden access to your home, or any piece of it. Whenever, you can get your iPhone, Android gadget or other remote control and change the settings in your home as fancied. In the course of recent decades many organizations have entered the home automation segment.
2.1.2 Convenience
Control and automate pretty much every gadget and machine inside your home whether you are at home or far away. We’ve all gotten used to controlling our TV from the lounge chair; simply hold up until you can diminish the lights also. Envision changing the temperature from your bed or controlling the volume of your entire house sound framework from any room. Or, on the other hand envision the divider/roof radiator in your restroom going ahead naturally on nippy mornings five minutes before your wake up timer goes off with the goal that it is warm when you enter. Many Smart home items likewise spare vitality which we as a whole concur that is a decent accommodation.
2.1.3 Safety
Continuously on protect and primed and ready, home automation gives security, defending your home. From a surveillance camera’s peering eye to a water sensor that will caution you of a conceivable exorbitant release, a computerized home holds your property under reconnaissance so you can respond immediately. We’re altogether used to opening the carport entryway from the auto, yet you’ll be astonished how much more secure you’ll feel returning home to a lit home and not withstanding turning on more lights from your key coxcomb remote upon your landing. Envision your home sending you an email if there is movement where there shouldn’t be any. Or, on the other hand you can have your security framework call you if there is an alert, which may incorporate your regular security caution or even a low or high temperature or water in the pantry or storm cellar.
2.1.4 Energy Savings
Energy saving is considered as one of the most important issue affects the consumers, power system quality and the global environment. The high energy demanded by home appliances, air conditioning and lighting makes homes to be considered as one of the most critical area for the impact of energy consumption. IOT based home automation technology is a good choice for people not only care about security, comfort but energy saving as well. It minimizes the domestic energy waste and can be adapted according to the user habits.
2.2 Internet & IoT
The Internet is the global system of interconnected computer networks that use the Internet protocol suite (TCP/IP) to link devices worldwide. It is a network of networks that consists of private, public, academic, business, and government networks of local to global scope, linked by a broad array of electronic, wireless, and optical networking technologies. The Internet carries an extensive range of information resources and services, such as the inter-linked hypertext documents and applications of the World Wide Web (WWW), electronic mail, telephony, and peer-to-peer networks for file sharing. The Internet is now widely used as a connectivity tool for educational, commercial, and personal applications. The Internet is an exciting portal that makes it possible for users to access virtually an infinite supply of information.
The Internet of things (IoT) is the inter-networking of physical devices, vehicles (also referred to as “connected devices” and “smart devices“), buildings, and other items embedded with electronics, software, sensors, actuators, and network connectivity that enable these objects to collect and exchange data. The IoT allows objects to be sensed or controlled remotely across existing network infrastructure, creating opportunities for more direct integration of the physical world into computer-based systems, and resulting in improved efficiency, accuracy and economic benefit in addition to reduced human intervention. When IoT is augmented with sensors and actuators, the technology becomes an instance of the more general class of cyber-physical systems, which also encompasses technologies such as smart grids, virtual power plants, smart homes, intelligent transportation and smart cities. Each thing is uniquely identifiable through its embedded computing system but is able to interoperate within the existing Internet infrastructure.
2.3 ESP8266 Wi-Fi module
2.3.1 Technical Overview
ESP Systems’ Smart Connectivity Platform (ESCP) is a set of high performance, high integration wireless SOCs, designed for space and power constrained mobile platform designers. It provides unsurpassed ability to embed WiFi capabilities within other systems, or to function as a standalone application, with the lowest cost, and minimal space requirement.
ESP8266 offers a complete and self-contained WiFi networking solution. It can be used to host the application or to offload WiFi networking functions from another application processor. When ESP8266 hosts the application, it boots up directly from an external flash. In has integrated cache to improve the performance of the system in such applications. Alternately, serving as a WiFi adapter, wireless internet access can be added to any micro controller based design with simple connectivity (SPI/SDIO or I2C/UART interface). ESP8266 is among the most integrated WiFi chip in the industry. It integrates the antenna switches, RF balun, power amplifier, low noise receive amplifier, filters, power management modules, it requires minimal external circuitry, and the entire solution, including front-end module, is designed to occupy minimal PCB area. ESP8266 also integrates an enhanced version of Tensilica’s L106 Diamond series 32-bit processor, with on-chip SRAM, besides the WiFi functionalities. ESP8266 is often integrated with external sensors and other application specific devices through its GPIOs; sample codes for such applications are provided in the software development kit (SDK).
ESP Systems’ Smart Connectivity Platform (ESCP) systems demonstrates sophisticated system-level features include fast sleep/wake context switching for energy-efficient VoIP, adaptive radio biasing for low-power operation, advance signal processing, and spur cancellation and radio co-existence features for common cellular, Bluetooth, DDR, LVDS, LCD interference mitigation.
2.3.2 Features
- 802.11 b/g/n
- Integrated low power 32-bit MCU
- Integrated 10-bit ADC
- Supports antenna diversity
- WiFi 2.4 GHz, support WPA/WPA2
- Standby power consumption of < 1.0mW (DTIM3)
- Integrated TCP/IP protocol stack
- Integrated TR switch, balun, LNA, power amplifier and matching network
- Integrated PLL, regulators, and power management units
- +20 dBm output power in 802.11b mode
- Operating temperature range -40C ~ 125C
- FCC, CE, TELEC, WiFi Alliance, and SRRC certified
- Support STA/AP/STA+AP operation modes
- Support Smart Link Function for both Android and iOS devices
- SDIO 2.0, (H) SPI, UART, I2C, I2S, IR Remote Control, PWM, GPIO
- STBC, 1×1 MIMO, 2×1 MIMO
- A-MPDU & A-MSDU aggregation & 0.4s guard interval
- Deep sleep power <10uA, Power down leakage current < 5uA
- Wake up and transmit packets in < 2ms
2.3.3 Parameters
Categories | Items | Values |
WiFi Paramters | Certificates | FCC/CE/TELEC/SRRC |
WiFi Protocles | 802.11 b/g/n | |
Frequency Range | 2.4G-2.5G (2400M-2483.5M) | |
Tx Power | 802.11 b: +20 dBm | |
802.11 g: +17 dBm | ||
802.11 n: +14 dBm | ||
Rx Sensitivity | 802.11 b: -91 dbm (11 Mbps) | |
802.11 g: -75 dbm (54 Mbps) | ||
802.11 n: -72 dbm (MCS7) | ||
Types of Antenna | PCB Trace, External, IPEX Connector, Ceramic Chip | |
Hardware Paramaters | Peripheral Bus | UART/SDIO/SPI/I2C/I2S/IR Remote Control |
GPIO/PWM | ||
Operating Voltage | 3.0~3.6V | |
Operating Current | Average value: 80mA | |
Operating Temperature Range | -40°~125° | |
Ambient Temperature Range | Normal temperature | |
Package Size | 5x5mm | |
External Interface | N/A | |
Software Parameters | WiFi mode | station/softAP/SoftAP+station |
Security | WPA/WPA2 | |
Encryption | WEP/TKIP/AES | |
Firmware Upgrade | UART Download / OTA (via network) | |
Software Development | Supports Cloud Server Development / SDK for custom firmware development | |
Network Protocols | IPv4, TCP/UDP/HTTP/FTP | |
User Configuration | AT Instruction Set, Cloud Server, Android/ iOS App |
2.3.4 Ultra Low Power Technology
ESP8266 has been intended for portable, wearable hardware and Internet of Things applications with the point of accomplishing the most reduced power utilization with a mix of a few exclusive procedures. The power sparing design works predominantly in 3 modes: dynamic mode, rest mode and profound rest mode. By utilizing advance power administration methods and rationale to shut down capacities not required and to control exchanging amongst rest and dynamic modes, ESP8266 expends about than 60uA in profound rest mode (with RTC clock as yet running) and under 1.0mA (DTIM=3) or under 0.5mA (DTIM=10) to remain associated with the get to point. At the point when in rest mode, just the aligned continuous clock and guard dog stays dynamic. The constant clock can be modified to awaken the ESP8266 at any required interim. The ESP8266 can be customized to wake up when a predetermined condition is distinguished. This negligible wake-up time highlight of the ESP8266 can be used by cell phone SOCs, permitting them to stay in the low-control standby mode until WiFi is required. Keeping in mind the end goal to fulfill the power request of portable and wearable gadgets, ESP8266 can be customized to diminish the yield energy of the PA to fit different application profiles, by exchanging off range for power utilization.
2.2.5 Major Applications
Major fields of ESP8266EX applications to Internet-of-Things include:
- Home Appliances
- Home Automation
- IP Cameras
- Sensor Networks
- Wearable Electronics
- WiFi Location-aware Devices
- Security ID Tags
- Industrial Wireless Control
- Baby Monitors
- WiFi Position System Beacons
- Smart Plug and lights
2.2.6 Pin Description
- RXD – UART Receive during flash programming. Serial data is received through this pin.
- GPIO0 – General purpose Input/Output pin0. This pin is made low during flash operation.
- GPIO2 – General Purpose Input/Output pin2.
- GND – Ground terminal for power supply.
- TXD – UART Receive during flash programming. Serial data is transmitted through this pin.
- CH_PD – Active high chip enable pin. High: On, chip works properly; Low: Off, small current.
- RST – Active low external reset pin.
- VCC – Power supply (3.0V-3.6V).
2.2.7 Microcontroller unit
ESP8266EX is embedded with Tensilica L106 32-bit micro controller (MCU), which features extra low power consumption and 16-bit RSIC. The CPU clock speed is 80MHz. It can also reach a maximum value of 160MHz. Real Time Operation System (RTOS) is enabled. Currently, only 20% of MIPS has been occupied by the WiFi stack, the rest can all be used for user application programming and development. The following interfaces can be used to connect to the MCU embedded in ESP8266EX:
- Programmable RAM/ROM interfaces (iBus), which can be connected with memory controller, and can also be used to visit external flash.
- Data RAM interface (dBus), which can connect with memory controller.
- AHB interface can be used to visit the register.
2.2.8 Firmware & Software Development Kit
The application and firmware is executed in on-chip ROM and SRAM, which loads the instructions during wake-up, through the SDIO interface, from the external flash. The firmware implements TCP/IP, the full 802.11 b/g/n/e/i WLAN MAC protocol and WiFi Direct specification. It supports not only basic service set (BSS) operations under the distributed control function (DCF) but also P2P group operation compliant with the latest WiFi P2P protocol. Low level protocol functions are handled automatically by ESP8266:
- RTS/CTS
- acknowledgement
- fragmentation and defragmentation
- aggregation
- frame encapsulation (802.11h/RFC 1042)
- automatic beacon monitoring / scanning, and
- P2P WiFi direct
Passive or active scanning, as well as P2P discovery procedure is performed autonomously once initiated by the appropriate command. Power management is handled with minimum host interaction to minimize active duty period. The SDK includes the following library functions:
- 802.11 b/g/n/d/e/i/k/r support
- WiFi Direct (P2P) support
- P2P Discovery, P2P Group Owner mode, P2P Power Management.
- Infrastructure BSS Station mode / P2P mode / softAP mode support.
- Hardware accelerators for CCMP (CBC-MAC, counter mode), TKIP (MIC, RC4), WAPI (SMS4), WEP (RC4), CRC.
- WPA/WPA2 PSK, and WPS driver
- Additional 802.11i security features such as pre-authentication, and TSN.
- Open Interface for various upper layer authentication schemes over EAP such as TLS, PEAP, LEAP, SIM, AKA, or customer specific.
- 802.11n support (2.4GHz)
- Supports MIMO 1×1 and 2×1, STBC, A-MPDU and A-MSDU aggregation and 0.4μs guard interval.
- WMM power save U-APSD
- Multiple queue management to fully utilize traffic prioritization defined by 802.11e standard.
- UMA compliant and certified
- 802.1h/RFC1042 frame encapsulation
- Scattered DMA for optimal CPU off load on Zero Copy data transfer operations.
- Antenna diversity and selection (software managed hardware).
- Clock/power gating combined with 802.11-compliant power management dynamically adapted to current connection condition providing minimal power consumption.
2.2.9 AT commands
ESP8266, in it’s default configuration, boots up into the serial modem mode. In this mode you can communicate with it using a set of AT commands. Historically AT commands are based on the Hayes Command Set and these are no different. AT command set is divided into: Basic AT commands, Wi-Fi AT commands, TCP/IP AT commands. ESP8266 expects <CR> and <LF> or Carriage Return and Line Feed at the end of each command, but just<CR> seems to work too.
a. Command description
Each command can have up to 4 variants changing the function of it. You can chose between them by appending one of four possible values to the end of the root command itself. These four appendices can have the following values “”,=<parameter|[parameters]>,”?”,=?
Type | Example | Description |
Test | AT + < x > =? | Query the Set command or internal parameters and its
range values. |
Query | AT + < x >? | Returns the current value of the parameter. |
Set | AT + < x > = < x > | Set the value of user-defined parameters in commands and run. |
Execute | AT + < x > | Runs commands with no user-defined parameters. |
Notes:
1. Not all AT commands support all the above mentioned four variations.
2. [] = default value, not required or may not appear
3. String values require double quotation marks, for example:
AT+CWSAP=”ESP756290″, “21030826”, 1, 4
4. Default Baud rate = 115200
5. AT commands have to be capitalized, and must terminate with “/r/n”. Terminal programs must be set up accordingly (refer to screenshot below).
b. Basic AT Commands
AT – Test AT startup
Variant | Command | Response | Function |
Execute | AT | OK | Test if AT system works correctly |
AT+RST – Restart module
Variant | Command | Response | Function |
Execute | AT+RST | OK | Reset the module |
AT+GMR – View version info
Variant | Command | Response | Function |
Execute | AT+GMR | version, OK | Print firmware version |
AT+GSLP – Enter deep-sleep mode
Variant | Command | Response | Function |
set | AT+GSLP=time | Time OK | Enter deep sleep mode for time milli seconds |
ATE – Enable / Disable echo
Variant | Command | Response | Function |
Execute | ATE0 | OK | Disable echo (Doesn’t send back received command) |
Execute | ATE1 | OK | Enable echo (Sends back received command before response) |
AT+CWMODE – WIFI mode( station, AP, station + AP)
Variant | Command | Response | Function |
Test | AT+CWMODE=? | +CWMODE:(1-3) OK | List valid modes |
Query | AT+CWMODE? | +CWMODE: mode OK | Query AP’s info which is connecting by ESP8266. |
Execute | AT+CWMODE= mode | OK | Set AP’s info which will be connecting by ESP8266. |
b. WiFi related AT Commands
AT+CWJAP – Connect to AP
Variant | Command | Response | Function |
Query | AT+CWJAP? | +CWJAP: ssid OK | Prints the SSID of Access Point ESP8266 is connected to. |
Execute | AT+CWJAP= ssid, pwd | OK | Commands ESP8266 to connect a SSID with supplied password. |
Example:
AT+CWJAP=”my-test-wifi”,”1234test”
Example:
AT+CWJAP?:+CWJAP:”my-test-wifi”
AT+CWLAP – Lists available APs
Variant | Command | Response | Function |
Set | AT+CWLAP=ssid,mac,ch | +CWLAP:ecn,ssid,rssi,macOK | Search available APs with specific conditions. |
Execute | AT+CWLAP | AT+CWLAP:ecn,ssid,rssi,macOK | Lists available Access Points. |
Parameters:
- ecn:
- 0 = OPEN
- 1 = WEP
- 2 = WPA_PSK
- 3 = WPA2_PSK
- 4 = WPA_WPA2_PSK
- ssid: String, SSID of AP
- rssi: signal strength
- mac: String, MAC address
Note:
On ESP-01 I have had no luck with the set version of this command (AT+CWLAP=…). If you know what it does please let me know.
Example AT+CWLAP:
+CWLAP:(3,”CVBJB”,-71,”f8:e4:fb:5b:a9:5a”,1)
+CWLAP:(3,”HT_00d02d638ac3″,-90,”04:f0:21:0f:1f:61″,1)
+CWLAP:(3,”CLDRM”,-69,”22:c9:d0:1a:f6:54″,1)
+CWLAP:(2,”AllSaints”,-88,”c4:01:7c:3b:08:48″,1)
+CWLAP:(0,”AllSaints-Guest”,-83,”c4:01:7c:7b:08:48″,1)
AT+CWQAP – Disconnect from AP
Variant | Command | Response | Function |
Execute | AT+CWQAP | OK | Disconnect ESP8266 from the AP is currently connected to. |
Note:
After running this command, if you run AT+CWJAP? it still shows the AP you were connected to before.
AT+CWSAP – Configuration of softAP mode
Variant | Command | Response | Function |
Query | AT+CWSAP? | +CWSAP:ssid,pwd,ch,ecnOK | Query configuration of ESP8266 softAP mode. |
Set | AT+CWSAP=ssid,pwd,ch,ecn | OK | Set configuration of softAP mode. |
Parameters:
- ssid: String, ESP8266’s softAP SSID
- pwd: String, Password, no longer than 64 characters
- ch: channel id
- ecn:
- 0 = OPEN
- 2 = WPA_PSK
- 3 = WPA2_PSK
- 4 = WPA_WPA2_PSK
Example
AT+CWSAP=”esp_123″,”1234test”,5,3
AT+CWSAP? => +CWSAP:”esp_123″,”1234test”,5,3
AT+CWLIF – List clients connected to ESP8266 softAP
Variant | Command | Response | Function |
Execute | AT+CWLIF | [ip,other] OK | List information on of connected clients. |
Parameters:
ip: IP address of a client connected to the ESP8266 softAP other: Other info, look at example. I don’t know what it means yet.
Example (ESP-01):
AT+CWLIF
192.168.4.100,3fff50b4:3fff50ba:3fff50c0:3fff50c6:3fff50cc:3fff50d2
OK
AT+CWDHCP – Enable/Disable DHCP
Variant | Command | Response | Function |
Set | AT+CWDHCP=mode,en | OK | Enable or disable DHCP for selected mode |
Parameters:
- mode:
- 0 : set ESP8266 as a softAP
- 1 : set ESP8266 as a station
- 2 : set both ESP8266 to both softAP and a station
- en:
- 0 : Enable DHCP
- 1 : Disable DHCP
AT+CIPSTAMAC – Set MAC address of ESP8266 station
Variant | Command | Response | Function |
Query | AT+CIPSTAMAC? | +CIPSTAMAC:macOK | Print current MAC ESP8266’s address. |
Execute | AT+CIPSTAMAC=mac | OK | Set ESP8266’s MAC address. |
Parameters:
- mac: String, MAC address of the ESP8266 station.
Example:
AT+CIPSTAMAC=”18:aa:35:97:d4:7b”
AT+CIPAPMAC – Set MAC address of ESP8266 softAP
Variant | Command | Response | Function |
Query | AT+CIPAPMAC? | +CIPAPMAC:macOK | Get MAC address of ESP8266 softAP. |
Execute | AT+CIPAPMAC=mac | OK | Set mac of ESP8266 softAP. |
Parameters:
- mac: String, MAC address of the ESP8266 softAP.
Example:
AT+CIPAPMAC=”2c:aa:35:97:d4:7b”
AT+CIPSTA – Set IP address of ESP8266 station
Variant | Command | Response | Function |
Query | AT+CIPSTA? | +CIPSTA:ipOK | Get IP address of ESP8266 station. |
Execute | AT+CIPSTA=ip | OK | Set ip addr of ESP8266 station. |
Parameters:
- ip: String, ip address of the ESP8266 station.
Example:
AT+CIPSTA=”192.168.101.108”
AT+CIPAP – Set ip address of ESP8266 softAP
Variant | Command | Response | Function |
Query | AT+CIPAP? | +CIPAP:ip OK | Get ip address of ESP8266 softAP. |
Execute | AT+CIPAP=ip | OK | Set ip addr of ESP8266 softAP. |
Parameters:
- ip: String, ip address of ESP8266 softAP.
Example:
AT+CIPAP=”192.168.5.1″
c. TCP/IP related AT commands
AT+CIPSTATUS – Information about connection
Variant | Command | Response | Function |
Test | AT+CIPSTATUS=? | OK | |
Execute | AT+CIPSTATUS | STATUS:status+CIPSTATUS:id,type,addr,port,tetypeOK | Get information about connection. |
Parameters:
- status:
- 2: Got IP
- 3: Connected
- 4: Disconnected
- id: id of the connection (0~4), for multi-connect
- type: String, “TCP” or “UDP”
- addr: String, IP address.
- port: port number
- tetype:
- 0 = ESP8266 runs as a client
- 1 = ESP8266 runs as a server
Note:
On ESP-01 this command returns STATUS:1 instead (no extra info, but status changes) On 0018000902-AI03 this command returns STATUS:2 instead (no extra info, but status changes)
AT+CIPSTART – Establish TCP connection or register UDP port and start a connection
Variant | Command | Response | Function |
Set | AT+CIPSTART=type,addr,port | OK | Start a connection as client. (Single connection mode) |
Set | AT+CIPSTART=id,type,addr,port | OK | Start a connection as client. (Multiple connection mode) |
Test | AT+CIPSTART=? | [+CIPSTART:(id)(“type”),(“ip address”),(port)] OK | List possible command variations) |
Parameters:
- id: 0-4, id of connection
- type: String, “TCP” or “UDP”
- addr: String, remote IP
- port: String, remote port
AT+CIPSEND – Send data
Variant | Command | Response | Function |
Test | AT+CIPSEND=? | OK | |
Set | AT+CIPSEND=length | SEND OK | Set length of the data that will be sent. For normal send (single connection). |
Set | AT+CIPSEND=id,length | SEND OK | Set length of the data that will be sent. For normal send (multiple connection). |
Execute | AT+CIPSEND | Send data. For unvarnished transmission mode. |
Parameters:
- id: ID no. of transmit connection
- length: data length, MAX 2048 bytes
AT+CIPCLOSE – Close TCP or UDP connection
Variant | Command | Response | Function |
Test | AT+CIPCLOSE=? | OK | |
Set | AT+CIPCLOSE=id | OK | Close TCP or UDP connection.For multiply connection mode |
Execute | AT+CIPCLOSE | OK | Close TCP or UDP connection.For single connection mode |
Parameters:
- id: ID no. of connection to close, when id=5, all connections will be closed.
AT+CIFSR – Get local IP address
Variant | Command | Response | Function |
Test | AT+CIFSR=? | OK | |
Execute | AT+CIFSR | +CIFSR:ip OK | Get local IP address. |
Parameters:
- ip: IP address of the ESP8266 as an client.
Example AT+CIFSR:
10.101.10.134
AT+CIPMUX – Enable multiple connections or not
Variant | Command | Response | Function |
Set | AT+CIPMUX=mode | OK | Enable / disable multiplex mode (up to 4 conenctions) |
Query | AT+CIPMUX? | +CIPMUX:modeOK | Print current multiplex mode. |
Parameters:
- mode:
- 0: Single connection
- 1: Multiple connections (MAX 4)
NOTE:
This mode can only be changed after all connections are disconnected. If server is started, reboot is required.
AT+CIPSERVER – Configure as server
Variant | Command | Response | Function |
Set | AT+CIPSERVER=mode[,port] | OK | Configure ESP8266 as server |
Parameters:
- mode:
- 0: Delete server (need to follow by restart)
- 1: Create server
- port: port number, default is 333
NOTE:
- Server can only be created when AT+CIPMUX=1
- Server monitor will automatically be created when Server is created.
- When a client is connected to the server, it will take up one connection,be gave an id.
AT+CIPMODE – Set transfer mode
Variant | Command | Response | Function |
Query | AT+CIPMODE? | +CIPMODE:modeOK | Set transfer mode,normal or transparent transmission. |
Set | AT+CIPMODE=mode | OK | Set transfer mode,normal or transparent transmission. |
Parameters:
- mode:
- 0: normal mode
- 1: unvarnished transmission mode
AT+CIPSTO – Set server timeout
Variant | Command | Response | Function |
Query | AT+CIPSTO? | +CIPSTO:time | Query server timeout. |
Set | AT+CIPSTO=time | OK | Set server timeout. |
Parameters:
- time: server timeout, range 0~7200 seconds
AT+CIUPDATE – update through network
Variant | Command | Response | Function |
Execute | AT+CIUPDATE | +CIPUPDATE:n OK | Start update through network |
Parameters:
-n:
– 1: found server
– 2: connect server
– 3: got edition
– 4: start update
Example:
AT+CIUPDATE
+CIUPDATE: 1
+CIUPDATE: 2
+CIUPDATE: 3
+CIUPDATE: 4