Alle Beiträge von hari

Measuring ESP8266 power usage with uCurrent and a scope

Introduction

This is a follow up to the ESP8266 article on agocontrol news. The GY-63 sensor board is drawing a lot current (around 2mA) due to its level shifters and the voltage regulation. Hence I’ve abandoned my plan to use one. I’ll probably get a few test units of the Bosch BE280, it might be a good option for a esp8266 based battery powered weather station. For now I’m going to use a DHT22 as I want to measure a scenario with real sensors. I’m providing the complete files so that Robert Hekkers can compare his measurements to mine.

Test setup

This is the „init.lua“:

wifi.setmode(wifi.STATION)
wifi.sta.config("ssid","secret")
tmr.alarm(0, 2000, 0, function()
dofile("mqtt.lc")
end)

And here we’re doing the measurement and transmit the data – „mqtt.lua“:

BROKER = "192.168.1.1"
BRPORT = 1883
BRUSER = "user"
BRPWD = "pwd"
CLIENTID = "ESP8266-" .. node.chipid()
PIN = 6 -- GPIO 12

dht22 = require("dht22")
dht22.read(PIN)
t = dht22.getTemperature() /10
h = dht22.getHumidity() /10

-- print "Connecting to MQTT broker. Please wait..."
m = mqtt.Client( CLIENTID, 120, BRUSER, BRPWD)
m:connect( BROKER , BRPORT, 0, function(conn)
-- print("Connected to MQTT:" .. BROKER .. ":" .. BRPORT .." as " .. CLIENTID )
m:publish("sensors/".. CLIENTID .. "/temperature",t,0,0, function(conn)
-- print ("temp published")
-- tmr.delay(10000)
m:publish("sensors/".. CLIENTID .. "/humidity",h,0,0, function(conn)
-- print ("pressure published")
node.dsleep(5*1000000)
end)
end)
end)

The dht22.lua comes from the nodemcu git. dht22.lua and mqtt.lua have been compiled.

Scope captures

Complete wake-up phase (200ms/DIV horizontal, 30mA/DIV vertical with the uCurrent being in mA mode)
DS2_QuickPrint16

Next steps

Verify measurements and calculate total power usage over time: The scope is calculating the area as 174.2mVs. So with a total wakeup time of about 2.6s that would be an average of 66mA current draw while being awake. With 4 wakeups/h what would give 0.19mAh (4*2.6s/3600*66mA). The rest of the hour sleeping would draw 0.022mAh, resulting in 0.212mAh total. With 2500mAh AA NiMH (low self discharge, assuming 80% after 1y) that would be about a year (ignoring step-up losses).

Graupner Ultramat battery charger data logger (mysql) for Linux

This is a small data logger daemon for Graupner Ultramat battery chargers. It was tested with a Ultramat 16s and a Ultra Duo Plus 40. It logs the data on stdout (depending on the debug setting) and stores data in a mysql datab
ase (see database.sql for the schema). The data can be accessed via a small web interface. The graphs are created with jpgraph. You can see the example output with graphs from a task below. Tasks are created automatically. Events
like „start“, „finished“ are detected and linked to the current task, here is an example for a cycle:

Timestamp Name Status
2011-09-16 08:29:02 Discharge start Normal
2011-09-16 08:41:41 Discharge finished Cycle delay
2011-09-16 08:44:45 Charge start CVCC
2011-09-16 09:53:56 Charge finished Cycle delay
2011-09-16 09:57:00 Discharge start Normal
2011-09-16 10:12:46 Discharge finished Cycle delay
2011-09-16 10:15:50 Charge start CVCC
2011-09-16 11:11:18 Charge finished Cycle delay
2011-09-16 11:14:22 Discharge start Normal
2011-09-16 11:31:36 Discharge finished Cycle delay
2011-09-16 11:34:40 Charge start CVCC
2011-09-16 12:23:44 Charge finished Cycle delay
2011-09-16 12:26:48 Discharge start Normal
2011-09-16 12:44:00 Discharge finished cut-off discharge

Sourcecode:
http://svn.linuxmce.org/trac/browser/people/hari/stuff/ultramat

Example output:

Information for task 39


Events


Timestamp Name Status
2011-09-17 16:00:58 Charge start CVCC
2011-09-17 17:05:51 Charge finished cc-cv full

Details

Max output Voltage 37.732 V
Cur output Voltage 37.726 V
Min output Volt 34.263 V
Max output Ampere 2.223 A
Act output Ampere 0.219 A
Charge 1.812 Ah

Cell 1 4.190V
Cell 2 4.192V
Cell 3 4.198V
Cell 4 4.206V
Cell 5 4.206V
Cell 6 4.206V
Cell 8 4.187V
Cell 9 4.188V
Cell 10 4.178V

Charge



Voltage



Current



Power



Cell view


Dune Emperor LAN Multiplayer beyond subnets

Disclaimer

This information is provided as is with no warranty. If you burn your kitchen sink don’t blame me. Copyright (c) 2002 vt100.at

Introduction

This is a small howto play Dune Emperor in LAN Multiplayer mode with the nodes sitting in different subnets. We use the udp forwarding feature of Cisco („ip helper“) to unicast forward the initial game setup broadcast packets from the client to the game host.

Prerequisites

  • At least 2 Dune Emperor Games
  • At least 1 Cisco router or multilayer switch
  • handle your cisco gear with care!

Sample Network

Dune Game Host - Router0 - ... - Router1 - Dune Game Client

Cisco Config

boring things cutted out…

