You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Library/Others.md
+30-18Lines changed: 30 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ These examples illustrate more complex, yet fundamental, applications of multipl
17
17
18
18
## Basic Ultrasound Examples
19
19
20
-
These examples demonstrate how to transmit a 32kHz ultrasonic wave at a constant sampling rate. The reflected wave is then captured and sent to a PC via Serial communication. Using MATLAB, you can visualize and potentially process the wave. By placing an object on top of the SensEdu, you can observe wave reflections.
20
+
These examples demonstrate how to transmit a 32kHz ultrasonic wave at a constant sampling rate. The reflected wave is then captured and sent to a PC via Serial or WiFi communication. Using MATLAB, you can visualize and potentially process the wave. By placing an object on top of the SensEdu, you can observe wave reflections.
21
21
22
22
{: .IMPORTANT}
23
23
To run these examples, you need to install [MATLAB].
@@ -163,7 +163,7 @@ DATA_LENGTH = 16*128; % ensure this value matches `mic_data_size` in firmware
**Step 11**{: .text-blue-000} : Write a function in MATLAB to receive data from Arduino. The function should handle 16-bit samples sent in bytes, so each sample consisting of 2 bytes. In the firmware, data is sent in 32-byte chunks, and the MATLAB function should match this to avoid synchronization issues.
166
+
**Step 11**{: .text-blue-000} : Write a function in MATLAB to receive the data from Arduino. The function should handle 16-bit samples sent in bytes, so each sample consisting of 2 bytes. In the firmware, data is sent in 32-byte chunks, and the MATLAB function should match this to avoid synchronization issues.
167
167
168
168
```matlab
169
169
function data = read_data(arduino, data_length)
@@ -305,9 +305,9 @@ Second figure shows measurements with a flat object placed near the board. Here,
305
305
306
306
### Basic_UltraSound_WiFi
307
307
308
-
Utilizes WiFi for data transmission.
308
+
Utilizes only one microphone. The example is similar to [Basic_UltraSound]({% link Library/Others.md %}#basic_ultrasound), but uses WiFi as communication medium instead of Serial.
309
309
310
-
**Step 1**{: .text-blue-000} : Include the SensEdu and WiFi libraries.
310
+
**Step 1**{: .text-blue-000} : Include SensEdu and WiFi libraries.
**Step 6**{: .text-blue-000} : Initialize DAC and ADC with created structs. Enable Serial for communication with PC (for retrieving the boards IP later). Attempt connection with the previosuly defined WiFi network.
387
+
**Step 6**{: .text-blue-000} : Initialize DAC and ADC with created structs. Enable Serial for communication with PC (for retrieving the boards IP later). Attempt connection with the previously defined WiFi network.
387
388
388
389
```c
389
390
voidsetup() {
@@ -395,19 +396,19 @@ void setup() {
395
396
396
397
// attempt connection to WiFi network
397
398
while (status != WL_CONNECTED) {
398
-
Serial.println(ssid);
399
-
// connect to WPA/WPA2 network (change this if youre using open / WEP network)
400
-
status = WiFi.begin(ssid, pass);
399
+
Serial.println(ssid);
400
+
// connect to WPA/WPA2 network (change this if youre using open / WEP network)
401
+
status = WiFi.begin(ssid, pass);
401
402
402
-
// wait 10 seconds for connection
403
-
delay(10000);
403
+
// wait 10 seconds for connection
404
+
delay(10000);
404
405
}
405
406
server.begin();
406
407
}
407
408
```
408
409
409
-
**Step 6**{: .text-blue-000} : Create a buffer that waits for a command (e.g., symbol "t") from MATLAB.
410
-
Print your boards IP-address to serial so you can note it down later.
410
+
**Step 6**{: .text-blue-000} : Create a buffer that waits for a trigger command (symbol "t") from MATLAB.
411
+
Print the board's IP-address in a serial monitor, as it will be needed later.
**Step 10**{: .text-blue-000} : Open `matlab\Basic_UltraSound_WiFi_ReadData.m`. Specify the required parameters and start the connection with your Arduino.
470
+
**Step 10**{: .text-blue-000} : Open `matlab\Basic_UltraSound_WiFi_ReadData.m`. Specify the required parameters and start the connection with Arduino.
469
471
470
472
```matlab
471
473
%% Settings
@@ -478,7 +480,7 @@ DATA_LENGTH = 16*128; % ensure this value matches `mic_data_size` in firmware
**Step 11**{: .text-blue-000} : Write a function in MATLAB to receive data from the Arduino. The function should handle 16-bit samples sent in bytes, so each sample consisting of 2 bytes. In the firmware, data is sent in 32-byte chunks, and the MATLAB function should match this to avoid synchronization issues.
483
+
**Step 11**{: .text-blue-000} : Write a function in MATLAB to receive the data from Arduino. The function should handle 16-bit samples sent in bytes, so each sample consisting of 2 bytes. In the firmware, data is sent in 32-byte chunks, and the MATLAB function should match this to avoid synchronization issues.
482
484
483
485
```matlab
484
486
function data = read_data(arduino_server, data_length)
@@ -506,6 +508,16 @@ for it = 1:ITERATIONS
506
508
end
507
509
```
508
510
511
+
**Step 13**{: .text-blue-000} : Connect your PC to the same WiFi network and run the script.
**Results**{: .text-blue-000} : Below is a figure showing the measurement results.
516
+
517
+
Notice that with WiFi, your Serial is freed up, allowing to use it for convenient debugging purposes on Arduino or to send data in parallel to the WiFi connection.
0 commit comments