Add USB audio (playback and mic) support to Raspberry Pi

https://learn.adafruit.com/usb-audio-cards-with-a-raspberry-pi/instructions

Plug in USB audio card and boot Pi

dmesg | grep cm109
dmesg | grep Headphone
dmesg | grep C-Media
dmesg | grep General
dmesg | grep Jabra (*)

On Raspbian Stretch:

sudo nano /usr/share/alsa/alsa.conf

  1. defaults.ctl.card 0
  2. defaults.pcm.card 0

change 0 to 1

Playback

speaker-test -c2
sudo apt-get unstall mpg123
mpg123 http://ice1.somafm.com/u80s-128-mp3

List audio devices

aplay -l

To force a specific device/sub-device use the command below

speaker-test -c2 -D plughw:1,0
aplay –device=hw:1,0 test.wav

alsamixer – c 1

Recording

arecord –device=hw:1,0 –format S16_LE –rate 44100 -c1 test.wav
aplay –device=hw:1,0 test.wav

I want to buy Raspberry Pi and parts in the UK

I do not endorse nor do I receive any benefits in cash or kind for click throughs. Use at your own risk

These companies supply project kits

Prepare an SDCard with Noobs for RaspberryPi

  • fdisk -l
  • insert card
  • fdisk -l
  • identity the device e.g. /dev/mmcblk0
  • fdisk /dev/mmcblk0
    • delete partitions (d)
    • list partitions (p)
    • create a partition (n)
    • change partions type (t)
      • use Hex code for fat32 is b
    • Make bootable (a)
    • write partition table (w)
  • format the partition
    • mkfs.vfat /dev/mmcblk0p1

download Noobs
sha256sum <filename>
unzip to partition created above

A very verbose and mega helpful guide can be found here

 

Nova Modem setup on Pi and using SMS capabilities

Activate hologram sim

Connect nova modem to pi

  • lsusb – should show modem detected as U-Blox device
  • miniterm.py – should show a number of u-blox tty devices
    • U-blox allows parallel execution of tasks.
  • Install the hologram library (wrapper over u-blox)
  • hologram modem -h
  • hologram modem type
  • hologram modem operator
  • hologram modem signal

Test cellular connectivity

  • ifconfig wlan0 down
    • bring down the wireless interface to ensure data is send over cellular
  • ping google.com
    • fails
  • hologram modem connect
  • ifconfig (should show ppp0)
  • ping google.com
    • succeeds
    • be cautious of data usage as connectivity is now over ppp over cellular
  • hologram modem disconnect
  • ifconfig wlan0 up

Test SMS

  • hologram send -h
  • hologram send –sms “message” –destination destination-number(use + format) –devicekey key
  • hologram receive –sms
    • waits for incoming messages

Using the hologram library

 

Configure wireless on Raspberry Pi

Follow instructions from previous Install kali on Pi

N.B. Connecting Pi by USB only provides power

How do I find Pi on my network?

  • open a terminal
  • ifconfig (Check what network you are on e.g. 192.168.1.123)
  • nmap 192.168.1.0/24 (to scan all hosts on the network and look for a device that just has SSH running)
  • ssh root@<ip address from step above>
  • if you haven’t changes default password from previous tutorial then use (root/toor) to authenticate session
  • change root password

Setup Wi-Fi

  • Connect a compatible adaptor (e.g. Alfa)
  • ifconfig (will show wlan0 is up but not connected to any network)
  • Look for wlan0
  • iwconfig (confirm that no networks are associated)
  • cd /etc/network
  • ls
  • nano interfaces
    • will probably show at least 2 entries
      • auto lo
      • iface lo inet loopback
      • auto eth0
      • iface eth0 inet dhcp
      • Add the following
      • auto wlan0
      • allow-hotplug wlan0
      • iface wlan0 inet dhcp (then tab)
        • wpa-ssid “yourssid”
        • wpa-psk “your password”
      • save the file
  • reboot
  • ssh root@<ip address from step above> (if IP address has changed then run nmap again)
  • ifconfig (should show wireless connection)