ptdatkhtn / appdev

application development 2019 1N3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

# this is the first version
This project is to trun a Rasparry PI as an audio device. The device is able
to do 2 functions: as a sound collector and as a test-tone generator.

Table of Content
	1. Configuration Instructions
	2. Installation Instructions
	3. Operating Instructions
	4. File list (Manifest)
	5. Copyright / Copyleft
	6. Contact Information
	7. Credits and Acknowledgements

1. Configuration Instructions

The application is running on a Raspharry PI 3 model B. This PI should come
with a USB sound card, a network connection, a microphone.

1.1 Configure USB sound card as default audio device

	1.1.1. RPi onboard sound card doesn.t have microphone interface. We have
	 to change the default audio device to be USB sound card.
	1.1.2. Boot up RPi, and apply the USB sound card. Use 'lsusb' command
	 to check if your USB sound card is mounted.
	1.1.3. Use 'sudo nano /etc/asound.conf.command'and put following 
	content to the file:
	
	pcm.!default {
		type plug
		slave {
		pcm "hw:1,0"
		}
	}
	ctl.!default {
		type hw
		card 1
	}

	1.1.4. Go to your home directory. Use 'nano .asoundrc' command and put
	 the same content to the file.
	1.1.5. 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'.

1.2 Install libcurl

	1.2.1 First use command "ls /usr/include/curl" or 
	"ls /usr/include/arm-linux-gnueabihf/curl" to identify that libcurl
	 library is installed.
	1.2.2 If the folder doesn't exist. Run 'sudo apt-get update' to update
	 the application list.
	1.2.3 Run 'sudo apt-get install libcurl3' to install the libcurl3.
	1.2.4 Run 'sudo apt-get install libcurl4-openssl-dev' to install the
	 development API of libcurl4.

2. Installation Instructions

	2.1. Open the PUTTY terminal and logging in your IP address you 
	recieved, the user is pi and enter your password.
	2.2 There are many useful commands you can execute easily if you know:
		2.2.1. 'cd..': Change to parent folder.
		2.2.2. 'mkdir': Make a new folder.
		2.2.3. 'ls -l': You can see the list files of current folder 
		in details.
		2.2.4. 'rm': Delete a file or folder.
		2.2.5. 'scp': Copy files from one host to another host.
	2.3. You can use the command line 'make' to ask the system that create
	the file create the result file.
	2.4. You will see 'sound.out' file, it means you compiled successfully.

3. Operating Instructions

	3.1. Wave of sound.
		3.1.1. You use the command line './sound.out' to run the 
		program.
		3.1.2. You will see the wave of sounds around you and the peak.
	3.2. Record the sound.
		3.2.1. You use the command line './sound.out 440' or 
		'./sound.out 1000' to run the program.
		3.2.2. You can choose the quatity of channel (1 or 2) and the
		time for your record (the unit is second).
		3.2.3. You start to record.
		3.2.4. You will receive a testTone.wav and you can hear the 
		record.
	
4. File list (Manifest)

The project contains following files:
	4.1. makefile: is used to definition the commands for program (like 
	run, clean files or make .tar file).
	4.2. README.md: contains information about the project and have the
	instruction to set up, compile and run.
	4.3. screen.h: contains library, declaration and defination of 
	constants and variables for screen.c.
	4.4. sound.h: contains library, declaration and defination of 
	constants and variables for sound.c.
	4.5. comm.h: contains library, declaration and defination of 
	constants and variables for comm.c.
	4.6. screen.c: contains functions about screen control, movement, 
	bar chart display and clear the screen function.
	4.7. sound.c: contains functions to sense sound through microphone
	and calculate for dB and find the peaks.
	4.8. comm.c: send data, calculate 1 second of sound samples into 
	8-pieces of slow decibel and use libcurl to send data to server.
	4.9. curltest.c: transfer data from or to a server.
	4.10. sound.php: save the time and IP address each time user run.
	4.11. main.c: contains main function that includes others function
	and will be executed when the project runs.
	
5. Copyright / Copyleft.

Mr.Gao Chao from Vaasa University of Apply Sciences is a person who guide 
me to do this project. We use Raspberry Pi 3. All source code are free to
use.

6. Contact Information.

Please don't hesitate to contact me in case you have any questions to ask 
me or you found any mistake in this project.
My name is PHAN Thanh Dat - student of Vaasa University of Apply Sciences.
Email: ptdat.thanhdatphan@gmail.com.

7.Credits and Acknowledgements.

I studied a lot during doing this project and Mr.Gao Chao helped so much 
and I hope you can learn a lot too.
Thank for reading.

In the lesson on 12/04/2019, I forgot to push some files(main.c, comm.h comm.c, 
sound.c) to github, so the project can not run, and that why I the commits 
are pushed in other days.
	

About

application development 2019 1N3


Languages

Language:C 92.0%Language:PHP 4.3%Language:Makefile 2.3%Language:Objective-C 1.4%