Proof-of-concept: energy metering with TI Stellaris Launchpad and Python

One afternoon I was trying to think of some quick and easy thing to do with my Stellaris Launchpad and remembered that for a long time I had been pondering on the possibility of semi-accurately measuring the real-time electricity consumption of a whole house. And finally I can present a raw proof-of-concept on that.

I had the MCU, but lacked a sensor. Thinking that I had an LDR tucked somewhere I searched my stashes but unfortunately all I could find was an old calculator solar cell. Might as well give it a try. Knowing practically no theory on connecting anything to MCUs I just plugged its ground to GND and + to an analog input pin via a 4k7 resistor I had lying around. And behold! After some tinkering with the code, I was able to poll meaningful light values with rather non-existent latency. See a video.

Next step: taping the solar cell to the electricity meter and hanging the Stellaris board from a nearby cloth hook. The readings were then transmitted over wi-fi to my desktop for visualization. I implemented an extremely simple pulse detector with on-off thresholds, but it required constant adjustment due to the sun. But the concept was verified, it is very possible to do real-time energy metering with high accuracy.

Maybe I’ll find time some other afternoon to make/find better (delta-based?) pulse detection algorithm and then offload it to the MCU, leaving it to only emit the actual time stamped pulses and kW/h readings.

Edit: had to try the deltas: works great.

USG documents now public

Having worked on this document for several(maybe even a dozen) hours over the past two years, I feel it’s finally time to let the world see how I have big plans. Big plans that will probably never be fulfilled. Actually I don’t expect to get everything done, but rather see it as something to work towards to.

There is also some videos on my YouTube channel.

* * *

For those unfamiliar with my projects: USG is the newest incarnation of my long-running series of space themed 2D games.

Old versions of The Peli –game project now on video

Had a short discussion about my game project today. Short story shorter, I didn’t have any material to show what is was like years ago.

Now I do. It was surprisingly simple to get most of the versions to run like they used to. The only real challenge was eliminating the dependency for an asset server; at that time one of my interests was streaming patching and bigfiles as in Guild Wars. Of course I had to implement my own version to a ‘real’ game. After some asset hunting and code patching the games successfully loaded local files and I could finally record the videos in question.

Except one. I had some serious issues with font rendering in one of the versions(pygame either segfaults or freezes without error) and in the end had to replace the fonts with placeholder squares; no idea why in broke and no real reason to fix them.

I accidentally a server – Part II

Ok, I admit this part took a while longer to write than I originally planned, but this is here now and that’s what matters, maybe. This post was supposed to be more like a configuration guide, but as so much time has passed this turned out to be just reflection. In the previous part I talked a bit about the Usva’s initial hardware related issues so now it’s turn for software.

* * *

As usva would be primarily a virtualization platform, all it really needs is a flexible firewall, a virtual machine manager and some sensors. Debian and KVM itself installed without a hitch, but getting all the other things to work properly was bit of a chore.

First to be configured was shorewall; it’s rules and bridge groups. The plan was to have three different levels of firewalling. One for local network with no traffic restrictions, one for servers with no direct access to lan and lastly a testing / untrusted network where only a single ip/proto/port-pair was accessible from the VM:s, ideal for VPN-only traffic. All interfaces would share a single NAT’d network connection.

Amazingly the configurations weren’t that hard to implement with a bit of help. But of course there were problems, the bridge groups got cleared on reboot and a file in /etc/networking required some tuning to fix that. Also the nic-driver required some module magic. Oh, and I still haven’t thoroughly understood how to configure shorewall.

* * *

Some while later, when everything was working relatively smoothly I finally got to configuring sensors properly. Initially I had managed to get some readings, but now nothing worked. After a fair bit of googling around and trying to load modules it became clear that a newer kernel was required.

No problem! I’ll just copy this old kernel config and compile with --initrd. Nope! Shorewall required some more exotic switches to work, again! And who would have guessed, almost a whole number bigger kernel version number and I finally got some sweet temperature readings.

* * *

Everything went as expected? Nope.

Usva was supposed to firewall and NAT my entire lan(and server as an IPv6 gateway), but due to either noise or hardware constraints(can’t have both) that is not possible at the moment. That old Cisco 871 must continue it’s 70% of max speed NATting job.

