Month: October 2016

NodeMCU, broadcast and an event

Goal for this post: program ESP to send event. We will broadcast an event packet into network and read it. But lets start from beginning. What is broadcast?
Broadcast is a method of transferring a message to all recipients simultaneously [Wikipedia].
Contrary to unicast when you send data to one and only one recipient. But how to send something everywhere? Broadcast address are IP one that ends with 255, for a base network 192.168.1.0/24 broadcast address is 192.168.1.255.
One important aspect is that broadcast use UDP not TCP.  In short words, TCP connect and provide reliability and UDP send packet and forget but is faster.

First we will write simple server and client application. Of course in Python 🙂

(more…)

ESP8266 @ NodeMCU – lua boilerplate

This time we will look into ESP 8266 at NodeMCU v2 board. It is very small board with quite big capabilities. As a brain it has ESP-12E.
I had some opportunity to play with it at work and thought that it may be good idea to play with it some more.
My goal is to use it as event broadcaster. What events and what about broadcast you may ask :). I will hook 8 buttons to board and we will program it to broadcast event attached to button to local network.
So pressing button will send event without knowing its destination, any device can read it and do something.
Our first device that would do something is Raspberry Pi with attached LCD. So it will read event and display it. Next we will use it as controls in Piader game.
But before that we need to think and create some boilerplate. Why create and use boilerplate? So we will automate common tasks like joining WiFi, aborting booting procedure, emergency reboot and keeping WiFi alive. Simple code to do basic tasks so we may focus on our goal.
To program on NodeMCU board I will use ESPlorer as IDE and Lua as language.

Download boilerplate from GitHub

(more…)