Categories
Internet Of Things LUA

Analog Read with Lua code for WeMos D1 Mini (R2) NodeMCU firmware module

Lua Code

print(adc.read(0))

NodeMCU Flasher

esptool.py –port COMx

Resources

Documentation

https://nodemcu.readthedocs.io/en/release/

ADC Module

https://nodemcu.readthedocs.io/en/release/modules/adc/

Categories
Love2D and Lua Programming Languages

Installing Lua (64bit) on Window 10

Download site

http://luabinaries.sourceforge.net/download.html

Extract (unzip) the lua-5.x._win64_bin.zip

Unzip (files)

Create a new folder

D:\Program Files\LUA

Copy all the unzip files into this folder

Rename the lua54.exe to lua.exe

Append a new path for lua.exe to the Windows 10 System environment variable path

Launch the Lua 5.x interpreter from command prompt (terminal)

If everything has been done correctly then you see the Lua 5.x.x Copyright (C) otherwise check the system variable environment path again. Note the semcolon ( ; ) entries before and after the path value.

Categories
Ai-Thinkers Internet Of Things Microcontrollers

ESP-12F Module by Ai-Thinker

https://github.com/nodemcu/nodemcu-devkit-v1.0

Categories
Ai-Thinkers Internet Of Things Microcontrollers

Ai-Thinkers Modules based on Espressif ESP8266

https://docs.ai-thinker.com/en/esp8266

Categories
Internet Of Things Microcontrollers

Getting Started Node-Red

https://nodered.org/docs/getting-started/

Categories
Internet Of Things Microcontrollers MQTT

Getting Started with Docker Node-Red

https://nodered.org/docs/getting-started/docker

Categories
Dweet.IO Internet Of Things Microcontrollers

Dweet.IO Library

https://github.com/gamo256/dweet-esp

Categories
ESP8266 (ESP-01/01S) Internet Of Things Microcontrollers

WiFi Access Point

Requirements

ESP8266 ESP-01/ESP-01S

Arduino Sketch / Code

#include <ESP8266WiFi.h>

void setup()
{
  Serial.begin(115200);
  Serial.println();

  Serial.print("Setting soft-AP ... ");
  boolean result = WiFi.softAP("ESPsoftAP_01", "pass-to-soft-AP");
  if(result == true)
  {
    Serial.println("Ready");
  }
  else
  {
    Serial.println("Failed!");
  }
}

void loop()
{
  Serial.printf("Stations connected = %d\n", WiFi.softAPgetStationNum());
  delay(3000);
}

Access Point SSID name and password

boolean result = WiFi.softAP("ESPsoftAP_01", "pass-to-soft-AP");

edit the above bold word with your own SSID name and password. Save and recompile your code again.
 

Categories
EasyEDA Microcontrollers PCB Design

Tutorial To Create a New Symbol

Categories
ESP32 ESP8266 (ESP-01/01S) Microcontrollers

Storing Data SPIFFS

Requirements

  • DHT11 Temperature and Humidity
  • USB to UART ESP01 Programmer
  • ESP8266 ESP01/01s (512KB / 1 Mbyte)
  • File System Uploader plug-in installed

Circuity

Code

#include "FS.h"
#include "DHT.h"

#define DHTPIN 2 // the digital pin we are connected to
#define DHTTYPE DHT11 // define type of DHT sensor we are using

DHT dht(DHTPIN, DHTTYPE); // create DHT object

void setup() {
  Serial.begin(115200);
  dht.begin(); // intialize DHT object
  
  // always use this to "mount" the filesystem
  bool ok = SPIFFS.begin();
  if (ok) {
    Serial.println("SPIFFS initialized successfully");
  }
  else{
    Serial.println("SPIFFS intialization error");
  }
  
}

void loop() {
  // Wait a few seconds between measurements.
  delay(2000);
  //read temperature as Celcius
  float t = dht.readTemperature(); 
  
  // Check if any reads failed and exit early (to try again).
  if (isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  //open log.txt file 
  File f = SPIFFS.open("/log.txt", "a");
  if (!f) {
    Serial.println("file open failed");
  }
  // save temperature reading
  f.print(t);
  f.println("deg C");
  //close file
  f.close();
  delay(8000);
}

Resources

https://arduino-esp8266.readthedocs.io/en/latest/filesystem.html

https://thebigpotatoe.github.io/Effortless-SPIFFS/

https://www.arduino.cc/reference/en/libraries/effortless-spiffs/