Wolfson + Jasper

.

How to install Jasper and get it running with the Wolfson Audio Card

A.  Grab the Jasper Image

The quickest way to get up and running with Jasper is to download the pre-compiled disk image available here. Write the image to the SD Card. I would recommend an 8GB+ Class 10 card.

Boot up the Pi and run the following. Select to ‘Expand Filesystem’, Internationalization options and anything else you may want. Then restart your Pi:

sudo raspi-config

B.  Install Wolfson Kernel Patch

  • Download the patch software

Please download the drivers software from the element14 Wolfson community pages (www.element14.com/wolfson) and copy this into the home directory of the ‘pi’ user (/home/pi).

wget http://www.element14.com/community/servlet/JiveServlet/download/104303-128960/wolfson_drivers.tar.gz

  • Extract the patch software into the home directory

tar -zxvf wolfson_drivers.tar.gz

This will create the following file structure within the home directory:

 

  • Update the OS and install any pre-requisites for compiling
sudo apt-get update 
sudo apt-get upgrade -y 
sudo apt-get install bc
  • Download the 3.10 kernel software from Github
mkdir kernel_source cd kernel_source git init git
fetch git://github.com/raspberrypi/linux.git rpi-3.10.y:refs/remotes/origin/rpi-3.10.y git checkout rpi-3.10.y
  • Patch the kernel
