RC522 reader and configuration – anything is good

I mentioned a magical switch to enable configuration mode. In this post, we will write a configuration module for RFID node. Why not for boilerplate?
Because first, we will analyse the problem and create a tailored solution. After gaining some experience we will rewrite module and create a universal configurator.
What is to configure? An AP credentials and an URL for a server.


NodeMCU and light detector – part 4: a module and a handler

We have a nice node that detects light, it works in toilet @ my work 🙂 It does it jobs almost perfectly. There is still a hack for it – leave a light on when leaving the toilet. I have an idea to fix this but first, let’s reforge a lousy code into a module and a handler. After refactor we may safely add it to the NodeMCU boilerplate.

This is going to be our second data node for display.  It will show area lightness and with conjunction with a time, we can tell if an artificial light is on or off.

NodeMCU boilerplate @ GitHub


NodeMCU and PIR HC-SR501 (motion detector)

We have LCDs and we should have a data that can be displayed on them, we need data sources. So in parallel with displaying, let’s work on some sensor nodes.
First will be a motion detector, we gonna use a module with easy to remember name: PIR HC-SR501 🙂.
There are a few variants of it. But the main difference is an ability to use jumpers to change mode. My version can’t do that 😦
As a brain for sensor we will use the NodeMCUv3 board and as a language the LUA.

Module added to NodeMCU boilerplate @ GitHub


Due to memory problem I looked once again at the code and.. I found that I’m not using classes properly.
Why? Because every function and attribute were static. I didn’t use self or anything similar.
I scratched my head, looked into google and rewritten temperature sensor.

It can create class instances with self values and static functions.

NodeMCU event handlers – 18b20 as good start

We have a nice NodeMCU server for LCDs. But there is one catch. We can control one LCD or all connected LCDs. But imagine that we have two LCDs and we want to display different content on each.

In message we can set node name but not device connected to it. So there is case with 1+ screens or broader with many devices connected to one Node.

Another problem: we start LCD server and we want lets say start a server with temperature sensor. We cannot. Lcd would take port and that is all. To do something with this we will introduce event handlers and listers. Big and useful change.
Each module would have an event handler, a function that gets message and do something with it. Returns true when it can handle this event and false when not.

I mention temperature sensor, currently we have none so first lets create one.