Using Software serial on ESP8266 with Lua - 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?

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/.

Related

Light Intensity sensor bh1750

Is there any way to store light intensity data from the bh1750 sensor on firebase and display it using the android app.
I am a beginner any kind of help will be appreciated.
Thank you so much for your time
For starters you would want to get an Ethernet or wireless-connected Arduino, or connect a WiFi adapter to an Arduino, and have it able to connect to the internet.
Then you would need to connect whatever sensor (probably I2C) to your Arduino, and have it read in environment data like temperature, humidity, whatever you want.
With connectivity to the internet, you can send a POST request to Google's Firebase API. But I wouldn't worry about that until you at least have the arduino, internet adapter, and environment sensor.
Firebase apparently has a "REST" http API, https://firebase.google.com/docs/reference/rest/database/
And people have been able to send POST requests via arduino over WiFi https://arduino.stackexchange.com/questions/50931/how-to-post-http-post-requests-on-my-website
and Ethernet shouldn't be too hard either (it requires a seperate piece of hardware just like the WiFi path does, but there seems to be more popularity among WiFi enthusiats on Arduino than Ethernet enthusiasts.
https://www.arduino.cc/en/Reference/Ethernet

ESP32 as main controller and ESP8266 as client

I am making a project in which I want to use ESP32 as the main controller and ESP8266 as client(for collecting data from the sensors).
I want to use the MQTT protocol and send all the data to the Ubidots platform as shown in the attached diagram.
ESP32 and ESP8266 will be connected to Mobile Hotspot.
My question is whether ESP32 as the main controller will work in station mode and ESP8266 in AP mode or opposite? Or in which they can work? (It is a kind of basic question)
Because I have to specify the mode in the code in Arduino IDE.
Like this I want my system to work
According to what you described, you're right. The station would be the ESP32, and your APs the multiple ESP8266 configured; the ESP32 will serve you as a gateway and the ESP8266 as nodes.
This guide can serve as a reference for your project. The only thing you must replace is the WiFi library required by the ESP8266 along with the necessary configurations.
Once you have established the communication between the devices, you can refer to this guide to send your data from your ESP32 to Ubidots over MQTT.

Communicating using Core Bluetooth

I am new to Objective c and I want to send simple strings from an iPhone to an arduino an vice versa with Bluetooth. I have read apples information about Core Bluetooth, but I am having trouble understanding it. As I said, all I need the iPhone to do is: 1) connect to the BLE device of the arduino. 2) Send instructions (in the form of strings) 3)get a response from the arduino when the instructions have been carried out, so that the next set of instructions can be sent. I would be very happy if somebody is able to help me with this project
Thanks
You should follow the wwdc presentation on core bluetooth.
You should probably start here
I suggest operate your device with YMSCoreBluetooth.
The basic step to operation bluetooth device is:
Search all nearby device by blue tooth scan, you will find all nearby device.
Stop your scan. Connect one of the devices found in response.
Discover all services on the device.
Discover all character in service found by service discover action.
Write your content into character found in 4.
You can read character value from device.
YMSCoreBluetooth let you write your logic in one code block instead of separate delegate.

Custom BLE service with SPP support?

I'd like to have bluetooth module with iOS support and Rx/Tx pins. iOS devices support only MFI-certified Bluetooth 2.1 modules (and i can't find any) or BLE modules. But most BLE modules do not have Rx/Ts pins for transparent interaction.
As possible solution #1 Adafruit created board based on nRF8001 bt chip with custom BLE service with 1 characteristics for Rx and 1 characteristics for Tx and but unfortunately it supports SPI only and i need direct Rx/Tx pins to be wired to Arduino board directly. That needs Arduino sketches modification to work over SPI instead of Serial class and that's bad.
Also i've found solution #2 from Sparkfun based on BC118 chip. It seems to have custom BLE service too but with SPP support! But it's comparably expensive and not widespread.
The question is:
how to develop custom BLE service with direct Rx/Tx pin for widespread cc2540/cc2541 and cheap chips? Are there any hardware limitations/requirements for it?

RN42-APL dev board not authenticating when receiving transmit bytes

I recently received the Microchip/Roving Networks RN42-APL development kit from Avnet, and I am able to get the sample iOS app to run and do loopback tests and everything is great (BT connects, authenticates, aware that app is on).
However, when I place this board in a real circuit, where data is flowing to the RX-In pins, the RN42 won't even authenticate!
Has anyone seen a functional example of this MFI chip? The whole 'it just works' isn't really ringing true. Is there something I need to -do- before this chip can send and receive data?
what exactly do you mean that the RN-42-APL BT module doesn't authenticate? I used RN-42-APL + MFi 2.0c chip for iOS authentication and it works well. However the newest firmware 5.43 has still some bug related to authentication with Android system. Previously I used BT module with firmware 5.36. Engineer from Microchip told me, that previous firmware had some bugs related to authentication which requires PIN code.
The newest firmware has been improved, but I found another one bug during my tests.
MFi chip must be connected with 2-wires to BT module. This chip uses I2C data transfer. I designed and constructed real device which was based on these components.
Finally, this module works well with iOS, authentication mode you can change with SA,x command. Please read the manual. There are 4 options: 0, 1, 2 and 4.
So I figured out the issue (I think). It was unrelated to the firmware, but it seems that the device wouldn't authenticate if there was traffic on the UART lines before authentication had happened.
I don't know whether where this limitation comes from, nor do I really care, but if anyone runs into this, I would try shutting off UART traffic until authentication.

Resources