!
! Router0 local LAN interface
 interface FastEthernet0
! this is the ip address of the Dune Game Host
   ip helper-address 192.168.2.20
 ip forward-protocol udp 4927
!

Links

These links were helpful:

http://www.cisco.com

Conclusions

Don’t waste this feature with dhcp, play dune 😉

Fremen Warrior.

Reminder

Handle your Cisco © gear with care.

Cisco 2800 and Asterisk with VIC2-2BRI-NT/TE and „Anlagenanschluss in Austria“

Disclaimer

This information is provided as is with no warranty. If you burn your kitchen sink don’t blame me.

Introduction

This tells the tale of our VoIP-tests.

Prerequisites



  • Cisco 2800 Router (with DSPs)

  • Cisco VIC2-2BRI-NT/TE or EM-4BRI-NT/TE


  • IOS ipvoice or other voice feature sets



Sample Network




Asterisk — Router0 — ISDN PtP BRI

Hints



  • use „compand-type alaw“ in voice-port or you get distorted sound

  • set „static-tei 0“ or point-to-point setup won’t work

  • don’t send the „display-ie“, Austria Telecom doesn’t like this

  • without „isdn sending-complete“ you can’t initiate calls (Phunny note: Cisco says: „required in Hong Kong…“)

  • handle your cisco gear with care!


Cisco Config

boring things cutted out…


! use external clocking source
network-clock-participate wic 0
network-clock-select 1 BRI0/0/0
!
voice class codec 1
! we use alaw to avoid codec translations (see compand-type below)
codec preference 1 g711alaw
!
! If the called number is an empty string substitute it for a default extension
voice translation-rule 1
rule 1 /^$/ /7/
!
! Insert leading digits for caller-id
voice translation-rule 2
rule 1 // /0/ type national national plan any isdn
rule 2 // /00/ type international international plan any isdn
!
voice translation-profile tr_7
translate called 1
translate calling 2
!
interface BRI0/0/0
description BRI PTP 43316123456
no ip address
isdn switch-type basic-net3
! we want did
isdn overlap-receiving
! ptp config (see static-tei below)
isdn point-to-point-setup
! static tei must be set for point-to-point-setup to work
isdn static-tei 0
! incoming calls are treated as voice
isdn incoming-voice voice
! user timeouts
isdn T306 60000
! some ie testing
isdn outgoing ie progress-indicator
no isdn outgoing ie caller-subaddr
isdn outgoing ie called-number
no isdn outgoing ie called-subaddr
no isdn outgoing ie user-user
!
! IMPORTANT! Austria Telecom requires this
!
isdn sending-complete
no isdn outgoing display-ie
!
!
voice-port 0/0/0
echo-cancel mode 1
non-linear comfort-noise attenuation 0db
!
! IMPORTANT! A-law for Austria Telecom
!
compand-type a-law
cptone AT
description BRI PTP 43316123456
bearer-cap Speech
!
!
dial-peer voice 1 pots
translation-profile incoming tr_7
description incoming/outgoing ISDN
incoming called-number .T
direct-inward-dial
port 0/0/0
forward-digits all
!
dial-peer voice 100 voip
description Alice – 6.*
service session
destination-pattern 6T
voice-class codec 1
session protocol sipv2
session target ipv4:x.y.z.a
session transport udp
dtmf-relay rtp-nte
!
dial-peer voice 110 voip
description Bob – 7.*
service session
destination-pattern 7T
voice-class codec 1
session protocol sipv2
session target ipv4:a.b.c.d
session transport udp
dtmf-relay rtp-nte
!
dial-peer voice 500 voip
description Chris – [0-5,9].*
service session
destination-pattern .T
voice-class codec 1
session protocol sipv2
session target ipv4:f.g.h.i
session transport udp
dtmf-relay rtp-nte
!

Asterisk SIP Config

boring things cutted out…


[pots]
type=friend
host=1.2.3.4
insecure=very
disallow=all
allow=alaw

Caveats

Only IP Authentication! Watch your ACLs!

Links


These links were helpful:


http://www.cisco.com

VoIP Info Wiki Asterisk+Cisco+CallManager+Express+Integration
Number Translation using Voice Translation Profiles


Conclusions


Good sound, fast call setup, great hardware. Plays nice with Asterisk.

Reminder


Handle your Cisco © gear with care.

Circuit Emulation over IP using a NM-CEM-4SER

Disclaimer

This information is provided as is with no warranty. If you burn your kitchen sink don’t blame me.

Introduction

This tells the tale of our CEoIP-tests.

Prerequisites



  • Cisco Router (2600XM or bigger, needs 128 MB RAM)


  • Cisco Network Module NM-CEM-4SER or NM-CEM-4TE1


  • IOS 12.3(7)T, one of the following Featuresets:


  • SP Services


  • Enterprise Services


  • Advanced Enterprise Services


  • Advanced IP Services


  • 128 MB RAM for your Router



Sample Network




Legacy Client (X.21) — Router0 —WAN— Router1 — Legacy Client (X.21)

Cisco Config (only Router0 shown, Router1 should be obvious)

boring things cutted out…


!
cem 1/1/0
clock rate 256000
clock mode normal
payload-size 196
dejitter-buffer 120
payload compression
data protection
xconnect [Router1 IP] 0 encapsulation udp
local ip address [Router0 IP]
local udp port 15901
remote udp port 15902
!

Links


These links were helpful:


http://www.cisco.com


Conclusions



Reminder


Handle your Cisco © gear with care.