Maybe my question is little weird.
- Using rpi3, node mcu, dht11(or another sensor)
- get a data of dht11 on nodemcu
- want this data to rpi3
is it realizable??
-
2yes this is possible. you should be able to find tutorials on the web using e.g. the MQTT protocol.oh.dae.su– oh.dae.su2019年04月29日 16:38:12 +00:00Commented Apr 29, 2019 at 16:38
1 Answer 1
Question
Maybe my question is little weird
Using rpi3, node mcu, dht11 (or another sensor)
get a data of dht11 on nodemcu
want this data to rpi3
is it realizable??
Answer
Ah, your question is not weird all, just a very common Rpi (python) NodeMcu (Lua) newbie programming exercise.
I would recommend to use the very simple UART method (not so complicated as MQTT, which of course you should try later). With real physical wires TX, Rx human can touch (and can use LED to display status, if no scope available), newbies should not find things so scary and easy to troubleshoot. Furthermore you can complete the complicated thing in three steps.
Separately check that Rpi, Esp8266 can themselves loop back (just connecting local Tx to Rx to form a loop, no external connection)
Use a terminal emulator such Win10 puTTY/Superterm, or Rpi puTTY to talk to separately talk to Rpi or Esp8266 (eg, puTTY say "AT/r/n", Rpi or Esp should reply "OK/r/n".
Of course if you have arduino/Rpi UART experience, you can skip Step 2, and just use a Lua snippet with command uart.write() to write a string to UART and Rpi to read the string on the other side.
NodeMcu has good documention for this basic things, but there are many traps, each of which would waste hours. So it is a good idea to carefully a couple of times. For example, NodeMcu UART0 can read and write, but UART1 can read only. The other trouble maker is baud rate. Some modules default to 115,200bps, but some starts with 9,600 baud. This kind of inconsistency across vendors and version also waste much newbies' time.
I have summarized the essential documentation in the reference section below for your easy reference, in case you miss something basic.
Good luck and have a nice project!
References
NodeMcu Open Source Lua Based Firmware and Development Kit Introduction
NodeMcu UART Write - uart.write() Write string or byte to the UART.
-
First of all, Tkank you for your relpy and answer. I have some question... I never know about lua but know about python. So I am trying to using micropython on nodemcu. Also Can I handle it?? Again really Thank you :)이효종– 이효종2019年04月30日 02:57:18 +00:00Commented Apr 30, 2019 at 2:57
-
Yes, go ahead. What are your questions?tlfong01– tlfong012019年04月30日 02:58:30 +00:00Commented Apr 30, 2019 at 2:58
-
Oh my goodness. That is a big problem. Let me update my answer later, perhaps this afternoon. There is a confusion. I think micropython has nothing to do with NodeMcu. It runs REPL on itself.tlfong01– tlfong012019年04月30日 03:01:50 +00:00Commented Apr 30, 2019 at 3:01
-
hmm.. I know that micropython can mount on nodemcu board.. Isn't it???이효종– 이효종2019年04月30日 03:03:13 +00:00Commented Apr 30, 2019 at 3:03
-
Well, not exactly. The "board" should be called ESP8266 01/02 ...12/32 board. You can run Lua or microPython. If you run Lua, you must use NodeMcu firmware, not much choice. But if you run microPython, you can say use editor Mu to write your micropython program and uploaded it to the harware board. A not very good analogy is Rpi can load linux OS or Risc OS or WinIoT, ... When you run WinIoT things, it has little to do with linux/Raspbian, ...tlfong01– tlfong012019年04月30日 03:23:45 +00:00Commented Apr 30, 2019 at 3:23