Web server? Still haven’t found the time for configuring, the one in Routa is enough for personal use, www.dea.fi for the rest.

What then? Only a pitiful Minecraft server with technology related mods…

Guild Wars 2 - some thoughts

"[Y]ou have played for 255 hours 48 minutes over the past 25 days."
* * *

Now that the most anticipated game has been released, I must confess that I'm a little dissapointed.

While the overall gameplay is nice and dynamic, it gets a bit repeative even if one tries to vary doing hearths, PvP, dungeons, exploration and general PvE. And as I said earlier, I'm hugely dissapointed in the fact the game lacks any kind of mana(well, almost, initiative doesn't count for this).

On it's defence though Guild Wars 2 has a really dynamic and dodge-heavy combat mechanics to balance that otherwise cooldown-based skill system.

* * *

First I made an Elementalist, as the attunement managing was supposed require smart playing and all stuff glorious, but I found myself just using fire magic for everything due to the DPS it offers. Only occasionally did I use the other attunements. Ele also felt far too squishy in Orr even when dodging like crazy.

Then I made a Guardian. It had the survivability I wanted, and quite suprisingly also had some serious DPS, even more than my ele!

Next - not that the class was bad or anything - after getting bored(only slighlty) to Guardian, Thief was next. As initiative was a resource to be managed I was quite excited. But meh, the class felt like, I don't know, it was lacking something. So, after getting to level 24 I made an Engineer.

Now, at this point I was quite excited about WvW(see paragraph later). The Engineer has a Mortar elite skill and turrets, so it is supposed to be The perfect class for WvW defenses. It indeed offers various kits that can be freely used even during combat and without cooldown, making it a very adaptable class. Seemingly perfect, but the game has begun to take it's toll. Having already 'grinded' almost 200 levels, getting another 80 was starting to fell bit exhaustive.

Currently I have managed to get this new Engineer to level 30 and unlocked that tier two elite mortar skill. Now I feel like I might actually be able to take a small rest and do some casual WvW.

Except that I should be farming while I can, gem prices have skyrocketed during the past few days. Get some gems while they are relatively cheap. Oh well...

* * *

Endgame areas have also been suffering from an unfortunately high bugrate. Some skill challanges and events are frozen or otherwise rendered unplayeable. It is also possible to get stuck inside some objects.

On the other hand World vs World vs World has been full of suprises. During betas and also during the full game I've disliked the long distances and zergs there. It has changed, I got recruited to a smallish WvW guild by a chance and had a blast holding Redlake tower last night. Reinforcing, supply chain and breaking sieges suddenly felt much more enjoyable.

I accidentally a server – Part I

I hereby announce, that my infrastructure took a giant leap forward as I purchased a i3 server(i3 530, 4GB low latency RAM, passive cooling except PSU) on the small hours of some random day not too much in the past. Deals were smooth, the merchant in question was a semi-friend and a computer event was just coming up, so a trusted third party could pick the hardware from there, and then later deliver it to me. Effectively zero postage.

But then the curse kicked in. On the few last kilometers the transport of the 3rd party broke, and caused a delay of several hours. But then it finally arrived.

I found out that the case I had in mind had a bit non-standard method of attaching the motherboard, so I had to forcibly remove some parts from an earlier mobo from that case, and ta-da, almost good as new.

Next part of the curse: chipset does not support on-board video, and no low-end video cards available. Ok, let's just borrow one from routa.

But then things got hardcore; PSU did not have connectors for additional power the GPU requires. So, instead of complete PSU change, let's just power the GPU with another PSU! While it is still in another case, but not connected to anything else. Wirestart, mmm.

Now that the system was up and running, it came time to install an OS. I wanted to finally test out ESXi, and it installed to a USB stick and booted up just nicely. Unfortunately there was a catch; no support for sensors, no support for a Realtek NIC and no support for the mobo's SATA controller. There is some unofficial drivers available, maybe, but at this time I think I'll just install Gentoo Debian. More on that on a later post.

I accidentally Genelecs

I was actually very much considering on getting headphones, but having been repeatedly exposed to the eargasmic sound waves of my friend's Genelecs, I had no choice.

So, on one hazy afternoon Lannukka headed to Iisalmi. Prices had been negotiated earlier, so only a little while later we headed back, with a 7050B for Pilkki and two 8040As for me.

