This page describes the special features of the ESP8266 Arduino client. Please read the general help first.

Monitor Period vs. Active Period

The monitor period for a device is the number of seconds between monitor/actuation cycles. For ESP8266 clients, the active period is the number seconds that the device is not deep sleeping. In stateless monitoring applications an ESP8266 client can wake up from a deep sleep, measure inputs and go straight back go back to deep sleep. An active period is required however when actuating pins or handling interrupts. If the active period equals the monitor period then the device never enters deep sleep.

Wiring for deep sleep

If you plan to utilize the ESP8266's deep sleep feature, you must connect GPIO pin 16 to the RST pin. This ensures that the wake-up signal on GPIO 16 resets the device. If you fail to do so the ESP8266 will never return from its first deep sleep.

Blue LED

By default, the ESP8266 Arduino client uses the blue LED (GPIO pin 2) to signal various conditions as follows:

Variables

The ESP8266 Arduino client implements a number of variables which are used to control pulse mode and alarm mode described below. As for configuration data, variables are saved to the EEPROM. Therefore once configured, the functions these variables control do not require network connectivity to operate. Note that variable names are case sensitive.

Variable Description
Pulses # of pulses (required for pulse mode).
PulsePeriod Pulse period in milliseconds
(required for pulse mode).
PulseCycle Cycle (repeat) period in seconds (monitor period by default).
PulseDutyCycle Pulse duty cycle (50% by default).
AlarmPin GPIO pin to drive during an alarm (GPIO 0 by default).
AlarmLevel Logical level during alarm condition (LOW by default).
AlarmPeriod Alarm period for network alarms, or 0 for continuous alarm (milliseconds).
AlarmNetwork Raise alarm when the number of network failures exceeds this number (0 to disable).
AlarmVoltage Raise alarm when the analog (A0) value drops below this value (number between 1 and 1023, or 0 to disable).
AlarmRecoveryVoltage Clear the voltage alarm when the analog (A0) value exceeds this value (number between 1 and 1023, or 0 to use the AlarmVoltage).
AlarmRestart Restart device if the alarm continues for too long (minutes).
SensePin GPIO pin that is driven HIGH while sensing pins, otherwise held LOW. Used to drive a relay which regulates power to one or more sensors or a voltage divider (0 to disable).

Pulse mode

Pulse mode enables the ESP8266 Arduino client to drive the blue LED and GPIO pin 2. The shape of the pulse is controlled by the Pulses, PulsePeriod, PulseCycle and PulseDutyCycle variables as shown in the diagram below.

Pulse mode

Pulse mode can be temporarily suppressed by actuating the X10 custom pin. When X10 is present and true, the pulse is suppressed. X10 is not stored in EEPROM to avoid permanently suppressing the pulse due to loss of network. To permanently disable pulsing, either delete the Pulses and PulsePeriod variables or set them to zero.

Pulse duty cycle

Alarm mode

Alarm mode enables the ESP8266 Arduino client to drive a specified GPIO pin whenever the number of consecutive network failures exceeds a given threshold (AlarmNetwork) or the analog (A0) value drops below a given value (AlarmVoltage). Since the default AlarmPin is GPIO 0 and the default AlarmLevel is LOW, this means the ESP8266's red LED will be lit whenever there is an alarm. The alarm pin can also be connected to a power supply relay in order to power cycle network equipment (for AlarmPeriod milliseconds).

Network alarm

A network alarm is raised whenever the number of consecutive network failures exceeds the threshold specified by AlarmNetwork. This alarm is active only for AlarmPeriod milliseconds, and is intended to be used to reset network equipment.

Voltage alarm

The voltage alarm is intended to prevent a battery-powered system from completely losing power. Whereas network alarms are transient (i.e., for AlarmPeriod milliseconds), voltage alarms persist until the voltage recovers (i.e., exceeds AlarmRecoveryVoltage). Therefore if the voltage alarm is used to turn off power to network equipment, the ESP8266 will be disconnected from the network until the alarm is cleared. If AlarmRecoveryVoltage is not specified, it defaults to AlarmVoltage. Needless to say, ensure that the ESP8266 is not powered by the relay!

If you accidentally set AlarmVoltage or AlarmRecoveyVoltage too high, the ESP8266 will stay in alarm mode forever (indicated by 5 LED flashes). As a precaution, the voltage alarm is only enabled after the device has been updated at least once after starting. If the ESP8266 is stuck in alarm mode, simply reduce the analog values, restart the ESP8266, wait one full cycle for the new variables to be fetched from NetReceiver and then select Update. Once updated the new values for AlarmVoltage and AlarmRecoveyVoltage will take effect.

Despite their names, AlarmVoltage and AlarmRecoveryVoltage are analog (A0) values, not voltages. This is because NetReceiver sensors convert analog values to a voltages, not NetSender. To find suitable analog values first include X10 in the input pin list. This reports the current analog (A0) value. A value of -1 means the device is not configured and the voltage check is disabled. In the latter case, first set AlarmVoltage to 1 then update the device. The voltage scale is found by dividing the analog value by the measured voltage. For example, if the current battery voltage is 12.5V and the analog value is 856, the conversion scale is 68.48 (= 856/12.5). Use the scale to calculate appropriate values for AlarmVoltage and AlarmRecoveryVoltage (examples shown below).

Description Analog value Voltage (12V system) Voltage (24V system)
Normal 856 12.5 V 25.0 V
AlarmRecoveryVoltage 835 12.2 V 24.4 V
AlarmVoltage 822 12.0 V 24.0 V

NB: A typical lead-acid battery that is fully-charged at 12.6V will be almost completely discharged at 11.9V. Don't wait till then!

Alarm timer

A timer is started whenever an alarm first occurs. If the alarm condition persists for more than AlarmRestart minutes, the ESP8266 is automatically restarted and the alarm is reset. If the alarm condition is still present however, the ESP8266 will re-alarm itself and the timer will start over again.

Forcing an alarm

The alarm pin can also be actuated just like any other GPIO pin, making it possible to force an alarm condition remotely. Be avised however that if triggering the alarm causes a permanent loss of connectivity, then the ESP8266 will be unable to reconnect to reset the alarm!

Instead, simply click on the 'Alarm' button for the selected device. This will force an alarm for AlarmPeriod milliseconds without restarting the ESP. Note the following:

Serial output

The ESP8266 client writes serial output at 115200 Baud. When the device is unconfigured it outputs the NetSender version followed the device's MAC address at the start of each cycle. Once the device is configured it runs silently, unless put into debug mode. Updating the device returns the device to normal mode.