-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
194 lines (180 loc) · 9.62 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<title>AUTO-VOICE</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<div class="header__container">
<div class="logo">
<img src="img/logo.png" alt="logo">
</div>
<h1>AUTO-VOICE: Your personal CAR-JARVIS</h1>
</div>
</header>
<main>
<section class="post">
<h2>We have:</h2>
<ul>
<li>Raspberry Pi 3 model 2</li>
<li>Arduino Uno</li>
<li>Touch screen</li>
<li>USB web-camera Logitech HD WebCam C270 whith microphone</li>
<li>Micro SD card holder 16 Gb</li>
<li>Power adapter</li>
</ul>
<p>The mobile computer can be installed and run in either automobile. It based on Raspberry Pi 3 model 2, and includes useful technologies like GSM, Internet connection and voice command block. Although the board has wi-fi, Bluetooth, HDMI screen connection. The contents of this carputer may vary by differ software.</p>
<h2>Working stages</h2>
<h3>Install the operation system to Raspberry Pi</h3>
<p>We used image <a href="https://www.raspberrypi.org/downloads/raspbian/">RASPBIAN JESSIE WITH PIXEL.</a></p>
<h3>Connect Raspberry Pi to Wi-fi access point</h3>
<code>sudo nano /etc/wpa_supplicant/wpa_supplicant.conf</code>
<p>Adding lines</p>
<pre>
network={
ssid="YourSSID"
psk="password"
key_mgmt=WPA-PSK
}
</pre>
<p>Push the buttons <b>Ctrl-X</b> on clip board and don’t forget to save the changes (press <b>Y</b>, then <b>Enter</b>).</p>
<p>For the changes in force may reload:</p>
<code>sudo reboot</code>
<p>And then watch how the connection success:</p>
<pre>
$ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 7c:dd:90:04:2f:bc
inet addr:192.168.0.14 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1866 (1.8 KiB) TX bytes:1004 (1004.0 B)
</pre>
<h3>Updating Raspberry Pi</h3>
<p>In the beginning you must ensure you use the latest program versions. This problem is solving in two steps. First you need to update available programs list, stored locally on Raspberry Pi. This step you should make before any updates. Input the command:</p>
<code>sudo apt-get update</code>
<p>Then for packages upgrading input:</p>
<code>sudo apt-get upgrade</code>
<p>and press <b>Y</b> for the question <code>Do you want to continue [Y/n]?</code></p>
<h3>The microphone checking</h3>
<p>Connect web-camera to Raspberry Pi. Check up the presence of the camera in the list of usb devices:</p>
<pre>
$ lsusb
Bus 001 Device 005: ID 046d:c52e Logitech, Inc.
Bus 001 Device 004: ID 046d:c52e Logitech, Inc. Webcam C720 //Our web-cam!
</pre>
<p>Check that the webcam microphone is decided as an audio device:</p>
<pre>
$cat /proc/asound/cards
0 [ALSA ]: BRCM bcm2835 ALSbcm2835 ALSA - bcm2835
bcm2835 ALSA
1 [Headset ]: USB-audio - Logitech USB Headset
Logitech Logitech USB Hedset at usb-bcm2708_ucb-1.2.2, full speed
</pre>
<pre>
$cat /proc/asound/modules
0 snd_bcm2835
1 snd_usb_audio
</pre>
<h3>Volume settings</h3>
<p>In the terminal enter the command:</p>
<code>alsamixer</code>
<p>Following the command, a new window will open up:</p>
<figure>
<img src="img/screen-alsamixer.jpg" alt="alsamixer settings">
</figure>
<p>Access the UI and there in you can adjust the volume (use up/down arrow keys). Press <b>F6</b> to select the microphone from the list and after Press <b>F4</b> to capture device. Control the recording volume by pressing the up/down arrow keys.</p>
<h3>Voice recording test</h3>
<p>To test the mic, we need record a sound and then play it. Enter the following command in terminal:</p>
<code>arecord -D plughw:1,0 test.wav</code>
<figure>
<img src="img/screen-arecord.jpg" alt="arecord">
</figure>
<p>Do our test record and it will be saved as <b>test.wav</b></p>
<p>To play the this file, enter in the terminal:</p>
<code>aplay test.wav</code>
<h3>Installing the Voice Recognition Software</h3>
<p>Download the software from the repository <a href="https://github.com/StevenHickson/PiAUISuite">Raspberry PI AUI Suite</a>. Also you can type in terminal:</p>
<code>git clone https://github.com/StevenHickson/PiAUISuite</code>
<p>Before starting work with Raspberry PI AUI Suite we need to instal the dependencies, type in:</p>
<code>sudo apt-get install -y libboost-dev libboost-regex-dev youtube-dl axel curl xterm libcurl4-gnutls-dev mpg123 flac sox</code>
<p>After cloning repository type in to change the directory:</p>
<code>cd PiAUISuite/Install</code>
<p>Then type:</p>
<code>sudo ./InstallAUISuite.sh</code>
<p>During installation many confirmation questions will likely pop up. Read the questions clearly and press <b>y/n</b> to select the preferred option. Wor speech to text recognition we need <b>voicecommand</b>.</p>
<p>Once the installation is complete, reboot the Pi.</p>
<p>To check whether the application is working or not open up the terminal and type:</p>
<code>sudo voicecommand</code>
<p>After entering the command say <b>hello</b> to your microphone. If its working fine, text <b>hello</b> will be printed on the terminal.</p>
<h3>Editing the configuration file</h3>
<p>The voice command input is converted to text using <b>google voice API</b>. By configuring the application files accordingly, we can enable the Pi to act upon our voice command. In this example, we control an LED connected to Pi. It can be switched on or off as per the users voice command. For which we would need two programs, one to switch on and the other to switch off. Click here to get the details on how to blink an LED using python script. Save the programs as <a href="script/test12.py">test12.py</a> and <a href="script/test13.py">test13.py</a>.</p>
<p>This files are presented in <a href="https://github.com/FabLab61/car_PC">repository</a>.</p>
<p>When we say <b>LED ON</b>, the <b>test12.py</b> program should run and the LED glows. And when we say <b>LED OFF</b>, the <b>test13.py</b> should run to switch off the LED. To do this edit the configuration file as follows. Type in:</p>
<code>sudo voicecommand -e</code>
<p>A new screen will open as shown in figure:</p>
<figure>
<img src="img/screen-configuration.jpg" alt="configuration">
</figure>
<p>Press the enter key to continue and the new configuration editor file will open up. Enter the commands in the editor as shown in the figure below:</p>
<figure>
<img src="img/screen-scripts.jpg" alt="scripts">
</figure>
<p><b>LED ON</b> will be the voice command, when we speech out the same on microphone the software will compare it with the words in the config file. If any word is matched, the corresponding action will processed. In our case, it will go to the pi directory and execute the python code <b>test12.py</b>.</p>
<figure>
<img src="img/screen-voicecomand.jpg" alt="voicecomand">
</figure>
<h3>Communication between Raspberry Pi and Arduino</h3>
<p>Connect Arduino USB Plug to Raspberry PI with USB cable and check the connection between Arduino and Raspberry pi by type in Raspberry Pi terminal:</p>
<code>ls /dev/tty*</code>
<p>The result should be content <code>/dev/ttyACM0</code>.</p>
<h3>Arduino programming</h3>
<p>Upload <b><a href="scetch/led_through_serial_rus.ino">led_through_serial_rus.ino</a></b> code to Arduino. This file is presented in <a href="https://github.com/FabLab61/car_PC">repository</a>.</p>
<pre>
int led = 13;
void setup() {
{
pinMode(led, OUTPUT);
Serial.begin(9600);
Serial.flush();
}
}
void loop() {
{
String input = "";
while (Serial.available())
{
input += (char) Serial.read();
delay(5);
}
if (input == "on") {
Serial.println("on executed");
digitalWrite(led, HIGH);
} else if (input == "off"){
Serial.println("off executed");
digitalWrite(led, LOW);
}
}
}
</pre>
<h2>Well done!</h2>
<p>After saying the voice command <b>LED ON</b> on microphone the software on Raspberry Pi will compare it with the words in the config file and run script. Script send comands to Arduino and led on!</p>
<h3>This way you can send any commands by adding scripts оn Raspberry Pi!</h3>
</section>
<section class="logotipes">
<div class="logotipes__container">
<img src="img/logo-pi.png" alt="pi">
<img src="img/logo-arduino.png" alt="">
<img src="img/logo-fablab.png" alt="">
</div>
</section>
</main>
<footer>
<div class="footer__container">
<p class="copyright">by <a href="https://github.com/laplandin" target="_blank">Laplandin</a> & <a href="https://github.com/aleks-y" target="_blank">Aleks-y</a></div></p>
</div>
</footer>
</body>