Sunday, 31 March 2019

NodeMcu temp sensor continued...

Did another NodeMcu firmware build at: nodemcu-build.com

Of: "You successfully commissioned a NodeMCU custom build from the master branch. You selected the following 10 modules: dht ds18b20 file gpio mqtt net node tmr uart wifi."

So MQTT and DHT22 and DS18B20 temp sensor support added.

Saturday, 30 March 2019

Getting a NodeMcu temperature monitor working..

Tore myself away from the TV and feeling in a programming kinda mood after a CoderDojo mentor's meeting earlier I decided to burn some code to a NodeMcu :)
http://www.nodemcu.com/index_en.html

So I followed the steps at: https://nodemcu.readthedocs.io/en/master/en/getting-started/

And so first I made a generic build at: https://nodemcu-build.com/index.php which e-mails you progress :)

I then download to my Windows 10 laptop the resulting binary:
nodemcu-master-7-modules-2019-03-30-20-05-51-integer.bin

I then downloaded NodeMCU PyFlasher and updated my USB serial driver. I then ran and flashed the binary. It was painless :)






Not sure how to test what was flashed though!

I think I need debug out from the device :) The pins are all labelled so GND, TX0, RX0 should do me to a USB serial converter :)
https://iotbytes.wordpress.com/nodemcu-pinout/

Well that worked straight away!



Now what to do? I want an ambient temperature probe to publish to a MQTT topic over Wifi.

Tried connecting to ESP_2871DF on 192.168.4.1 over wifi using fixed IP 192.168.4.2 but nothing shown using Explore Edge browser

So I need to read up on both UART and WIFI module as built into the binary image :)

Ah I've downloaded the firmware modules but I now need to download a program to use them!!
https://frightanic.com/iot/tools-ides-nodemcu/

I downloaded ESPlorer https://esp8266.ru/esplorer/ and ran it (after unzipping) the serial console worked fine when connected to COM6 at 115200 baud and after reseting the NodeMCU next to download some code to it.

So I read:
#http://esp8266.ru/download/esp8266-doc/Getting%20Started%20with%20the%20ESPlorer%20IDE%20-%20Rui%20Santos.pdf

Great followed the instructions and got a flash blue LED going on my NodeMcu as file init.lua :)


Then I removed NodeMcu from laptop and ran it from a USB battery pack :)

Worked fine
(Add photo)

Now for some real code :) So over to: https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_examples

I tried the following code (with real "SSID" and "password" values):
print(wifi.sta.getip())
wifi.setmode(wifi.STATION)
station_cfg={}
station_cfg.ssid="SSID"
station_cfg.pwd="password"
station_cfg.save=true
wifi.sta.config(station_cfg)
print(wifi.sta.getip())

which produced the following Wifi Router entry:
NODE-2871DF_WirelessEC:FA:BC:28:71:DF192.168.1.146

Great! Now to publish to MQTT broker! Then to read a temp sensor :)

Will do this tomorrow following:
https://www.foobarflies.io/a-simple-connected-object-with-nodemcu-and-mqtt/






NodeMcu ESP-10S modules have arrived..

Just got these this morning:10x ESP-01S NodeMcu modules arrived today from China 14 euro the lot!. Serious bit of kit  Wifi and digital and analogue inputs. I'll be making battery powered room temp sensors sharing MQTT data over wifi  Pretty nerdy huh?


Wednesday, 27 March 2019

Kilnageer Central Heating



I have done much with automating central heating controls (Node-Red, MTTQ, sonoff, etc.) over the last 6 months and must update this blog!