Samstag, 13. Februar 2016

Flashing New Firmware to ESP-01 with Mac OS X

I had serious problems today flashing NodeMCU firmware on my new ESP-01 boards with my Windows XP virtual machine today. As I could communicate with the boards from Mc OS X directly, there is nothing wrong with the boards. But after spending some hours trying different USB-to-serial boards without success, I finally searched for a way to flash the firmware with Mac OS X directly as well.

ESP8266 with DHT22 as wireless
remote sensor. A TD6810 buck
delivers 3.3V from USB.
The solution was quite simple: esptool. Download the zip archive, unpack it, change into that directory and install it systemwide by typing in:
sudo python install

This will take care of all necessary dependencies like installing pySerial libraries and so on. After the installation finished, you can check whether the tool works correctly. Make sure to tie GPIO0 to GND and restart the board for getting into flash mode:
sudo --port /dev/cu.SLAB_USBtoUART --baud 115200 read_mac
(adopt the port to your USB-to-serial interface)

This should return your MAC address:
MAC: 5c:cf:7f:**:**:**

Now you can download for example the latest nodeMCU firmware from the project site and flash it with this commandline:
sudo --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash 0x00000 nodemcu_float_0.9.6-dev_20150704.bin

Adopt the device name to your USB-to-serial - and set the baud rate higher. With 115kbps the process will need nearly a minute:
Erasing flash...
Took 2.04s to erase flash block
Wrote 462848 bytes at 0x00000000 in 45.5 seconds (81.3 kbit/s)...

Now remove the GPIO0 pulldown to GND and work for example with ESPlorer to program a LUA script.

Sonntag, 7. Februar 2016

Power supply for ESP based Wifi Sensors

The power supply for example for the DHT22 sensors I'm currently using in my "Home Measurement Project" has a big influence on the accuracy of the readings. The graph was getting a bit "nervous" and unstable.

I removed the huge 1000µF electrolytic capacitors and added a few capacitors to the ESP board and the sensors: 100nF, 10µF, 100µF ceramic capacitors and one to two 100µF tantalum capacitors. This looks way better than before!

With those tantalum capacitors and 0.1+10µF ceramic capacitance the result was looking better when looked upon with the oscilloscope. But you can see bigger 10ms areas where the voltage significantly drops to below 2.9V.

Thus adding 100µF ceramic capacitor was helping a lot, looks way better already! But still the voltage drops to ~3.0V for those 10ms slots which is still not optimal.

The USB-to-serial-boards are nice for programming the ESP boards, but for permanent power supply, something more special is needed. I found a few RT9166A in my LDO drawer. They can deliver up to 500mA - but in the SOT23 case can only stand 0.25W of heat. 1W of heat on the other hand leads to a temperature rise of 250°K. With 500mA at 5V to 3.3V I was calculating with 0.85W of heat ... thus I added fat lines of solder tin so the dissipation would be improved at least. To my surprise, the RT9166A stays really cold!

The result is very satisfying. You ca see the transiants on load changes, but no sustained voltage drops on the plot! Thus it is a good idea to use a proper decoupling with capacitors for the sensors, the ESP board itself and use a proper power source!

Two sensors are running with TD6810 switching regulator and one with MCP1825S LDO. They all run stable and don't need the USB-to-serial-converter anymore.