Monday, August 29, 2016

DS18B20 temperature sensor and ESP8266

For a small project I had to measure temperature with some waterproof sensor and of course that my first choice was the DS18B20 waterproof sensor and for microcontroller an NodeMCU because I needed also the web server functionality. 

The DS18B20 sensors doesn't have the pull up resistor so I've added one with 4K7 value between DATA and VCC.

The fun is that adding only one sensor I couldn't read its value, but adding two of them in parallel everything was perfect. I've changed the pull resistor in range 1K to 9K4 , I've added a capacitor of 100nF between VCC and GND like it is in this module ( which by the way is working perfect alone with not other sensor in parallel).

Using the same library and sensors with Arduino works perfect, so it looks like my sensors have a problem ( all three of them) or the library need some adjustments for the ESP8266.

Lucky me that the project involved two DS18B20 sensors so for now I will use them like this.

Conclusion: If you have the same problem as I did just add another DS18B20 in paralel.

Picture from

PS: I also tried the parasite mode ( is using only 2 wires instead for 3) but I had the same result.

Picture from

To do: Connect this module with an 1 meter cable and check if is still working.

Saturday, August 27, 2016

A good book about ESP8266

One thing that I did in the last two months was to collaborate with Packt Publishing to be technical supervisor for a book about the ESP8266.

Book is written by Marco Schwartz and can be purchased from Amazon.

The summary of the book is in the following pictures.

Friday, August 5, 2016

Mqtt broker on ESP8266 #4

I have more progress in ESP8266 as MQTT broker.

What I have for now on this ESP8266 module:

  • MQTT broker functionality
  • Bridging data to/from and another MQTT broker ( usually a cloud MQTT instance)
  • websockets connectivity ( I can now connect with my Homy application directly to the ESP8266 acting as an MQTT broker)
  • OTA (Over The Air) updates. Every time I have a new software update the ESP8266 is updating itself so, I can say that I have continuous integration (CI) and continuous deployment(CD). Also all the modules are activated over the air.
With all those function in place I still have 34kb of heap available for other features and yes is running on an ESP with a minimum 1Mb of memory. ESP8285 is a good candidate for running the broker.

Is working also on and old ESP-01 with 512kb but without OTA functionality.

Previous posts on the same subject:

IoT with ESP8266: Mqtt broker on ESP8266 #1

Friday, July 1, 2016

Space problem on VM solved by Gpart and Knoppix

Today I had to increase the space on one of my Virtual Machine. On my laptop the host is the Windows and my VMs are Linux. 

My machines are having vmdk as disk, so I had to convert first the vmdk to vdi

VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifyhd "cloned.vdi" --resize 16000

After that I've just used the vdi file for my new machine. Ok if the size was increased ( logically) lets do it also on the guest OS. For that I've tried the Gpart Live CD but it didn't work so I had to download the Knoppix LiveCD boot from it in the VM, delete the swap, extend the partition and then adding the swap partition again and of course with the help of the GPart. 

Sunday, June 26, 2016

More devices IN

I've completed to code to add more devices, so now the module as common code can:

  • update from OTA server if the version on server is bigger the its own version of code
  • get the data from AUTH server (topics, type, MQTT server etc, credentials)
  • get the time from NTP server
  • log data to an external server
  • log debug data to a DEBUG server
  • do  CRON tasks on GPIO pins based on schedule received from Android App
  • send status and its state to Android app.

All these features are part of the common code that will run an all my modules.
Now sky is the limit on what each module can do : 

  • temperature,
  • humidity, 
  • noise, 
  • presence,
  • gas detection, 
  • acceleration, 
  • vibration, 
  • measuring power consumption, 
  • controlling blinds, 
  • garage door, 
  • boiler, 
  • irrigation controller, 
  • fish tank, 
  • motors, 
  • air conditioning or a thermostat etc
  • coffee machines
  • washing machines
  • fridge
  • remote control substitute for TV, Satellite dish, Cable TV or any other IR
  • power sockets
  • exterior lights
  • interior lights
  • power sockets
  • air quality
And the beauty is that I am not limited by the WiFi, the same things I can do with my new LoRa modules.

The all power will be at your finger tips.

 Obs: Later I'll try to add some Artificial Intelligence (AI) to my system, because the IoT without AI  is pretty  much limited on manually or semi automatic control.