Month: December 2016

NodeMCU and light detector – part 3: PyQt5 to the rescue

Our previous computer app was a failure. Happens from time to time:) Choosing wxPython was a huge mistake. Seems wx bindings are outdated.
After a long walk to cool of my head and think a little (but mostly catching pokemons) I recovered my strength and began second approach. This time I’m using PyQt5. It has Python3 bindings and lots of nice features, like ability to emit signals to other objects.

Spoiler: this time a full success 🙂

Get source from GitHub

(more…)

NodeMCU and light detector – part 2: failing is an option

We need something to see the state. I think the best way is to display icon in the taskbar. It must work under Windows 10 and Ubuntu/Mint.
To build GUI I will try and use wxPython. Sadly their bindings are for Python 2.7 not 3.x. I found wxPython Phoenix Project but for now lets stick with official release.
Spolier: we gonna fail – see running section. This is why code is dirty and nasty – no reason for refactor.
(more…)

NodeMCU and light detector – part 1

We have a small problem at the office. This problem is only one toilet. Additionally not all rooms can see it and know if it is busy or not. So quite often someone runs and slams into closed door.
Such runner has two options, form or join queue and wait or go back to desk and return later.
It would be much better for all of us if we could check toilet status from our desks.
How to do it? Simplest way is to detect if light is enabled. Hopefully this would be enough. If not I have another idea 🙂
As light detector I’m going to use lm393 light sensor and as the brain NodeMCU v3.

Download code
(more…)

NodeMCU and HD44870 – part 3

Our module displays strings as soon as function write is called. It is mostly enough but sometimes it is better to prepare what we want to display and then display it. Such action uses buffer and that why I’m calling this buffered mode.
We made something like this in CharLCD so we can convert idea to NodeMCU. Due to LUA characteristic both modes are combined into one module.

(more…)

NodeMCU and HD44780 – part 2

We played a little with lcd and we know that it works 🙂 It is a good idea to create a class that can be used in any project.  Such class must allow setting width, height and pins if they are different from default one. It’s behaviour is based on lcd direct from CharLCD python class.
That means it is gonna display chars directly without buffer.

NodeMCU and HD 44780 – part 1

Another post about ESP8266!. This time we will attach a char display based on HD44780, something we already done for Raspberry Pi.
It will require some wiring and writing.
This time I’m also using NodeMCU v3 board because it has 5V on VU pin and we gonna power our display from it.
As for the display I have a nice 16×2 lcd.

(more…)

Relay and ESP8266 – part 2: mobile app

Lets create a mobile app to control our relay. To develop multiplatform application we will use Xamarin. Why? Because I have no idea how it works and I want to try 🙂

Our software must support 4 actions, toggling on and off both channels. To make layout as simple as possible lets stick with four buttons. I used xaml to create UI, it is a file which describe layout and widgets. I’m not sure what is better: write UI in code or use xaml.

Pressing one button will broadcast a JSON message with our event.

Xamarin has few types of application. Today Forms Portable is my choice for project.

I wont digg into installing Visual Studio and Xamarin or setting phone to developer mode. It is easy to find on the net.

(more…)