Skip to content

phuclevinh2000/appdev1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE:	I lost my SD card so I had to do everything again, so my commit was in the same day: 16/4/2019
# This is applocation development ver1.1 -------- by Phuc Le

This application offer a possibility to turn a Rasberry Pi as a sound device. The application comees with 2 functions: a sound collector and a test tone generator

List of content
	1. Configuration Instructions
	2. Instalation Instructions
	3. Operating Instructions
	4. List of Files
	5. Copyright / Copyleft
	6. Contact Information: [email protected], e1800951
	7: Credits and Acknowledgements

1. Configuration Instructions

	The application is running on a Raspberry Pi. This Pi should come with a USB sound card, a network connection, a headphone and a microphone

1.1 Input the USB sound card
	We need to install the USB sound card as default because we need that to collect sound and Pi does not have microphone interfaces.

1.2 Install libcurl library
	This app runs based on some libcurl functions so we need to install the libcurl library first.


2. Instalation Instructions

Here are the instructions of installation for this app.

2.1 Prepare the SD card with NOOB downloading from the Internet
	1.	This is the link for NOOB: : https://www.raspberrypi.org/downloads/noobs/
	2.	Please download the ZIP file. The file is over 1Gb and might take a quite to download.
	3.	Open two “Windows Explorer” windows. Window 1 goes to your “download” folder and open the ZIP file “NOOBS_v3_0_0.zip”
	4.	The 2nd Explorer window is located to your SD-card. Usually it is D:, E: or F: drive, depending on your system partition.
	5.	Copy everything from Explorer Window 1 to Window 2. This may take a few minutes.
	6.	Once copy is complete, verify that two Explorer windows have the same content.

2.2 Default Booting and Keyboard Layout
	1.	By default Raspberry Pi boots into X-server (graphic) mode. This increases booting time, but in most cases we don’t use a display with RPi, so the first thing is to disable it. To do so, you need to connect RPi to a display via HDMI-DIV cable. 
	2.	You also need a USB keyboard for this step. Connect it to your RPi.
	3.	Once booted, open a “terminal” window (Ctrl+ESC, and choose from the “Accessories”). 
	4.	Run “sudo raspi-config” command.
	5.	Select from “boot options”: “Text console, auto-login”.
	6.	The newer version of Raspbian disables SSH by default, therefore you have to enable it. Navigate to “Interfacing Options” and select “SSH”, Choose “Yes”, Select “Ok”
	7.	You can also change the keyboard to be “Generic 105 key/Finnish” in “4. Internationalization Options”.
	8.	Reboot “sudo reboot”

2.3 Send Ip Address by Email
	1.	When using Raspberry Pi remotely, you need to know its IP address to connect to it. There are many ways to get the IP address from your Pi. The simplest way to edit “rc.local” file.
	2.	First you need to get a digital signature of your student ID. Please run following command: pi@raspberrypi:~ $ curl --url "http://www.cc.puv.fi/~gc/php/sha_stuID.php" -d "id=e1700346"
	3.	Copy the SHA string to clipboard (in Putty window, ctrl+"Insert" to copy, shift+"Insert" to paste) and run command “sudo nano /etc/rc.local” and add following lines (yellow colored):
	#Write this code
	sleep 30

	curl --url http://www.cc.puv.fi/~gc/php/sendMailRPi.php -d “[email protected]&from=e1700346&hash=YOURHASH”
	curl --url http://www.cc.puv.fi/~gc/php/rasp.php -d "ip=$_IP&name=e1700346"
	curl --url http://www.cc.puv.fi/~juma/raspi/rasp_ip.php -d "auth=mckdoe03&name=e1700346&ip=$_IP"

	4.	The line “sleep 30” is to guarantee that IP address is available.
	5.	The 1st "curl" command sends IP address to your mail box (please change "email" to your email) using a PHP program. The program will verify your ID and signature so please make sure they are correct.
	6.	The 2nd "curl" command sends IP address to GC’s PHP page and you can see your device name/IP on http://www.cc.puv.fi/~gc/php/rasp.php. 
	7.	The 3rd “curl” command sends IP address to Jukka Matila’s PHP page and you can see your device in his page: http://www.cc.puv.fi/~juma/raspi/. 

