Default card for Alsasound on the Pi (Rasbian)

Sound levels adjust with alsamixer.

From answer here, changing the default card:

  • Find your attached card with :
    cat /proc/asound/cards
  • Add or update /etc/asound.conf with:
    pcm.!default {
        type hw
        card 1
    ctl.!default {
        type hw           
        card 1

Change card number to match.

Reading from the Adafruit GPS sensor on the Pi

Per instructions in the Oracle Embedded Java MOOC this week, here’s the steps to get gpsd setup to read from the sensor if it’s attached via a USB TTL cable:

sudo apt-get install gpsd gpsd-clients python-gps

ls /dev/ttyUSB* – to check what USB port we’re connected to

sudo gpsd /dev/ttyUSBx -F /var/run/gpsd.sock to start the daemon, replace x with the port number from step above

cgps -s – to run the client


If the GPS is attached via GPIO pins, then, similarly to above:

ls /dev/ttyAMA* – to check what AMA port we’re connected to

sudo gpsd /dev/ttyAMAx -F /var/run/gpsd.sock to start the daemon

Check check you’re reading data from the connected port, you can do:

cat /dev/ttyAMA0 – and you should see the raw messages being read from the card.

To interpret data coming from the card, read a line until you get a line prefixed with $, and then the next 5 chars represent the message type:

$GPGGA = gps position data

$GPVTG = velocity data