• Tidak ada hasil yang ditemukan

Project based approach

N/A
N/A
Sob Birin

Academic year: 2024

Membagikan "Project based approach"

Copied!
141
0
0

Teks penuh

The ESP8266 is a highly integrated chip designed by Espressif Systems for the needs of a growing demand for low-cost IOT solutions. The manufacturer advertises that it offers a complete and self-contained Wi-Fi network solution that allows it to either host applications or offload all Wi-Fi network functions from another application processor. The ESP8266 has powerful onboard processing and storage capabilities that allow it to be used with sensors and other application-specific devices through its GPIOs with minimal upfront development and minimal runtime overhead.

The ESP8266 was originally marketed as a low-cost add-on to Arduino boards that needed such devices to connect to the external world, when people started working the low-cost chip with arduino, they realized that they can disable and understand this chip can be used as a standalone device. In less than a year, the ESP8266 has become very popular, and is now so well supported and developed. The ESP8266 chip needs to be powered by a 3.3V power supply, it can consume 10uA to 170mA, the big difference can be explained, when transmitting at full power, it can consume 170mA, but in a deep sleep it only has 10uA required.

The ESP8266 can be used as an external Wi-Fi module, using the standard AT Firmware command set by connecting it to any microcontroller using the serial UART, or directly serve as a Wi-Fi microcontroller, by programming a new firmware using the SDK. The ESP8266 is designed to be used with a partner memory module and this is most commonly flash memory.

F lashing ESP8266 or Nodemcu with latest lua firmware

Click on Config and click on the gear, and navigate to the bin file (lua latest firmware) that you downloaded in step 2. In step 2, we downloaded 2 firmwares, one is float and another one is integer, select the second integer type and click open. These two firmwares need to be flashed to the ESP8266 based on requirement, if you use Float firmware, DHT library will not work with ESP8266 device, that's why we choose the integer type later on tutorials, we will use the device with DHT -sensor use and temperature reading and humidity data.

Check in the Config tab, whether the correct firmware is selected or not, if the firmware path is correct it will be displayed in green, otherwise the color will turn to red. Click on Flash in the Operation tab, after making sure you have selected the correct COM port on the ESP8266 flasher. After you press the flash button in the Operation tab, your ESP8266 Flasher will start uploading the firmware to your Nodemcu device, you see this by checking the progress bar on your ESP8266 Flasher screen.

Click on the log file and make sure you have successfully uploaded the firmware. You may also see a green color check arrow to indicate that the firmware has been successfully uploaded. If there is a problem uploading the firmware, check the log file and check the The reason for the upload failed. This issue usually occurs when the ESP8266 device does not respond when uploading firmware. You can disconnect and reconnect the device and try to upload the firmware again. If the problem still persists, check your device as an error may have occurred. If you are using a generic type and are having trouble uploading your firmware, make sure the power supply provides sufficient power and does not oscillate.

G etting Started With ESPlorer

In the setting, click on the Integration tab and select JAR in Associate WinRAR with. On the top right of the ESP8266 select the Nodemcu+MicroPython tab, since we are going to use the lua program, we need to select this section when communicating with the ESP8266 device or the Nodemcu diversion kit. Under the Nodemcu+MicroPython tab there are many subroutines you can see, the Scripts tab is where all the programming is done, the program can be opened, saved and closed using the functions available in the Scripts tab.

In addition to this main tab on the left side, you can see the functions that allow serial communication between the Nodemcu development kit and the IDE. These functions allow you to select the COM port of the ESP8266 device that is currently connected to your computer, after selecting the Com port, the Open button helps to establish communication with the ESP8266 device that is connected to the selected COM port, you can also select the baud rate by selecting the drop-down button, which is available next to the Open button. The window under the top function tab acts just like a serial monitor which helps to visually check the communication with the ESP8266 devices, show the output result and also show the error if it occurs during the program execution.

N odemcu API for Lua

STATION_IDLE

STATION_              CONNECTING 2: STATION_WRONG_PASSWORD

This function gets a table of clients connected to the NodeMCU development kit when the kit acts as an access point for other devices. This function returns true if the timer has started and returns false if an error occurred while starting the timer. This function allows a pin to be set to PWM mode. A maximum of 6 pins can be set to PWM mode.

Timeout for a TCP server timeout is 1-28,000 seconds (for an idle client to be disconnected) this function returns net.server submodule. We have already seen about this function, this function will set a digital pin to either input or output. After saving the file in the name init and upload it to ESP8266 or NodeMCU dev kit.

This function set the duty cycle on the pin, here the pin 'D7' will initially be set to duty cycle 0 and it will increase by 20 to 1020. Enter the program type your router name in the place "magesh" and your password to enter the place “jayakumar” this is my router id and password save the file to ESP8266 this function will return the IP address currently connected to your home router. This function reads all types of DHT sensors, including DHT humidity temperature and combination sensor.

This function reads the number of available bytes in the i2c device that this function is currently calling to read. This function initializes the i2c function, which tells the compiler that it is going to use the i2c function in the program.

Referensi

Dokumen terkait