Showing posts with label Raspberry. Show all posts
Showing posts with label Raspberry. Show all posts

Wednesday, January 2, 2019

Configure and test audio on the Pi



  • Please follow prior steps to install Raspbian.
  • Connect the USB microphone and 3.5mm jack speaker
  • Go to the UI and 
    • Click on the Raspberry icon > Preferences> Audio Device settings 
    • Select "USB PnP Sound Device (Alsa Mixer)
    • Click "Select Controls", select Microphone and make the Microphone audio to its highest.



  • Run "sudo raspi-config" on the terminal
  • Select "Advanced Options"
  • Select "Audio"
  • Select "Force 3.5mm headphone jack"
  • Select "Finish"








Setting Mic and Audio controls:

  • Run the command "aplay -l" (its -L lowercase) in the terminal
  • Copy the card # and device # (for speaker)
  • Run the command "arecord -l" (its -L lowercase) in the terminal
  • Copy the card # and device # (for Mic)
  • Open a new file under /home/pi
  • vi .asoundrc
  • Copy paste the below

pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}
pcm.mic {
  type plug
  slave {
    pcm "hw:1,0"
  }
}
pcm.speaker {
  type plug
  slave {
    pcm "hw:0,0"
  }
}

In the above

pcm "hw:1,0" under pcm.mic is hw:<card#>,<device#>

Please use the correct one from aplay (Speaker) and arecord (Mic) as mentioned above.


Test Audio:
  • ssh to the Pi (or run the commands directly on a terminal on the pi)
  • Run the command "speaker-test -t wav"
  • You should hear voice from the speaker
  • Our speaker is configured.
Test Mic:
  • ssh to the Pi (or run the commands directly on a terminal on the pi)
  • Run the command
    arecord --format=S16_LE --duration=10 --rate=16000 --file-type=raw out2.wav
  • Say something near the microphone for 10 sec [Note duration above is in seconds]
  • To replay, run the command
  • aplay --format=S16_LE --rate=16000 out2.wav
Your Mic and speaker are now configured. 


Wednesday, December 26, 2018

SSH to the Raspberry Pi

How to ssh and access the Pi remotely?


  • On the Pi, go to the raspberry icon > Accessories > Terminal
  • Run the command "ifconfig" and get the IpAddress.

  • On your laptop terminal, run the ssh [Username: pi, Default password: raspberry]
  • ssh pi@<ipaddress> to connect
You can also connect via VNC Viewer by providing the same IP Address.

Setting up and Installing Raspberry Pi

Hi All

Lets start with the basics of setting up Raspberry Pi.

Requirements:




  • Keyboard, mouse and monitor.

Setting up SD Card for the Raspberry Pi

  • Take the SD card and put it in the MicroSD -USB ADAPTER. Connect this to your laptop.







Connecting and Starting Raspberry Pi


  • Put the SD card in the Raspberry Pi.
  • Connect the Raspberry Pi to the monitor.
  • Connect the mouse and keyboard and power on the Raspberry Pi
  • Once it boots, set up wifi on top right.
  • Go to the Raspberry icon on top left and Go to Settings > Preferences> "Raspberry Pi Configuration" and make the changes in settings as shown in the images below.
  • When you click OK, it will ask you to reboot the Pi and go ahead and reboot to Save the changes.