IoT Button (4th)

With 5 to 10 calls a day there was no remarkable discharge of the battery pack.

In order to accelerate the discharge of the battery pack, I simulate 288 calls/day by a periodic reboot every 5 min. After about 9.5 days of operation the battery pack should be discharged. This will give a better verification of the forecast for discharge.

The voltage under load conditions is saved in a Google spreadsheet again.

To build the IoT Button  I used a HUZZAH board. But, this board had some problems with the restart from deep sleep. The normally required connection between GPIO16 and RST did not work properly.

The discussions in the Adafruit forum were not helpful. Therefore I decided to take a D1 mini & D1 relais shield running NodeMCU too to build a timer controlled reset by this relais.

The small program timer.lua implements two timers. Timer 0 controls the periodically call of the function switchRelais() while timer 1 defines the time of closing the relais contact.

The timer period is defined as 300 s = 5 min and the closing time for the contact is 100 ms. This time was enough to reset the IoT Button controller reliable.

Source: timer.lua

-- Title : Timer
-- Author : Claus Kuehnel
-- Date : 2016-02-24
-- Id : timer.lua
-- Firmware: nodemcu_float_0.9.6-dev_20150704


PERIOD = 5 * 60 * 1000 -- value in msec

-- IO
REL = 1 -- D1 Relais is controlled by D1

-- set D1 as output
gpio.mode(REL, gpio.OUTPUT, gpio.PULLUP)
gpio.write(REL, gpio.LOW)

-- REL control
function REL_on()
gpio.write(REL, gpio.HIGH)
end

function REL_off()
gpio.write(REL, gpio.LOW)
end

function switchRelais()
print("Relais switched")
REL_on()
tmr.alarm(1, 100, tmr.ALARM_SINGLE, function() REL_off() end )
end

print("Start Timer for D1 Relais Shield...")
switchRelais()

-- REL is switched every one minute
tmr.alarm(0, PERIOD, tmr.ALARM_AUTO, function() switchRelais() end )

Advertisements
IoT Button (4th)

One thought on “IoT Button (4th)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s