Search code examples
luaat-commandesp8266nodemcuhm-10

Using Software serial on ESP8266 with Lua


I need to use ESP8266 standalone. I want to connect HM-10 bluetooth module to it and fire its AT commands and read the UUID of devices nearby.

I can do that by firing AT commands on HM-10 from Arduino and FT232RL. But how do I do it in Lua?


Solution

  • Initially I didn't fully understand what the problem is. So, I was reluctant to give an answer based on vague ideas and assumptions. So, it seems you have an Arduino BT from which you send data to an HM-10 which is connected to the ESP8266. What the FT232RL's role is I still don't understand but it doesn't seem relevant in the context of the question.

    Wire/solder the HM-10 pins 1 & 2 to the ESP8266 RX/TX. Then you can read data using the NodeMCU UART module: https://nodemcu.readthedocs.org/en/dev/en/modules/uart. uart.on() allows to register callbacks triggered when data is received.

    In case your ESP device is a NodeMCU devkit you might have to use uart.alt() depending on which RX/TX pins the HM-10 is connected to. The devkit has more than one set of RX/TX pins, see https://github.com/nodemcu/nodemcu-devkit-v1.0/.