Weather report from SirBot (DIY Nabaztag…)

I’ve recently been offered a Nabaztag rabbit. It’s able to do lots of little things such as reading RSS feeds, reporting the weather and air quality, … The problem is it’s not reliable: it sometimes crashes, repeats the same things over and over again. And most of all, it’s not very configurable except if you pay a subscription (but who might want to pay for something not working…). Anyway, it’s time for a “Do It Yourself” approach !

I’ve been play with PIC audio sampling, ADC and PWM for a while, and I have to say results are quite amazing ! Building a bot able to report the weather should be easy, provided:

  1. we’re able to produce a wav speech file from text (using text-to-speech, TTS)
  2. information from the Internet can be retreived and parsed
I’ve tested several TTS programs: espeak, festival, kttsd, but espeak is easy to use and produces a nice robotic voice :) It’s also able to put the result in a wav file.About information retrieval, Yahoo Weather offers a nice API to get a XML file (and no registration is needed) easy to parse (I actually used sed to get the weather and temperature from the XML file…).

The principle is the following:

The Jal program is simple: after configuring a PWM pin, it just receives data from the serial link (115200 bds) and sets the duty cycle with a 8 bits resolution. It can play PCM, 8 bit, mono 11025 Hz wav file (a wav file also contains information about the encoding. Those informations will also be sent, but that’s not a big deal :) ).
include sb_config
include sb_protocol
include sb_mainboard

-- Configure PWM
pragma target ccp1  rb0
pin_b0_direction = output
include pwm_hardware_1
PWM_Init_Resolution(20,true,false)

include sb_sound
pwm_on()

var byte char
forever loop
    if sb_serial_read(char)
    then
        PWM_Set_DutyCycle(char,0)
    end if
end loop
And… here’s the result:

(there might be problems with the video: voice might be too low, this a mov-to-flv conversion problem…).

If not clear enough, it says:
“”"
Hi ! This is the SirBot Project.Today, I’m gonna show you how to simulate those crappy Nabaztag stuff…
Here is the deal. I’m going to search information about the weather on the Internet.
Yahoo can help us. It has a great API to retrieve information about the weather.
So, let’s go !

I’ve been configured to check the weather on Paris.
So, here’s the weather report on Paris, France:

The weather is “Partly Cloudy”.
Temperature is “19″.
“”"

Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>