Counter rollover…

I like to automate things… but sometimes it just doesn’t work out as planned. Today my power usage counter reached it’s maximum value and started counting from 0 again.

I knew this would happen some day, i thought i had it all covered in my Home Automation system, but it didn’t work out as planned; i had to fix some power usage records in the database today. The charts looked like complete garbage!

In my system i keep detailed information about every piece of hardware i use and how it is being processed. The hardware that i use for counting the Wh pulses contains a counter of 3 bytes, ranging from 0..FFFFFF hex (0..16777215 decimal); that’s 16777 kWh.

So what did i do a long time ago to prevent a counter rollover from giving me work that i don’t want to do? I created a ‘counterbits’ field in my database where i can store the number of bits a countervalue is based on. With this it’s easy to calculate the maximum counter value to expect. So far so good.

Whenever a countervalue is received with a smaller value then the previous one, the ‘counter rollover protection’ mechanism starts working.. it calculates the (additional) offset to be used based on the ‘counterbits’ field, adds this to the current value of the  ‘counteroffset’ field in the database and this new counteroffset value is added to the value that was received. No need to do anything; complete automatic counter rollover recovery.

But don’t mess up your database resulting in a counterbits value being set to zero!!!

Then it won’t work… so despite all effort, today i had to browse the tables with the historical data and fix some values… and wait another 2-3 years to enjoy having this automated…  🙁

JeeNodes!

They arrived last Tuesday. 2 JeeNodes, together with a JeeLink and a pressure sensor. And an additional Arduino for experimental stuff.

JeePlug

JeeLink

Although i had a lot of other things to do, i just couldn’t resist building at least one of the two i ordered. The JeePlug kit is easily soldered together so after half an hour i had my JeePlug and first JeeLink running. Next thing to do is get the Pressure Sensor working, receiving the data and processing it in my Domotica system.With all the information provided on Jean-Claude Wippler’s website that shouldn’t be a problem 🙂

So when you find a pressure chart on my website in the near future, you know where the data’s coming from…

Digital Code Lock

Last Friday a Digital Code Lock arrived. I want to see if i can do something useful with it. It is intended for use with a door opener.
Above the keypad there are 3 LEDs of which 2 are freely usable; the 3rd (middle) bi-color LED shows the status of the code lock.  The code lock comes with a manual with description of all connections and some connection examples.

Digital Code Lock

Digital Code Lock

Code Lock Internals

Code Lock Internals

It’s one of the cheaper code locks, but if all goes well and i’m satisfied i might buy another more eye-catching one.

This model has a sabotage switch inside just like the tamper switch on the inside of Visonic sensors. I’m going to connect this switch to a Visonic MCT302 aux input located inside my house and any attempt to sabotage the code lock will fire the alarm. One of the freely usable LEDs is going to display the status of the alarm, the other free LED doesn’t have a function assigned yet. Just a matter of time…

The Code Lock will be supervised by an Arduino so i can make full use of all the functionality it has to offer.

To be continued…