In this road test I am going to test an AZDelivery ESP8266 ESP-12F NodeMCU Lua Amica V2, Wifi IoT Module with CP2102, it is a development Board compatible with Arduino, nodeMCU Lua, micropython, etc..
Different functionalities of the module are tested, as a module for Wi-Fi connection of other devices or as an independent microcontroller. Different firmware, AT commands without OS, AT commands with freeRTOS, programming in NodeMCU LUA, programming with ESP8266 core for Arduino, programming in micropython and other IoT solutions that do not require programming such as SENSATE.IO or ThingSpeak are tested.
More info about the module in AZDelivery ESP8266 ESP-12F NodeMCU Lua Amica V2
NodeMCU LUA Amica V2 is a development board created around ESP8266 chip, containing voltage regulator and USB programmer circuit for ESP8266 chip, and a few other features for Internet of Things (IoT) projects.
For the development of applications you can choose between
- The Arduino IDE
- NodeMCU with LUA language scripting.
- Micropython
- C/C++, etc..
The module comes with a pre-installed firmware which allows you to send AT commands scripts through the serial port. It uses the CP2102 chip.
My impressions of the module
Although the module has fewer features than other Wi-Fi connection solutions, it makes it ideal for small projects thanks to its low price and the large amount of information and solutions in the public domain.
I have really enjoyed trying this module, everything has worked the first time and the possibilities are endless. I am going to prepare several projects for this module.
Pros
- Large online community and lots of tutorials for beginners.
- Cheap, readily available, many dev boards with documentation
- Compatible with: Arduino, NodeMCU
- Programming choices: C, C++, Lua, Micropython.
- Many ready-to-use IoT solutions without programming a line.
- Lots of libraries available mostly open-source SDK, with GDB.
- I2S protocol by hardware. Spit out continuous datastreams.
Contras
- ADC input range of 0-1V, and only single channel
- Interrupts can be used on the ESP8266, but they must be used with care and have several limitations. It is difficult to use interrupts so most user code has to be timer or task-based
- No I2C hardware, you have to use I2C software solutions so it blocks while communicating.
- Requirements to enter sleep mode can be confusing.
- Watchdog timer, so user tasks cannot exceed a certain amount of time.
- The ESP does not have PWM hardware, so the implementation is done by software. The more PWM outputs that are used and the higher their frequency, the closer you will be to the CPU limits and the fewer CPU cycles available for sketch execution.
- No DMA, no hardware crypto module
The ESP8266 series of Wi-Fi chips are designed by Espressif Systems.
ESP8266 is a system-on-chip (SoC) integrating a 32-bit Tensilica microcontroller, standard digital peripheral interfaces, antenna switches, RF balun, power amplifier, low noise receive amplifier, filters and power management modules into a small package. It provides 2.4GHz Wi-Fi (802.11 b/g/n, supporting both WPA and WPA2), 17 GPIO pins, I2C (IIC) interface, analog to digital conversion (10-bit, on one pin), SPI interface, UART (on dedicated pins, plus a transmit-only UART can be enabled on GPIO2), and PWM (Pulse Width Modulation) in software on every GPIO pin.
The processor core, called “L106” by Espressif, is based on Tensilica Diamond Standard 106Micro 32-bit processor controller core and runs at 80MHz. It has a 64kB boot ROM, 32kB instruction RAM, and 80kB user data RAM. External flash memory can be accessed through SPI interface.
The chip itself has fewer features than other more expensive wifi chips, such as no DMA, no hardware crypto module and single-channel ADC instead of multi-channel.
The ESP-12F WiFi module was developed by Ai-Thinker Technology. The core processor ESP8266 integrates the industry-leading Tensilica L106 ultra-low-power 32-bit micro MCU in a small package with 16-bit Lite mode, clocked at Supports 80 MHz and 160 MHz, supports RTOS, and integrates Wi-Fi MAC/BB/RF/PA/LNA. The ESP-12F WiFi module supports the standard IEEE802.11 b/g/n protocol, a complete TCP/IP protocol stack. Users can use this module to add networking capabilities to existing devices or to build separate network controllers.
The ESP8266 is a complete and self-contained WiFi network solution that can operate independently or as a slave running on other host MCUs. The ESP8266 is capable of booting directly from an external flash memory when it is powered by an application and is the only application processor in the device. The built-in cache helps improve system performance and reduce memory requirement
With wireless, clients sometimes go into a powersaving mode where they "sleep" for a while. The client waits for the AP to wake up each time there is any unicast packets for it. This time is measured in beacon intervals and is called the "listen interval." For this beacon, All clients are expected to wake up and listen to broadcast traffic when receiving a special message named Delivery Traffic Indication Message (DTIM). The number of beacons between DTIMs is configurable per SSID. The ESP 12F support multiple sleep patterns:
- Modem-sleep is used when such applications as PWM or I2S require the CPU to be working. In cases where Wi-Fi connectivity is maintained and data transmission is not required, the Wi-Fi Modem circuit can be shut down to save power, according to 802.11 standards (such as U-APSD). In DTIM3, when ESP8266EX sleeps for 300 ms and wakes up for 3 ms to receive Beacon packages from AP, the overall average current consumption is about 20 mA.
- Light-sleep is used for applications whose CPU may be suspended, such as Wi-Fi switch. In cases where Wi-Fi connectivity is maintained and data transmission is not required, WiFi Modem circuit and CPU can be shut down to save power, according to 802.11 standards (such as U-APSD). In DTIM3, when ESP8266EX sleeps for 300 ms and wakes up for 3 ms to receive Beacon packages from AP, the overall average current consumption is about 2 mA.
- Deep-sleep is for applications that do not require Wi-Fi connectivity and only transmit data over long time lags, e.g., a temperature sensor that measures temperature every 100s. When ESP8266EX sleeps for 300s then wakes up to connect to AP (taking about 0.3 ~ 1s), the overall average current consumption is far less than 1 mA.
No soldering is necessary. The headers are already soldered. The NodeMCU board is specially designed to work on breadboard. It has a voltage regulator that allows it to power directly from the USB port.
Input/Output voltage
The input/output pins work at 3.3V.
Serial communication integrated
The CP2102 chip is responsible for USB to serial communication.
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
Specification:
- Power supply voltage (USB): 5V DC
- Input/Output voltage: 3.3V DC
- SoC: ESP8266 (ESP-12F Module)
- CPU: Tensilica Xtensa LX3 (32 bit)
- Clock frequency: 80MHz / 160MHz
- Instruction RAM: 32kB
- Data RAM: 96kB
- External flash memory: 4MB
- GPIO digital pins: 17
- ADC analog pin: 1 (BUT voltage range is: 0 - 1V)
- UART: 2
- USB serial chip: CP2102
- PCB antenna
- 802.11 b/g/n
- Wi-Fi Direct (P2P), soft-AP
- Integrated TCP/IP Protocol Stack
- Output power of + 19.5dBm in 802.11b mode
- Leakage current less than 10uA
- Wake up and transmit packets in <2ms
- Standby power consumption <1.0mW (DTIM3)
- Digital input/outputs operate at 3.3V, 5V voltage should not be connected to any ESP8266 chip pins! The pins are not 5V tolerant, applying more than 3.6V on any pin will destroy the chip.
- The maximum current that can be drawn from a single GPIO pin is 12mA.
- ESP8266 has 17 GPIO pins, however, you can only use 11 of them, because 6 pins (GPIO 6 - 11) are used to connect the flash memory chip. This is the small 8-pin IC right next to the ESP8266.
- GPIO 1 and 3 are used as TX and RX of the hardware Serial port (UART), so in most cases, you can not use them as normal I/O while sending/receiving serial data.
- External pull down resistor of 1kΩ is required on GPIO0, external pull up resistor on GPIO2 is not required, the internal pull up on this pin is enabled at boot.
- GPIO15 is always pulled LOW, so you can not use the internal pull-up resistor on this pin. Keep this in mind when using GPIO15 as an input to read a switch or connect it to a device with an open-collector (or open-drain) output, like I2C.
- GPIO0 is pulled HIGH during normal operation.
- GPIO2 can not be LOW at boot, so you can not connect a switch to it.
- Digital pins are named from D0 to D12
- GPIO 0-15 all have a built-in pull up resistor, just like in an Arduino.
- GPIO16 has a built-in pull down resistor.
- The ESP8266 has a single analog input pin, with an input voltage range from 0.0V to 1.0V. If you supply voltage of 3.3V, for example, you will damage the chip.
- The NodeMCU has an on-board resistive voltage divider, to get an easier 0 - 3.3V range. The ADC (analog to digital converter) has a resolution of 10 bits.
- The ESP can also use the ADC to measure the supply voltage (VCC).
- The ESP8266 has two hardware UARTS (Serial ports): UART0 on pins 1 and 3 (TX0 and RX0 resp.), and UART1 on pins 2 and 8 (TX1 and RX1 resp.), however, GPIO8 is used to connect the flash chip. This means that UART1 can only transmit data. Additionally UART0 has hardware flow control on pins 15 and 13 (RTS0 and CTS0 respectively). These two pins can also be used as alternative TX2 and RX2 pins.
There are four power pins. VIN pin and three 3.3V pins.
- There are four power pins. VIN pin and three 3.3V pins.
VIN can be used to directly supply the NodeMCU/ESP8266 and its peripherals. Power delivered on VIN is regulated through the onboard regulator on the NodeMCU module – you can also supply 5V regulated to the VIN pin - 3.3V pins are the output of the onboard voltage regulator and can be used to supply power to external components.
- GND are the ground pins of NodeMCU/ESP8266
Few I/O pins have a special function during boot, they select one of three
Boot modes:
D/C: Don't care
To get into bootloader mode where we can program over the UART, we must boot with GPIO2 high (which it will do on its own because of the internal pullup), and GPIO0/15 low.
This can be accomplished by adding either a button or other circuitry to pull GPIO0 down to ground. When the button is released, it will boot from Flash as normal. With this dev kit you don't need to do anything to put it in flash mode, as the USB connection can pull GPIO0 low by asserting DTR and reset your board by asserting RTS.
To boot from an SD card, pull GPIO15 high at boot (it ignores GPIO0/2 in this state).
Installing CP2102 driver in Windows 10
CP210x USB to UART Bridge VCP Drivers. The CP210x USB to UART Bridge Virtual COM Port (VCP) drivers are required for device operation as a Virtual COM Port to facilitate host communication with CP210x products.
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
Then plug the mini usb
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.
https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
You can use any serial terminal like Arduino serial monitor to connect to que ESP8266 and send AT commands. Or you can use other serial terminal like Realterm https://sourceforge.net/projects/realterm/
AT commands are based on the Hayes Command Set used in old modems.
Connect to the ESP8266 at 115200 baud, 8 bits, 1 stop bit, no parity, no hardware flow control. No software flow control.
Line termination
ESP8266 expects <CR><LF> or CarriageReturn and LineFeed at the end of each command.
Test AT startup
AT command Test if AT system works correctly and responds OK
AT+RST - Restart module
AT+RST
OK
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8
2nd boot version : 1.6
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000
AT+GMR - View version info
+GMR
AT version:1.3.0.0(Jul 14 2016 18:54:01)
SDK version:2.0.0(5a875ba)
v1.0.0.3
Mar 13 2018 09:37:06
OK
Connecting to a Wifi access point
Check mode first
- AT+CWMODE wifi mode
- AT+CWMODE=<mode>
- 1= Sta, 2= AP, 3=both
AT+CWMODE?
+CWMODE:2
OK
It is as Access point, change to station:
AT+CWMODE=1
OK
Enable DHCP
AT+CWDHCP=1,1
OK
List wifi ap
AT+CWLAP
+CWLAP:(4,"MOVISTAR_E1E6",-71,"98:de:d0:a0:9c:54",1,-34,0)
+CWLAP:(2,"MOVISTAR_E1E6",-69,"f8:8e:85:eb:e1:e7",1,-31,0)
+CWLAP:(3,"MOVISTAR_4083",-77,"98:97:d1:a0:40:84",1,-2,0)
+CWLAP:(3,"MOVISTAR_EF30",-74,"d4:7b:b0:96:ef:31",1,-51,0)
+CWLAP:(2,"123456789",-30,"F4:88:8b:92:c0:01",6,-36,0)
+CWLAP:(3,"vodafoneBA1121",-62,"14:2e:5e:c9:5f:d8",6,-29,0)
+CWLAP:(3,"MOVISTAR_5BB4",-88,"cc:ed:dc:04:5b:b5",6,-39,0)
+CWLAP:(3,"MOVISTAR_38E4",-70,"cc:d4:a1:26:38:e6",6,-39,0)
+CWLAP:(3,"MOVISTAR_2A33",-87,"d8:fb:5e:6d:2a:34",1,-42,0)
+CWLAP:(3,"Vodafone22",-53,"e0:60:66:4c:ea:31",11,-14,0)
+CWLAP:(3,"Vodafone71",-70,"0e:41:58:00:b4:29",11,-36,0)
+CWLAP:(3,"Orange-2AED",-77,"a8:d3:f7:73:2a:ef",11,-22,0)
+CWLAP:(3,"MOVISTAR_D2FB",-55,"cc:d4:a1:9a:d2:fc",11,-54,0)
+CWLAP:(3,"LowiC9E0",-90,"d4:60:e3:a5:c9:e1",11,-34,0)
OK
Connect to access point
AT+CWJAP="123456789","mywifipassword.Really?"
WIFI CONNECTED
WIFI GOT IP
OK
You're connected. Lets ping hackster.io
AT+PING="www.hackster.io"
+38
OK
AT FirmwareMaybe your module has another firmware and doesn't respond to AT commands.
You can download the latest AT firmware from Espressif Systems
There are two main implementations of AT firmaware:
- The new ESP8266 AT v2.0, that implements the AT firmware based on the new IDF style ESP8266_RTOS_SDK.
- And the old ESP8266 NonOS AT.
Some of the AT commands in the new ESP8266 AT v2.0 are different with the old one so Espressif recommends that the new version is only used for the implementation of new projects, instead of being used as an upgrade for any existing mass-production projects.
To run the ESP8266 AT, you can download the binary in ESP8266-IDF-AT/factory to address 0x0. The ESP8266 IDF AT sends AT commands through the following pins:
- GPIO13 is RXD
- GPIO15 is TXD
- GPIO1 is RTS (Optional)
- GPIO3 is CTS (Optional)
https://docs.espressif.com/projects/esp-at/en/latest/AT_Binary_Lists/ESP8266_AT_binaries.html
Lets give a try to the newest version.
ESP-AT-Bin files contains several binaries for some specific functions, and the factory/factory/xxx.bin is the combination of all binaries. So user can only download the factory/factory_xxx.bin to address 0, or several binaries to different addresses according to ESP-AT-Bin/download.config.
Using esptool
esptool --port COM9 write_flash -fm dio 0x00000 factory_WROOM-02.bin
Factory WROOM version v2.1.0.0
To play with the AT commands now you can bridge TXD0 with TXD2 and RXD0 with RXD"
AT+GMR
AT version:2.1.0.0(ded5b14 - Jul 24 2020 12:01:05)
SDK version:v3.3-2-gb6e861a
compile time(36bb200):Jul 28 2020 08:30:34
Bin version:2.1.0(WROOM-02)
OK
http://wiki.ai-thinker.com/esp8266/examples/at_demo
How to Use ESP8266/NodeMCU with Arduino IDEArduino core for ESP8266 WiFi chip
https://github.com/esp8266/Arduino
ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, and work with SD cards, servos, SPI and I2C peripherals.
- Start Arduino and open the Preferences window.
- Enter https://arduino.esp8266.com/stable/package_esp8266com_index.json into the Additional Board Manager URLs field. You can add multiple URLs.
- Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
Documentation: https://arduino-esp8266.readthedocs.io/
Then go to the board manager and install esp8266:
Select your board:
Tools > Board > NodeMCU 1.0 (ESP - 12E Module)
To upload the sketch code to the NodeMCU board, first select port on which you connected the board.
NodeMCU FirmwareThe NodeMCU is an open-source firmware and development kit that helps you to prototype your IoT product within a few Lua script lines. NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266, and hardware which is based on the ESP-12 module. The term “NodeMCU” refers to the firmware rather than the development kits. The firmware uses the Lua scripting language. It is based on the eLua project, and built on the Espressif Non-OS SDK for ESP8266.
Features of NodeMCU:
- Development Kit - based on ESP8266
- Arduino-like hardware IO
- Nodejs style network API - Event-driven API for network applications
- Lowest cost WI-FI
-- a simple http server
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print(payload)
conn:send("<h1> Hello, NodeMcu.</h1>")
end)
end)
LUA
Lua is a powerful and simple scripting language used for many different applications. NodeMCU created a firmware for the ESP8266 that is based upon a Lua interpreter.
NodeMCU firmware binary to ESP8266
ESP8266 needs to be put into flash modebefore you can flash a new firmware. but with this dev kit you don't need to do anything to put it in flash mode, as the USB connection can pull GPIO0 low by asserting DTR and reset your board by asserting RTS.
Creating your customized firmware
Cloud Builder
The cloud builder at https://nodemcu-build.com allows to pick NodeMCU branch, modules and a few other configuration options (e.g. SSL yes/no). After the build is completed you will receive an email with two links to download your custom firmware:
- one for NodeMCU with floating support
- one for NodeMCU without floating support i.e. an integer-only binary
Later you will receive an email to dowload the firmare files
We are going to flash the float version
We'll use esptool.py a Python-based, open source, platform independent, utility to communicate with the ROM bootloader in Espressif ESP8266.
Source: https://github.com/espressif/esptool
Supported platforms: OS X, Linux, Windows, anything that runs Python
Running esptool.py
Run the following command to flash an aggregated binary as is produced for example by the cloud build service or the Docker image.
esptool.py --port <serial-port-of-ESP8266> write_flash -fm <flash-mode> 0x00000 <nodemcu-firmware>.bin
<flash-mode>
dio for External flash memory: 4MB
If you build your firmware with the cloud builder or the Docker image, or any other method that produces a combined binary, then you can flash that file directly to address 0x00000.
esptool.py --port COM9 write_flash -fm dio 0x00000 nodemcu-release-7-modules-2020-10-17-20-03-04-float.bin
Then connecting by the serial port we can check firmware is updated an ready to accept Lua commands.
NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
branch: release
commit: 64bbf006898109b936fcc09478cbae9d099885a8
release: 3.0-master_20200910
release DTS: 202009090323
SSL: false
build type: float
LFS: 0x0 bytes total capacity
modules: file,gpio,net,node,tmr,uart,wifi
build 2020-10-17 20:02 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
cannot open init.lua:
>
You will see "lua: cannot open init.lua" printed to the serial console when the device boots after it's been freshly flashed.
If NodeMCU finds a init.lua in the root of the file system it will execute it as part of the boot sequence (standard Lua feature). Hence, your application is initialized and triggered from init.lua. Usually you first set up the WiFi connection and only continue once that has been successful.
ESPlorerThe essential multiplatforms tools for any ESP8266 developer from lua tool author’s, including a LUA for NodeMCU and MicroPython. Also, all AT commands are supported.
Required JAVA (Standard Edition - SE ver 7 and above) installed.
https://github.com/4refr0nt/ESPlorer
http://micropython.org/download/esp8266/
First erase the whole flash
(base) C:\Users\ealbertos>esptool --port COM9 erase_flash
esptool.py v2.8
Serial port COM9
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: a4:cf:12:f4:d2:4d
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 3.1s
Hard resetting via RTS pin...
Then flash the latest firmware for micropython
(base) C:\Users\ealbertos>esptool --port COM9 --baud 115200 write_flash --flash_size=detect -fm dout 0 "C:\Users\ealbertos\Documents\AZDelivery\NodeMCU LUA Amica V2\micropython\esp8266-20170108-v1.8.7.bin"
esptool.py v2.8
Serial port COM9
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: a4:cf:12:f4:d2:4d
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 586700 bytes to 381924...
Wrote 586700 bytes (381924 compressed) at 0x00000000 in 33.8 seconds (effective 138.7 kbit/s)...
Hash of data verified.
Problems after flashinng?
If your module enter in a loop of resets
After resetting
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 31088, room 16
tail 0
chksum 0x44
load 0x3ffe8000, len 1028, room 8
tail 12
chksum 0x1e
ho 0 tail 12 room 4
load 0x3ffe8410, len 824, room 12
tail 12
chksum 0x89
csum 0x89
rf_cal[0] !=0x05,is 0x00
If this is your problem, try to erase again the flash and upload the firmware again.
The MicroPython Interactive Interpreter Mode (aka REPL)
MicroPython Interactive Interpreter Mode. A commonly used term for this is REPL (read-eval-print-loop) which will be used to refer to this interactive prompt.
Hello world in micropython REPL from a terminal program.
WebREPL - a prompt over WiFi
WebREPL allows you to use the Python prompt over WiFi, connecting through a browser. The latest versions of Firefox and Chrome are supported.
Before connecting to WebREPL, you should set a password and enable it via a normal serial connection. To enable:
import webrepl_setup
Follow the on-screen instructions and prompts. To make any changes active, you will need to reboot your device.
>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active(True)
#5 ets_task(4020ed88, 28, 3fff9728, 10)
>>> wlan.scan()
[(b'MIFIBRA3654', b'\xec\xf4Q\xb26V', 1, -75, 3, 0), (b'MIWIFI_2G_Sng9', b'\xe4\
xca\x12\xd1\xd7\xe0', 1, -67, 4, 0), (b'MOVISTAR_E1E6', b'\x98\xde\xd0\xa0\x9cT'
, 1, -72, 4, 0), (b'MOVISTAR_E1E6', b'\xf8\x8e\x85\xeb\xe1\xe7', 1, -70, 2, 0),
(b'Orange-2AED', b'\xa8\xd3\xf7s*\xef', 6, -74, 3, 0), (b'MOVISTAR_38E4', b'\xcc
\xd4\xa1&8\xe6', 6, -72, 3, 0), (b'vodafone670A', b'\x04\x02\x1f\xd7g\x10', 8, -
94, 3, 0), (b'MOVISTAR_D2FB', b'\xcc\xd4\xa1\x9a\xd2\xfc', 11, -61, 3, 0), (b'1
23456789', b't\xHA\xHA\xHA\xHA\xHA', 11, -34, 2, 0), (b'Vodafone71', b'\x0eAX\x0
0\xb4)', 11, -71, 3, 0), (b'MOVISTAR_5BB4', b'\xcc\xed\xdc\x04[\xb5', 11, -90, 3
, 0), (b'LowiC9E0', b'\xd4`\xe3\xa5\xc9\xe1', 11, -90, 3, 0), (b'Vodafone22', b'
\xe0`fL\xea1', 11, -68, 3, 0), (b'vodafoneDDCA', b'x\x81\x02\x06\xdd\xcb', 11, -
89, 3, 0)]
>>> wlan.isconnected()
False
>>> wlan.connect('123456789', 'dummypasssword.Isit?')
>>> ap= network.WLAN(network.AP_IF)
>>> ap.active(True)
>>> ap.config(essid='ESP-AP')
#6 ets_task(4020edc0, 29, 3fff9148, 10)
>>>
SENSATE.IOConfigure your IOT solution without coding.
Sensate monitor App alllows access to your sensors anytime, anywhere. The data will be displayed on your smartphone. Get informed if limit values are exceeded.
Open the Hardware Configuration Wizard
https://www.sensate.io/configurator
Create Data collection in the cloud with advanced data analysis using MATLAB
First create the channel
ThingSpeak Library
Arduino needs to have a library installed in order for your thing to know how to send data to ThingSpeak. In the Arduino IDE, choose Sketch, Include Library, and Manage Libraries. Search for “thingspeak” and click Install.
/*
WriteSingleField
Description: Writes a value to a channel on ThingSpeak every 20 seconds.
Hardware: ESP8266 based boards
!!! IMPORTANT - Modify the secrets.h file for this project with your network connection and ThingSpeak channel details. !!!
Note:
- Requires ESP8266WiFi library and ESP8622 board add-on. See https://github.com/esp8266/Arduino for details.
- Select the target hardware from the Tools->Board menu
- This example is written for a network using WPA encryption. For WEP or WPA, change the WiFi.begin() call accordingly.
ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize, and
analyze live data streams in the cloud. Visit https://www.thingspeak.com to sign up for a free account and create a channel.
Documentation for the ThingSpeak Communication Library for Arduino is in the README.md folder where the library was installed.
See https://www.mathworks.com/help/thingspeak/index.html for the full ThingSpeak documentation.
For licensing information, see the accompanying license file.
Copyright 2018, The MathWorks, Inc.
*/
#include "ThingSpeak.h"
#include "secrets.h"
#include <ESP8266WiFi.h>
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)
WiFiClient client;
unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;
int number = 0;
void setup() {
Serial.begin(115200); // Initialize serial
WiFi.mode(WIFI_STA);
ThingSpeak.begin(client); // Initialize ThingSpeak
}
void loop() {
// Connect or reconnect to WiFi
if(WiFi.status() != WL_CONNECTED){
Serial.print("Attempting to connect to SSID: ");
Serial.println(SECRET_SSID);
while(WiFi.status() != WL_CONNECTED){
WiFi.begin(ssid, pass); // Connect to WPA/WPA2 network. Change this line if using open or WEP network
Serial.print(".");
delay(5000);
}
Serial.println("\nConnected.");
}
// Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
// pieces of information in a channel. Here, we write to field 1.
int x = ThingSpeak.writeField(myChannelNumber, 1, number, myWriteAPIKey);
if(x == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
// change the value
number++;
if(number > 99){
number = 0;
}
delay(20000); // Wait 20 seconds to update the channel again
}
Serial monitor
Attempting to connect to SSID: 0123456789
..
Connected.
Channel update successful.
Channel update successful.
Channel update successful.
Channel update successful.
Channel update successful.
Channel update successful.
Channel update successful.
Channel update successful.
Yeah! is all you have to do
Comments