git reset --hard c43739885d512c92c0aa443b5895b96df5141da0
git config --global user.email "your email address in here"
git config --global user.name "your name in here"
git am -3 /home/pi/rpi_wlf_3.10_beta/*
  •  Compile the kernel

cp arch/arm/configs/rpi_wolfson_sound_pi_defconfig .config

make(This will take several hours to complete)

sudo make modules_install

  • Replacing the kernel
sudo mv /boot/kernel.img /boot/kernel.img.backup sudo cp arch/arm/boot/Image/kernel.img
sudo cp arch/arm/boot/Image /boot/kernel.img
sudo reboot

  

A.  Configuring the Jasper Client

  •  Install Jasper Client

In the home directory of your Pi, clone the Jasper source code:

git clone https://github.com/jasperproject/jasper-client.git jasper

 

  • Jasper requires various Python libraries that we can install in one line with:

 sudo pip install –upgrade setuptools

sudo pip install -r jasper/client/requirements.txt

  • Run crontab -e, then add the following line, if it’s not there already:

@reboot /home/pi/jasper/boot/boot.sh;

 

  • Set permissions inside the home directory:

 sudo chmod 777 -R *

sudo reboot

  • Restart your Raspberry Pi. Doing so will run boot.py, which generates the languagemodel.lm file in the client/ folder.

 

 Using Ragnar Jensen’s .asoundrc file is the key to getting it to work 

Backup the existing file

cp ~/.asoundrc .asound.backup

rm ~/.asoundrc

sudo nano ~/.asoundrc

Paste the contents listed in the file at the end of this post. Save and exit.

  • Generating a user profile

In order for Jasper to accurately report local weather conditions, send you text messages, and more, you first need to generate a user profile.

 

To facilitate the process, run the profile population module that comes packaged with Jasper

 cd ~/jasper/client

python populate.py

 

  •  ERROR: “ngram_search.c”, line 208: Failed to read language model file: /usr/local/share/pocketsphinx/model/lm/languagemodel.m

Segmentation fault

 dictionary.dic file is still not present in your client/ directory, just run:

~/jasper/boot/boot.py

  •  You will need an additional 5v 2A powersupply connected to the Wolfson Audio Card along with the SPKOUT pins connected to a passive 8ohm speakers. See the video here and fast forward to 39 minutes 50 seconds:

To execute Jasper and see what is going on ssh into the Pi and run

python main.py

Ragnar Jensen’s ./asoundrc file can be found on many posts @element14 here’s a link to it: 

http://www.element14.com/community/message/107289/l/re-pjsippjsua-with-wolfson-audio-card#107289

#######################################################################
#
# Use libsamplerate instead of internal resampler.
# You might have to: sudo apt-get install libasound2-plugins
# Or just comment out the next line if the internal one is good enough for your needs.
# defaults.pcm.rate_converter "samplerate"

######################################################################
#
# Wolfson Audio Card for Raspberry Pi
#
pcm.wolfson_pi_soundcard {
    type hw
    card sndrpiwsp
    device 0
}
# Create a Master volume control
pcm.softvol {
    type            softvol
    slave {
        pcm         "pduplex"
    }
    control {
        name        "Master"
        card        0
    }
}

pcm.!default  {
    type           asym
    playback.pcm   "plug:softvol"
    capture.pcm    "pduplex"
}

#####################################################################
#
# Mixing and resampling goodness :-
#
# Several clients can record and play back simultaneously.
# The dmix and dsnoop plugins operate at 48kHz by default, i.e. the sound card will be kept at 48kHz at all times.
# All playback streams are converted to 2 channels/48kHz/16bit.
# All recording streams are converted from the card's 2 channels/48kHz/16bit
# to the requested number of channels, sample rate and bit depth.

# We define one pcm device called "playmixer" for playback.
pcm.playmixer {
        ipc_key 140324  # Any number will do, as long as it's unique in the system.
        ipc_key_add_uid true
        type dmix
        slave.pcm "wolfson_pi_soundcard"
}

# Define another one called "recmixer" for capture.
# The sound card will run at 48kHz and input is resampled to the requested rate.
pcm.recmixer {
        ipc_key 140325
        ipc_key_add_uid true
        type dsnoop
        slave.pcm "wolfson_pi_soundcard"
}

# Define a duplex device, with both in- and outputs.
pcm.duplex {
        type asym
        playback.pcm "playmixer"
        capture.pcm "recmixer"
}

# Add a "plug" plugin for the above "duplex" device.
# This is where all the converting takes place.
# Sample rate, number of channels, bit depth.
# By the way, who thought that "plug" was a good name for a plugin?
#
# Use this device for all your playback and recording resampling needs.
pcm.pduplex {
        type plug
        slave.pcm "duplex"
}

# A ctl device to keep xmms happy
ctl.pduplex {
        type hw
        card 0
}

# A DSP to keep the alsa-oss layer happy:
pcm.dsp0 {
        type plug
        slave.pcm "duplex"
}

ctl.mixer0 {
        type hw
        card 0
}

Posted in Blog, Tutorials | Leave a comment

Product Reviews (On Order)

I ordered these products from Newark / Element14.

PIFACE – PIFACE CONTROL & DISPLAY – RPI, I/O BOARD WITH LCD DISPLAY

PIFACE - PIFACE CONTROL & DISPLAY - RPI, I/O BOARD WITH LCD DISPLAY

RASPBERRY-PI – RPI NOIR CAMERA BOARD – RASPBERRY PI NOIR CAMERA BOARD

RASPBERRY-PI - RPI NOIR CAMERA BOARD - RASPBERRY PI NOIR CAMERA BOARD

I have found the best solution to combine both products a sentry to watch the home while I’m away:

Pi-Based Parking Monitor with Pi NoIR and PiFace CAD

Posted in Blog | Leave a comment

Raspberry Pi and EnOcean Internet of Things Pack – Review @element14

See My Review of The Raspberry Pi and EnOcean Internet of Things Pack @element14

The Road Test kit contained:

 EnOcean Pi – A Wireless Transceiver Module

element14 presents the EnOcean Pi board to quickly transform yourRaspberry Pi

into a gateway. EnOcean Pi connects energy harvesting wireless devices with Raspberry Pi to help automate networks and automation systems at home or in the workplace. It also comes with free software included so you can get your home automation set up quickly and easily.

  • Bi-directional radio and serial interface
  • Smart Ack controller functionality
  • Transparent radio channel
  • Programmable repeater functionality (1/2 Level)
  • ESP3 support (EnOcean Serial Protocol V3)

EnOcean Sensor Kit

Self-powered sensor kit ideal for enthusiasts and designers getting started with home automation. The EnOcean Sensor Kit features a set of three wireless sensors: Push Button, Reed Switch, & Temperature Sensor

.

  • Frequency: 902MHz & 315MHz
  • Wireless Sensor module with built-in antenna
  • No cables required, self-powered, maintenance free
  • Ideal Energy Harvesting Solution
  • Miniature battery-less push switch module
  • Sensors with Solar cell

Find the supporting page @ EnOcean Module and Accessories


The kit also contained a Raspberry Pi

Install the OS onto an SD Card

I grabbed the latest Raspbian (Debian Wheezy) image from Downloads | Raspberry Pi

Expanded rootfs, set locale, country localizations (In my case US), and Restarted

Then I added the additional script to disable rpi-serial so the Gateway could communicate with the Pi.

sudo wget https://raw.github.com/lurch/rpi-serial-console/master/rpi-serial-console -O /usr/bin/rpi-serial-console && sudo chmod +x /usr/bin/rpi-serial-console

And disabled the console

sudo rpi-serial-console disable


Installing FHEM dependencies:

FHEM runs as a server on a Perl interpreter, which needs to be installed.

sudo apt-get install perl libdevice-serialport-perl libio-socket-ssl-perl libwww-perl


Installing FHEM

Using the current version of FHEM 5.5 (Future FHEM updates will need to modify the installation commands below as required)

wget http://fhem.de/fhem-5.5.deb

sudo dpkg –i fhem-5.5.deb

FHEM is installed within the folder /opt/fhem. And starts automatically on boot up.

Display of the FHEM Web Interface

Start your browser and type the following to the address bar:

http://<Raspberry_Pi_IP>:8083/fhem

You will get the following user interface on the screen:

FHEM_1.png

Figure 5: The FHEM Web Interface

I found that FHEM would only recognize the EnOcean-Pi Gateway only after manually entering the Gateway into fhem.cfg and once a module had started it’s learn sequence. Once done it will begin to receive radio telegrams from EnOcean devices. Additionally it generates by default device entities for each new received EnOcean ID.

To add the Gateway to fhem.cfg

Start the configuration file editor via the FHEM menu item “Edit files” in the left navigation window. For the EnOcean Pi add the following line at the end of fhem.cfg and save the file the server will update immediately.

define TCM310_0 TCM 310 /dev/ttyAMA0@57600

Setting up the EnOcean Temp Sensor:

STM33x.png

Press the Learn Button on the Temp Sensor this will update the FHEM Server and populate an EnOcean navigation Link

Fhem Nav.png

This was the only part that gave me trouble. FHEM tries to identify the devices once the Learn Process initiates however mine set the Temp Sensor as just a plain sensor. I found the following on FHEM’s site. FHEM reference

Temperature Sensors with with different ranges (EEP A5-02-01 … A5-02-30)
[EnOcean STM 330, Eltako FTF55, Thermokon SR65 ...]

  • t/°C
  • temperature: t/°C (Sensor Range: t = <t min> °C … <t max> °C)
  • state: t/°C

The attr subType must be tempSensor.01 … tempSensor.30. This is done if the device was created by autocreate.

I assumed you would just adjust the subType to tempSensor.01 but this returned abnormal negative temperatures.

I referenced the EnOcean Equipment Profiles EEP 2.6 (PDF) I realized under 3. A5: that there are 30 EEP’s (Enocean Equipment Profiles) for their Temperature Sensors and 30 ranges under FHEM’s reference.

Going back to the EnOcean Temperature Sensor Data Sheet the configurable EEPs listed are A5-02-05, A5-10-05, A5-10-03 so the subType should be set to tempSensor.05

STM330_Attrib_suType.png

The subType sensor can be deleted by clicking deleteattr.

Set the correct attr subType tempSensor.05 and click the attr button.



Setup the Contact and Switch:


The Contact Sensor and Switch were very straight forward at this point click the learn button on the Contact Sensor set the Open or Closed attribute. Then click the Switch and everything from here went smoothly.

Conclusion:

Overall I am very pleased with the kit so far. I deducted points for FHEM’s ability to auto configure the Temp Sensor and Gateway and because the support documentation was not very easy to piece together. All in all it took about 3 to 4 hours to get to this point including the fresh install of Raspbian on the Pi and it’s setup.

Posted in Blog | Leave a comment

Tweets by @Raspians


Posted in Blog | Leave a comment

I must have one. The miniature of RAPIRO which was made with Makerbot Replicator…

I must have one. The miniature of RAPIRO which was made with Makerbot Replicator 2. — at はんだづけカフェ


Timeline Photos

Posted in Blog, Tutorials | Comments Off

Do you have a RPi and a RPi case? Why not get a RPi Tee? Grab this special edition!

Do you have a RPi and a RPi case? Why not get a RPi Tee? Grab this special edition!


Limited Tees For The Pi
www.teespring.com
Quantities are limited and will only be available for a few days, so reserve yours today. (money-back guarantee if you are not satisfied for any reason)

Posted in Blog, Tutorials | Comments Off

badBrick – Case for Raspberry Pi. by darkskynet – Thingiverse

badBrick – Case for Raspberry Pi. by darkskynet – Thingiverse


badBrick – Case for Raspberry Pi. by darkskynet – Thingiverse
www.thingiverse.com
Thingiverse is a universe of things. Download our files and build them with your lasercutter, 3D printer, or CNC.

Posted in Blog, Tutorials | Comments Off

Morse code translator !

Morse code translator !


Programmer, 13, creates Morse code translator for science fair – Monroe Monitor
www.monroemonitor.com
Kyle Seaman, 13, of Monroe, demonstrates his “Raspberry Pi” computer controller system at the Sky Valley Education Science and Art Fair Thursday. The tiny, modular computer, at left behind the red wires, is about the size of a paperback book. It is built from components and programmed in the Python…

Posted in Blog, Tutorials | Comments Off

KS Isaac is 13, and has always demonstrated creativity with what he has. He's ke…

KS Isaac is 13, and has always demonstrated creativity with what he has. He's keenly interested in moving to quadcopters + Raspberry PI
https://www.kickstarter.com/projects/1966705864/help-13-yo-isaac-marry-raspberry-pi-to-quadcopter?ref=live


Help (13 yo) Isaac marry Raspberry PI to Quadcopter
www.kickstarter.com
Isaac is 13, and has always demonstrated creativity with what he has. He's keenly interested in moving to quadcopters + Raspberry PI

Posted in Blog, Tutorials | Comments Off

Raspberry Pi Project: Display Tweets on a Character LCD http://ow.ly/w56aE

Raspberry Pi Project: Display Tweets on a Character LCD http://ow.ly/w56aE


Blog Post: Display tweets on a character LCD, in Raspberry Pi |…
www.element14.com
Read about 'Display tweets on a character LCD' on element14.com. Want to build this project? View Parts I followed Adafruit's great Drive a 16×2 LCD

Posted in Blog, Tutorials | Comments Off