Unboxing, cabling, Zephyr. Oh, and photos.

Guild Wars 2 Public Beta: Observations


First of all: great job ANet, it only took few hours to get things working. It took close to 24 hours from Blizzard to get D3 Open Beta in any kind of working order :D

Overall the game seems to function fairly well, but there is some minor things I want to note.
  • When opening map while holding RMB, character can't be steered.
  • When using melee attacks, one must manually to move to range.
  • Dynamic events don't change the world very much, all is a lie :(
  • Dynamic events seems to have minimum difficulty, one or two players will have a hard time completing one.
  • Looting requires a) navigating to corpse b) interacting with it c) claiming items, too long a chain.
  • The there was about eight bugs I reported, but they are not included in this list.
But then there also is some bigger concerns
  • Mobs start to regenerate far too fast, pull little too far and they get full health almost immediately.
  • Leveling progression is slower than that of enemies, making fights harder and harder, and then there will be level grinding..
  • I want Energy back to the game, this is just spam-fest now!
  • There is not too much freedom on skill selection. In original Guild Wars I could fill my bar with heals, for example, but here I can only select one. The unchangeable skill selection for weapons also was bit of a let down. Of course one could change weapon, but I want to use that weapon differently.
But there was some great things, too.
  • Dynamic events, at least when experiencing them the first time, they were just great. People would just pour in and everyone would just really want to beat the bad guys or whatever.
  • New quest system. Yes, it is the same old 'Kill ten rats and/or do x', but no explicit quest accepting/turning in procedure, gives more fluidity for everything.
  • And about fluids, water is an interesting element, no longer a barrier.
  • Reformed combat. Moving while casting and attacking really gives a new dimension for combat and exploration.

A smooth start for the first Guild Wars 2 Public Beta, NOT! And diary!


The beta was supposed to start at 22 o’clock, but when I tried to log in about 21:45, I got in after a few tries !!1! Even managed to make a nice Norn Ranger and watch the opening cinematic, but then I was greeted by a black screen at the end of the opening cinematic and hung there… And now I can’t get back in, forums are down and there is talks about crashed servers. Well, so far this still has gone better than D3 open beta. Really hoping I get to play the game today.

22:57: Managed to get to character selection screen for a brief time, but all controls became unresponsive, so I logged out, again.

23:06: Third time in, failed to get to game world, and UI locked again.

23:54: Finally managed to log in, same error and lockup. Went to sleep.

-- Saturday begins

3:30: Woke up, checked whether the game works, it worked. Went back to sleep.

4:30: Couldn't sleep, started gaming. All is well.

5:46: Got kicked out. Got back immediately. Seems that my progress was rollbacked about five minutes..

6:16: Got kicked out, couldn't get in right away. I hear there's some maintenance.

6:50: It's on!

14:30: I was going to switch characters, but error messages greeted me then and every time after character selection. Maybe I should take this moment to eat something.

15:15: Servers allowed me to continue gaming.

19:00: Felt sleepy, wen't for a nap.

20:40: OK, let's continue.

22:45: Got kicked out without so much of an error message.

-- Sunday begins

00:45: It's on, finally!

00:55: Or not.. no error once again..

05:55: How about some sleep now? Not tired yet, but bad things might happen without sleep. Well, at least I played 18 hours and 30 minutes with the last sleep. Pity that beta end Monday at 09:00, and I have normal things to do then, so can't play too this following night.

14:10: It's on!

00:28: First ever crash for me.

01:55: Oh well.. have to get up fairly early in the morning, so this will have to do... 30 hours(exactly) is better than nothing.

07:55: Before going to sleep I heard there would a ending event, so had to wake up to play it. Turns out it only begun when the beta was supposed to end. Anyway, it was awesome! I even have few videos in youtube about Champion Bloodthirsty Black Moas.

09:03: Bam! Login screen without error message, I'm getting used to this. Pity this was the last time this would happen in a long time, as the BETA IS OVER! Playtime: 32 hours 8 minutes.The beta was supposed to start at 22 o’clock, but when I tried to log in about 21:45, I got in after a few tries !!1! Even managed to make a nice Norn Ranger and watch the opening cinematic, but then I was greeted by a black screen at the end of the opening cinematic and hung there… And now I can’t get back in, forums are down and there is talks about crashed servers. Well, so far this still has gone better than D3 open beta.
Really hoping I get to play the game today.

