EnergyCount 3000, part 2

15.07.2012 20:18

A few months ago I was writing about my attempts to reverse engineer radio transmissions from Voltcraft EnergyCount 3000 devices. Since then a lot of the things I was speculating about got much clearer, mostly thanks to reverse engineering efforts on the jeelabs.net forum. Yesterday there was an Open Data Hackday in Kiberpipa and, while this wasn't strictly on topic, I finally managed to integrate all of the little pieces of the puzzle together into one working, simple to use Python module.

Voltcraft Energycount 3000 energy logger

So today, I'm pleased to announce the first release of ec3k, a software receiver for EnergyCount 3000 devices. It's built around GNU Radio and currently works with cheap, RTL2833-based receivers. You can fetch it from Cheese shop or directly from GitHub. It's licensed under GPL version 3 or later.

The biggest obstacle you need to cross before using it is installing GNU Radio, rtl-sdr and gr-osmosdr. A good starting point is the Osmocom Wiki which has a quick overview and links to other relevant documents. When GNU Radio is working for you, only the standard Python distutils dance remains:

$ python setup.py install
$ python setup.py test

The package includes a simple command utility which prints out all received packets to the standard output:

$ ec3k_recv 
linux; GNU C++ version 4.4.5; Boost_104200; UHD_003.004.002-128-g12f7a5c9

gr-osmosdr supported device types: file fcd rtl rtl_tcp uhd 
Using 16 buffers of size 262144.
Using device #0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Elonics E4000 tuner
>>> gr_fir_ccf: using SSE
Using Volk machine: avx_64
Noise level: -27.3 dB
Noise level: -27.4 dB
Noise level: -27.5 dB
id              : f100
uptime          : 4004 seconds
since last reset: 37809 seconds
energy          : 385300 Ws
current power   : 1.3 W
max power       : 2.3 W
energy          : 4579600 Ws
Noise level: -26.7 dB
Noise level: -26.8 dB

Here is how you can use the ec3k module from your own Python code:

import ec3k

def callback(state):
    print state

my_ec3k = ec3k.EnergyCount3K(callback=callback)

my_ec3k.start()
while not want_stop:
    time.sleep(2)
    print "Noise level: %.1f dB" % (my_ec3k.noise_level,)

my_ec3k.stop()

As shipped, the receiver uses around 20% of one CPU core on a 2.7 GHz Intel i5 CPU. You can improve that by using my C implementation of the base-band decoder from the am433 project. Just compile the capture binary (version 0.0.4 or later) and drop it somewhere in your PATH. ec3k should find it automatically and use it instead of the built-in pure Python implementation.

For details on the API, please check the included README and docstrings. README also lists a couple of known problems that are still present in the code. Any help regarding those, or otherwise, is most welcome as always.

Again, thanks goes to the people on jeelabs.net forum for figuring out how to descramble the packets and Gašper for providing the hardware, Python base-band decoding code and testing.

Posted by Tomaž | Categories: Code

Comments

Awesome work, thanks! Is it possible to determine the state of the Voltcraft devices (switched on/off) or would I need to figure it out by looking at the current power consumption?

Posted by simon

My EnergyCount 3000 sensors don't have an on/off switch. They are always on when they are plugged in.

If you want to know whether some device that is plugged into a sensor is turned on, then the only way is to check its power consumption.

Posted by Tomaž

Thanks! I thought they'd be remote controllable. But still very cool.

Posted by simon

Hello,

thanks a lot for the work you put into this. I'm trying to get this to run with a logilink dvb-t stick.
(Logilink VG0002A USB id 1D19:1101 chipset/tuner: RTL2832U/FC0013)

Unfortunately I always run into the same error, I'll append the error message at the bottom. Do you have any idea what I may do to figure out the root cause of this?

I tried this with gnuradio 3.7.5.1 and gnuradio 3.7.3 on my i686 PC running debian wheezy and also on my raspberry PI with the latest image provide by Gareth Hayes (http://garethhayes.net/gnu-radio-for-raspberry-pi/). On the PI I first got a segmentation faultpt in gnuradio which I could fix using the advice from this page: https://gnuradio.org/redmine/issues/692 -- after this I get exactly the same error on the raspberry pi as on my PC. The output below is what I get on the raspberry PI, but it's the same as on my PC.

By now I have put several days of work into the attempt to get this up and running and by now I'm out of ideas. Maybe the version of gr-osmosdr (the latest one, I think -- the error seems to come from there) I'm using introduced a new bug - can you maybe tell me which versions worked for you? Alternatively, does the combination of latest versions of gnuradio, rtl_sdr and gr-osmosdr work for you?

The ec3k installation and 'python setup.py test' command seems to run without error, btw.

Sorry to bother you with this. If you don't find the time to look into this then again thanks for providing this page and happy New 2015.

Thomas

The output from ec3k_recv:

linux; GNU C++ version 4.6.3; Boost_104900; UHD_003.004.002-0-unknown

gr-osmosdr v0.1.3-4-g42c66fdd (0.1.4git) gnuradio 3.7.5git-0-g2bb2b314
built-in source types: file fcd rtl rtl_tcp uhd hackrf rfspace
Using device #0 Realtek DVB-T Dongle SN: 00000991
Using 16 buffers of size 262144.
Found Fitipower FC0013 tuner
Using Volk machine: generic
Traceback (most recent call last):
File "test.py", line 9, in <module>
my_ec3k.start()
File "/usr/local/lib/python2.7/dist-packages/ec3k.py", line 315, in start
self.tb.start()
File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/top_block.py", line 104, in start
top_block_start_unlocked(self._tb, max_noutput_items)
File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/runtime_swig.py", line 3576, in top_block_start_unlocked
return _runtime_swig.top_block_start_unlocked(*args, **kwargs)
RuntimeError: In hierarchical block source_impl, output 1 is not connected internally

Posted by thomas

Thomas, please try ec3k 1.1.1 I just released. It should fix the problem you are having.

https://pypi.python.org/pypi/ec3k/1.1.1

Posted by Tomaž

Hi Tomaž,

Thanks for this excellent piece of software! I got very enthusiastic about the possibilities but also encountered some issues. One issue I found is that for all of my dongles the default frequency of 868.402 MHz doesn't yield any results. When investigating this I found some interesting characteristics for the usable frequencies. I created a little blog about this software, the issues encountered and the way I tackled them at https://batilanblog.wordpress.com/2015/02/17/using-ec3k-with-raspberry-pi/. People using the software might want to have a look at it. Any comments for improvement are welcome.

Posted by Batilan

Batilan, very nice write up. Thanks.

Posted by Tomaž

Thanks for the work and the article. Do you know if the Voltcraft Energy count 3000 measures the power consumption of computers correctly? I have the Voltcraft Energy monitor 3000 and that one displays active power, apparent power and cos phi.

Posted by Jonas

Jonas, I haven't tested the accuracy of Energy Count 3000 measurements. The "power" values returned by ec3k are active AC power. As far as I know, Energy Count 3000 doesn't measure apparent power or cos phi.

Posted by Tomaž

Hello i want to build a system on a raspberry, can you tell me , where to buy and witch type usb dvb-t stick, please mail me TKS

Posted by Jan

Add a new comment


(No HTML tags allowed. Separate paragraphs with a blank line.)