ESP8266 remote power display for energy monitor

This article documents remote power display for an energy monitor system based on emontx3 / emonhub / mqtt.

The remote power display connects via WiFi and subscribes to a topic on a MQTT server, updates are published every 10s with data from the emontx3 by emonhub.

Hardware

The remote power display uses a Wemos D1Pro ESP8266 module, a common 4 digit 14.2mm seven segment LED module with 74HC595 shift register per digit, and a simple 3V/5V level converter between the two (see above shrink wrapped in the cable from the D1Pro to the display).  Continue reading ESP8266 remote power display for energy monitor

ESP8266 IoT DHT22 temperature and humidity – evolution 3

This article documents a first project with the Espressif ESP8266 in its third evolution (based on ESP8266 IoT DHT22 temperature and humidity – evolution 2).

The objective is a module that will take periodic temperature and humidity measurements, and in this evolution publish them using a RESTful API.

Evolution 3

The example platform used in this article is a Wemos D1Pro. In this case, the D1Pro is configured for an external antenna, and a modification is made to the board to add a 1N34A diode for the deep sleep reset circuit (NodeMCU devkit V1 deep sleep). A three pin right angle header to the top of the board (as seen) and another on the underside on the opposite edge to get GND, +5, +3, and D4 for the DHT22 data wire. There is less than $20 in parts in the pic above. Continue reading ESP8266 IoT DHT22 temperature and humidity – evolution 3

ESP8266 IoT DHT22 temperature and humidity – evolution 2

This article documents a first project with the Espressif ESP8266 in its second evolution.

The objective is a module that will take periodic temperature and humidity measurements and publish them to an MQTT message broker.

This inital implementation is very basic, it is largely configured in code, though it does use DHCP. Later extensions might include a web interface for configuration of WLAN parameters etc, but for the moment the emphasis is assessment of reliability given some reports on the ‘net.

Evolution 2

The original design embedded key configuration variables in the main source code for simplicity in getting the code working.

Evolution 2 separates configuration variables from code, and provides a web interface for configuring the most common variables. The screenshot above shows the configuration screen including the use of a datalist on the SSID input field.

Hardware

A module was purchased with on board CP210x USB to serial chip. The only other component needed was the DHT22 digital temperature and humidity sensor.

NodeMCU was chosen for the ESP2866 firmware because of the inbuilt support for ‘interesting things’, including the DHT22.

Above is a breadboard of the system for development. The board had a 4MB (32Mb) flash chip on it. Continue reading ESP8266 IoT DHT22 temperature and humidity – evolution 2

NodeMCU devkit V1 deep sleep

Low cost implementations of the NodeMCU devkit V1.0 abound on eBay, and are featured in lots of projects.

Deep sleep mode is used in a lot of projects, the MCU is but into sleep mode and it requires circuitry so that the  from the /WAKE pin (D0, GIO16) can pull the /RST pin to wake the processor up.

The problem

The common schematics as above simply wire /WAKE pin (D0, GIO16) to /RST (yellow wire), but this disrupts operation of the reset circuit, which degrades development productivity. Continue reading NodeMCU devkit V1 deep sleep

ESP8266 IoT DHT22 temperature and humidity

This article documents a first project with the Espressif ESP8266.

The objective is a module that will take periodic temperature and humidity measurements and publish them to an MQTT message broker.

This inital implementation is very basic, it is largely configured in code, though it does use DHCP. Later extensions might include a web interface for configuration of WLAN parameters etc, but for the moment the emphasis is assessment of reliability given some reports on the ‘net.

Hardware

A module was purchased with on board CP210x USB to serial chip. The only other component needed was the DHT22 digital temperature and humidity sensor.

NodeMCU was chosen for the ESP2866 firmware because of the inbuilt support for ‘interesting things’, including the DHT22.

Above is a breadboard of the system for development. Continue reading ESP8266 IoT DHT22 temperature and humidity

ADS1115 ADC checkout – #1

I have application for an analogue to digital converter (ADC) in a noisy environment, so a possible solution is to place an ADC module very close to the analogue sensors and use some form of digital connection back to a microcontroller. A possible protocol is I2C, and has the advantage that several ADC modules can be attached to the same bus, along with other peripherals Eg LCD.

ads1115-00The above ADS1115 modules have four input channels, 16 bit conversion, flexible input mux, and were available on eBay for less than A$4, so worth a try.
Continue reading ADS1115 ADC checkout – #1

Backup for NBN VDSL access

The change from Telstra ADSL to NBN VDSL drops the POTS line that gave telephone access independent of premises power.

Telephony is now provided by an ATA integrated into the VDSL modem, and dependent on mains power.