22:57: Managed to get to character selection screen for a brief time, but all controls became unresponsive, so I logged out, again.

23:06: Third time in, failed to get to game world, and UI locked again.

23:54: Finally managed to log in, same error and lockup. Went to sleep.

-- Saturday begins

3:30: Woke up, checked whether the game works, it worked. Went back to sleep.

4:30: Couldn't sleep, started gaming. All is well.

5:46: Got kicked out. Got back immediately. Seems that my progress was rollbacked about five minutes..

6:16: Got kicked out, couldn't get in right away. I hear there's some maintenance.

6:50: It's on!

14:30: I was going to switch characters, but error messages greeted me then and every time after character selection. Maybe I should take this moment to eat something.

15:15: Servers allowed me to continue gaming.

19:00: Felt sleepy, wen't for a nap.

20:40: OK, let's continue.

22:45: Got kicked out without so much of an error message.

-- Sunday begins

00:45: It's on, finally!

00:55: Or not.. no error once again..

05:55: How about some sleep now? Not tired yet, but bad things might happen without sleep. Well, at least I played 18 hours and 30 minutes with the last sleep. Pity that beta end Monday at 09:00, and I have normal things to do then, so can't play too this following night.

14:10: It's on!

-- Monday begins

00:28: First ever crash for me.

01:55: Oh well.. have to get up fairly early in the morning, so this will have to do... 30 hours(exactly) is better than nothing.

07:55: Before going to sleep I heard there would a ending event, so had to wake up to play it. Turns out it only begun when the beta was supposed to end. Anyway, it was awesome! I even have few videos in youtube about Champion Bloodthirsty Black Moas.

09:03: Bam! Login screen without error message, I'm getting used to this. Pity this was the last time this would happen in a long time, as the BETA IS OVER! Playtime: 32 hours 8 minutes.

In anticipation of next week’s Guild Wars 2 Public Beta

I’ve had high hopes for GW2 even before it was announced, and finally I’ll get a chance to try it out personally! Needless to say, I’m getting fairly exited here.

Or that would be the case had I not seen videos of previous closed beta. I’m having serious doubts on the fact they removed Energy from the game. That means that for most of the classes there is only a single resource to manage(recharge). Without firsthand playing experience I am having huge difficulties believing that recharge and timing alone give as much of a challenge and joy as they did in Guild Wars 1 which also had Energy.

And what I have gathered from videos and other sources, I feel that Guild Wars 2 has been dumbed down in other areas, too. Take the Mesmers, for example. They’ve been hugely shown in the media, but I haven’t seen them doing much shutdowning. Ok, Izzy mentioned that interrupts for example were given a much smaller role than in GW1 due to latency issues, but.. They worked just fine in GW1, don’t change that. They add depth to the game and encourage varying casting order and positioning away from the interrupter. On the other hand they allow skilled players to really dominate their enemies if they know what they are doing, rewarding expertise.

But that gets us to another key aspect: positioning. The dev team has been pretty exited about it’s importance and told that it would have a huge impact on battles. I’m not sure if they have been making it an even bigger mechanic as time has passed, but earlier they were very careful not to introduce [cheap] skills that affect position or movement, but recently I’ve seen more skills doing just that. It will be interesting to see what is the reality here.

Moving on to bigger stuff: the first M in MMO. Guild Wars 1 can be said to be only a MO, but now that Guild Wars 2 is here it gets Massive. The devs have faced an enormous challenge in transforming GW1 to a massively playable state. I have played some tiny amounts of WoW, and was quite pleased with the massive aspect in it, world felt like a much more lively place when another player could be seen doing the same things as you were etc etc. The massive aspect is one of the biggest things I am looking forward to experiencing, but GW1 mechanics might have difficulty directly translating  to a scale like this. There lies the danger of dumbing everything down to a point where old players start to feel uncomfortable about the core mechanics. Widest possible audience is sometimes not what you want.

But will Guild Wars 2 be Guild Wars 2, or just a MMO set in Guild Wars universe? If you ask me, the game mechanics are almost as important as story and setting. Next week will answer so many questions.