sunnuntai 21. maaliskuuta 2010

pNabServer

I've wanted to learn python for a while, and started talking about python html-servers with a friend. One sleepless night later I have communication going on with my python script and the nabaztag.

So far I've only managed to send the bytecode, tell the logging information and have some ambient lights blinking. Slow progress, but progress nevertheless. Sending the encrypted commands is a bit pain, but I think I have the encryption function working.

One day with python behind and loving it.

Oh, and thank you moo--- at #python.fi for some bitwise-advice :)

lauantai 20. maaliskuuta 2010

Again with the Nabaztag:tag


Ok, I've got the text-to-speech working. I'm using Google's Translate TTS service for the voice. I made a little addPlayTTSCommand(string tts) function to MessageBlock.java with this as the magic:

this.commands += "ST http://translate.google.com/translate_tts?ln=en&q=\"" + tts + "\"\n";

Google TTS sound pretty nice, but it has something like 97 character limitation. I'll split these later and just stream them back-to-back, or make my own service with festival and a bit of php.

To make a lot of scripts to work easily with nabaztag, I made some dirty API function to Worker.java. Parameter "sn" is for serial number, "tts"is for text-to-speech string and "stream" is for MP3s and web radios. It could use some kind of password or "token" like violet is using.

I'll put a video or something up later, right now I'm getting local weather in speech by pressing the button, and random funny movie sound clips when I show the bunny a RFID tag. Good times.



torstai 18. maaliskuuta 2010

Nabaztag hacking.


I recently bought a Nabaztag:tag with three RFID-enabled books. I wasn't happy with Violet's applications or server. Worst thing of all, there were not one Ztamp in the package and you can't remove the book-reading application from the storybooks. So I searched for alternative.

Best result was the slightly undocumented jNabServer. I've been to the smart home at Tampere University of Technology, seen their bunny, and actually that was the fist Nabaztag I've ever touched. Turns out that they were working on their own Nabaztag server.

There hasn't been any activity for a year, I'm not sure if it's still going on, but this was a goldmine for me. All the nasty stuff was already written and all the good ready to.

I got the code to compile under NetBeans 6.8, and got my Nabaztag:tag (named "Namoztag" obviously) to connect to it. It's all pretty dirty code, and completely just to test the thing out, but I've tried to document some parts of it. Firstly, the Light Language that tells the user when it's raining (so you don't have to look outside) or if the sun shining etc. They are sent in a Packet with a AmbientBlock.

AmbientBlock has a function called setAmbientValue(int Type, int Value), and this is the list of Types and Values:

Type 0 - Nothing
Type 1 - Weather
0 - Sunny
1 - Cloudy
2 - Smog
3 - Rain
4 - Snow
5 - Storm
Type 2 - Market
0 - Down a lot
1 - Down some
2 - Down a bit
3 - Stable
4 - Up a bit
5 - Up some
6 - Up a lot
Type 3 - Red lights, no documentation from Violet
0 - Red Left and Right, Blinking
1 - Red Center, then Red Left and Right
2 - Same but faster.
3 - Same but even more faster.
4 - Even faster
5 - Faster still
6 - Warp 6 the seizure more.
Type 4 and 5 do nothing.
Type 6 - Mail
0 - No mail waiting.
1 - One mail waiting.
2 - Two mails waiting.
3 - Three or more mails waiting.
Type 7 - Air quality
1 - 4 Good
5 - 7 Average
8 Lousy

Well, that's it for tonight. I'm working on getting a text-to-speech working somehow, maybe using a PHP to launch Festival on Linux, and streaming the wave file straight to the Nabaztag using the addPlayStreamCommand(). And maybe an URL based nabaztag messaging system to enable whole lot of applications to talk trough my Namoztag.