2.4 Set USB Sound Card as Default
	1.	RPi onboard sound card doesn’t have microphone interface. We have to change the default audio device to be USB sound card. 
	2.	Boot up RPi, and apply the USB sound card. Use “lsusb” command to check if your USB sound card is mounted:
	3.	Use “sudo nano /etc/asound.conf”command and put following content to the file:
	#use this code
	
	pcm.!default {
		type plug
		slave {
			pcm "hw:1,0"
		}
	}
	ctl.!default {
		type hw
		card 1
	}
	6. Go to home directory. Use "nano .asoundrc" command and put the same content to the file.
	7. Run "alsamixer" you should be able to see that USB sound card is the default audio device.
	For a more sensitive sound detection, it is better to maximize the volume of "Mic".

2.5 Fix the Bug of arecord
	1.	The newest version of Raspbian (a.k.a. Jessie) comes with a new version of alsa-utils (1.0.28), which has a bug while recording: it doesn’t stop even a '—duration' switch is given, and generates lots of useless audio files. To fix this problem, we have to downgrade alsa-util to an earlier version (1.0.25).
	2.	Use “sudo nano /etc/apt/sources.list” command and add the last line:
	
	//use this code
	deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
	# Uncomment line below then 'apt-get update' to enable 'apt-get source'
	#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
	deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi

	3.	Run “sudo apt-get update”
	4.	Run “sudo aptitude versions alsa-utils” to check if version 1.0.25 of alsa-util is available:
	5.	Run “sudo apt-get install alsa-utils=1.0.25-4” to downgrade.
	6.	Reboot (if necessary)
	7.	Run “arecord -r44100 -c1 -f S16_LE -d5 test.wav” to test that your microphone is working. You should see a “test.wav” file in the current folder.
	8.	Put earphone on the USB sound card. Run “aplay test.wav” to check that your recording is okay.

2.6 Install libcurl library
	1.	First use command "ls/usr/include/curl" or "ls/usr/include/arm-linux-gnueabihf/curl" to
	identify that libcurl library is installed
	2.	If the folder doesn't exist. Run "sudo apt-get update" to up-date the application list.
	3.	Run "sudo apt-get install libcurl3" to install the libcurl 3.
	4.	Run "sudo apt-get install libcurl4-openssl-dev" to install the development API of libcurl 4.

2.5 Adding files to your Github
	First setup
	1.	Create a respository on Github with "your respository name".
	2.	Go to your directory that you want to remote to Github on Linux.
	3.	Use command "echo "# your respository name" >> README.md".
	4.	Use command "git init".
	5.	git add README.md
	6.	git commit -m "first commit"
	7.	git remote add origin https://github.com/your username/your respository name.git
	8.	git push -u origin master

	Add file to your github
	1.	git status
	2.	git add (now you enter the file that you want to add, Example: README)
	3.	git commit -m "Add commit in here"
	4.	git push -u origin master

3. Operating Instructions
	3.1 Run a program to collect your sound and show it as a bar chart
		1.	Open your files
		2.	Insert your USB soundcard as well as your Microphone and Headphone
		(Then add those code)
		3.	Make
		4.	./sound.out
		5. Now you will see a bar chart, now make sound to see the different and the change of the bar chart

	3.2 Run a program that Test tone generation
		1. Open your files
		2. (add those code to run the program)
		3.	make
		4.	./sound.out arg
		
4. List of Files
	- screen.c
	- makefile
	- screen.h
	- main.c
	- sound.c
	- sound.h
	- sound.php
	- makefile
	- comm.h
	- comm.c
	- testcurl.c

5.  Copyright: This app is written by @LeVinhPhuc, and instruced by Gao Chao from VAMK
	Copyleft: Wiki, cplusplus.com,...

6. Contact information:
	Name: Phuc Le Vinh 
	Mail: [email protected]
	Student number: e1800951
	Phone number: 0465407847

7: Credits and Acknowledgements
	This application is written by Phuc Le, with the help of Gao Chao from VAMK and some of my friends
	Language that we use in this app: PHP, C	

About

App development course's project

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published