Skip to content

ianhom/LuaNode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

199 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LuaNode

This project is an improved Lua SDK, based on ESP-IDF/ESP8266_RTOS_SDK, for Esp32 (compatible with Esp8266).

As we know, there are some existing Lua SDK such as NodeMCU, esp-open-rtos, but they are not support for both Esp32 at this time, and some of them are not support multi-task.

github

NEW UPDATE FOR ESP32:

New version of LuaNode32 is developed based on esp-idf and compatible with Esplorer.

The following figures show the DOIT ESP32 dev-board. To buy the ESP32 dev-board click Here

github github

github

Download the DOIT dev-board schematic here

How To Build LuaNode32

  • Download prebuild toolchain Here, you can also build the tools from source, follow the steps Here
  • Export build tools' directory by executing the following command on terminal, export PATH=/your_path/toolchains/esp32/bin:$PATH, where the your_path is the path the toolchains stored.
  • Export esp-idf path by the following command: export IDF_PATH=the_esp-idf_path
  • Change current directory to LuaNode32, then input make to build firmware.

For more details, view LuaNode wiki page

LUA PROGRAMMING

Programming with Lua is easy, some samples are as follow:

-- create file on file system
file.open("myfile.lua", "w+");
file.write("hello world");
file.close();

-- read file from file system
file.open("myfile.lua", "r");
-- read 1024 bytes from myfile.lua and save them
-- to content
content=file.read(1024);
print(content);
file.close();

-- remove file
file.remove("myfile.lua");

-- restart device
node.restart();

You can add your own Lua modules to LuaNode at will, visit the LuaNode wiki page for more details.

LuaNode is compatible with Esplorer now, you can edit and download Lua Code to ESP32 with Esplorer conveniently.

Get Esplorer Here

HOW TO BUILD For ESP32/ESP8266:

For details, see LuaNode wiki page Here.

HOW TO FLASH THE FIRMWARE:

See LuaNode wiki page Here.

HOW TO DEBUG:

See wiki page Here.

APPS:

  • task: This is a sample to show how to create an os task. Build the example by executing the gen_misc.sh.

How to create a task:

void task1(void *pvParameters) {
    // do something
}

void user_init(void) {
    xTaskCreate(task1, (signed char *)"tsk1", 256, &mainqueue, 2, NULL);
}

Note: There is a task to receive uart input. You'd better alloc more than 512k memory for this task, since the lua command handler will be called in this task, more memory is required for lua handler.

  • luaapp: A lua app.

  • wifikiller: An wifi sample. Set baud rate to 115200pbs, using UART0. It will disconnect WiFi connection.

  • wifilister: List all APs, along with clents connected to them, near your device. The list info then sent to Android device via OTG, and display on Android.

APPLICATIONS:

ESP32-Camera

This simple application is to use ESP32 to controll a Camera. You can find the source code from the following diretory: LuaNode_Esp32/LuaNode32/examples/camera

There is another ESP32 camera demo create by igrr, find it from the link: https://github.com/igrr/esp32-cam-demo. We also utilize OV7725 for our camera test, but the hardware is a little different from igrr's project. My camera is extended with a RAM, which is AL422B, with 390KB RAM. So the camera can cache 2 frames, if the resolution is set to 320x240 pixel. The following figure is my camera, called "Yehuo", a Chinese name.

github

The following figures is my ESP32-Camera.

github

github

I learn igrr's project, and do the same test as igrr's. For instance, I use the camera to scan the board, and then you can see the output from the uart terminal.

github

ESP32 Drives Nokia5110 LCD

This is an application to show how to drive Nokia5110 LCD. It is easy for ESP32 to drive the LCD. You don't even need to use SPI to drive the LCD. The LCD is very cheap, and easy to buy from taobao or eBay.

github github

Pin connections:

Interface Nokia5110 Pin DOIT ESP32 dev-board Pin
RESET RST D4
LCD Enable CE D2
DC DC D5
Data Input Din D18
Clock Clk D19
Back Light BL D21
Power Supply 3.3V Vcc 3V3
Ground Gnd GND

For more details, view the lcd_nokia5110_driver sample within the examples folder.

Wifilister

Another interesting application is the Wifilister app. The app scans all APs along with the clients connected to them around device, and scan results are sent to Android device via OTG, then you can see the result displayed on Android device.

To test this app, you have to install the LuanodeUsbHost Android app to your Android phone (device). LuanodeUsbHost is an Android USB Host app for ESP8266/ESP32. The Android device receive messages, sent from ESP8266, via OTG. Then the messages display on this app.

Download the LuanodeUsbHost source Here.

Compile Wifilister provided in Luanode, flash it to ESP8266/ESP32, and then connect your ESP8266/ESP32 with Android phone. You can see the scanning results.

github

FAQ:

See wiki page Here

WHO ARE THE PEOPLE BEHIND THIS PROJECT

Wei Wang: He got his master's degree from Guilin University of Electronic Technology in 2012. He has more than 4 years work experience on Embedded System.

github

DOIT(www.doit.am): DOIT is a high-tech company, who focus on IoT technology and open source hardware. He supports this project and provides hardware for this project. Its successful products include WifiMCU, Doit Video Car, and Wifi sniffer, etc.

github

CONTACT ME:

If you have any question, you can contact me via Email/QQ list below, Thanks:)

CHANGE LOG:

2016.4.7 Modified lbaselib.c

2016.4.19 Modified code structure

2016.5.11 Replace libc

2017.1.19 Update to the latest esp-idf

About

Esp32/esp8266 lua sdk

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 90.3%
  • C++ 6.1%
  • Objective-C 1.5%
  • Makefile 0.9%
  • Lua 0.7%
  • Shell 0.2%
  • Other 0.3%