NBN makes no definitive statements about battery backup to the node, or endurance of any battery backup. Nevertheless it appears from pics people have taken of the node cabinets that the bottom layer is batteries and it is likely that they have endurance of more than 10 hours.

1474860682982

Above, a pic of an NBN FTTN cabinet from NBN’s website, and showing batteries in the bottom layer.

NBN is not customer facing, and it seems they will provide are reluctant to provide all manner of information useful to end users, perhaps guided by lawyers who do not want to create any obligation or liability for the company… the way of modern telecommunications.

In that context, it would seem worth the risk to provide battery backup to the VDSL modem to provide broadband access to battery devices such a tablets, laptops and smartphones, and access for a POTS handset plugged into the ATA port.

The supplied modem includes a 12V DC power pack rated at 2A.

iinetgatewaycurrent

Above, measurement of the current drawn averages around 0.5A with all features running (though it may draw more current during phone ringing). Continue reading Backup for NBN VDSL access

Queueing in data networks

Modern data networks route or switch relatively small ‘packets’ of data across shared links that along with the switching nodes, form the wider data network.

One of the roles of the switches is to receive packets on one link, and send them onwards on the most appropriate link. Since links may be at different speeds, and many links may source packets to be sent on any link, there exists a mechanism in the switch to store packets pending transmission, in the simplest case it is a first come first served link queue.

The function of the queue then is to hold packets until they can be sent on the link, and to offer them in first come first served order. That raises two important questions:

  • how long will packets be delayed;
  • how many slots does the queue need.

Queuing theory gives us a method of estimating these quantities.

Lets make some assumptions about the traffic:

  • service requests arrive randomly in time; and
  • service time is exponentially distributed with an average time of 1.

screenshot-19_10_16-08_25_32

Above is a plot of normalised average response time (service time + queue wait) vs resource (link) utilisation (pu means per unit). It can be seen that when the link utilisation is 0.5pu (50% busy), that response time is 2pu (ie twice the average service time), twice that needed to send an average packet at very low utilisation. Response time rapidly degrades:

  • at 70% link busy, response time is 3.3 times packet transmission time; and
  • at 90% link busy, response time is 10 times packet transmission time.

To ensure packets are not discarded, the queue need sufficient slots to hold packets even in most peak bursts. Whilst at 70% link utilisation, the average queue size is 2.3 slots (3.3-1), a larger queue size accommodates bursts better. Discarded packets can severely affect performance, not only are they likely to be resent after some delay and network overhead, they can break a higher level protocol unit in simple systems and waste the link capacity and other links used to send the rest of that protocol unit. Continue reading Queueing in data networks

Android and local IPv4 DNS name resolution

Much has been written of problems with local IPv4 DNS name resolution over quite some years, and some of it may have been software defects, but some of it seems to be a side effect of IPv6.

I have run a home network with local DNS and DHCP (doing dynamic DNS updates) for close on 20 years mostly without problems. This is a similar configuration to many corporate networks with an Intranet and gateway to the Internet.

Recent installation of a iiNet TG-1 VDSL gateway changed all that.

Try as I might, the Android tablets (6.01) would not resolve names defined in the local DNS even though they showed that they had acquired the correct IPv4 DNS and search path.

The Android tablets certainly try to discover available routers (and DNS).

screenshot-17_10_16-20_11_26

The packet trace above shows the Router Solicitation message from one of the Android tablets. Continue reading Android and local IPv4 DNS name resolution

Backup options for NBN VDSL access

The change from Telstra ADSL to NBN VDSL drops the POTS line that gave telephone access independent of premises power.

Telephony is now provided by an ATA integrated into the VDSL modem, and dependent on mains power.

NBN makes no definitive statements about battery backup to the node, or endurance of any battery backup. Nevertheless it appears from pics people have taken of the node cabinets that the bottom layer is batteries and it is likely that they have endurance of more than 10 hours.

1474860682982

Above, a pic of an NBN FTTN cabinet from NBN’s website, and showing batteries in the bottom layer.

NBN is not customer facing, and it seems they will provide are reluctant to provide all manner of information useful to end users, perhaps guided by lawyers who do not want to create any obligation or liability for the company… the way of modern telecommunications.

In that context, it would seem worth the risk to provide battery backup to the VDSL modem to provide broadband access to battery devices such a tablets, laptops and smartphones, and access for a POTS handset plugged into the ATA port.

The supplied modem includes a 12V DC power pack rated at 2A.

iinetgatewaycurrent

Above, measurement of the current drawn averages around 0.5A with all features running (though it may draw more current during phone ringing). Continue reading Backup options for NBN VDSL access