Skip to content

Commit f8a4896

Browse files
committed
update content
1 parent 428005e commit f8a4896

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed
Loading
Loading

content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-camera/giga-camera.md

+38-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: GIGA R1 Camera Guide
3-
description: Learn about the GIGA R1 WiFi's camera connector, and how to use existing examples.
3+
description: Learn about the GIGA R1 WiFi's camera connector, and how to stream data through webserial.
44
tags: [ArduCAM, Camera, WebSerial]
55
author: Karl Söderby
66
hardware:
@@ -27,7 +27,7 @@ To follow and use the examples provided in this guide, you will need an [Arduino
2727
You will also need the following software:
2828

2929
- [Arduino IDE](https://www.arduino.cc/en/software) (any version).
30-
- [Webserial](https://github.com/arduino/ArduinoCore-mbed/tree/main/libraries/Camera/extras/WebSerialCamera) (for displaying camera feed).
30+
- [Webserial](https://labs.oniudra.cc/en/labs/web-serial-camera) (for displaying camera feed).
3131

3232
To run the Webserial locally go to:
3333

@@ -44,7 +44,6 @@ The GIGA R1 currently supports the following cameras, via the [Camera](https://g
4444
- **OV7670** and **OV7675**
4545
- **GC2145**
4646
- **Himax HM01B0**
47-
- **Himax HM0360**
4847

4948
## Camera Connector
5049

@@ -87,9 +86,25 @@ This example allows you to stream the sensor data from your camera to a web inte
8786

8887
Upload the following sketch to your board.
8988

90-
This sketch is also available in the Arduino IDE via **Examples > Camera > CameraCaptureRawBytes**.
89+
This sketch is also available in the Arduino IDE via **Examples > Camera > CameraCaptureWebSerial**.
9190

9291
```arduino
92+
/*
93+
* This example shows how to capture images from the camera and send them over Web Serial.
94+
*
95+
* There is a companion web app that receives the images and displays them in a canvas.
96+
* It can be found in the "extras" folder of this library.
97+
* The on-board LED lights up while the image is being sent over serial.
98+
*
99+
* Instructions:
100+
* 1. Make sure the correct camera is selected in the #include section below by uncommenting the correct line.
101+
* 2. Upload this sketch to your camera-equipped board.
102+
* 3. Open the web app in a browser (Chrome or Edge) by opening the index.html file
103+
* in the "WebSerialCamera" folder which is located in the "extras" folder.
104+
*
105+
* Initial author: Sebastian Romero @sebromero
106+
*/
107+
93108
#include "camera.h"
94109
95110
#ifdef ARDUINO_NICLA_VISION
@@ -142,7 +157,7 @@ FrameBuffer fb;
142157
* @param ledPin The pin number of the LED.
143158
* @param count The number of times to blink the LED. Default is 0xFFFFFFFF.
144159
*/
145-
void blinkLED(int ledPin, uint32_t count = 0xFFFFFFFF) {
160+
void blinkLED(int ledPin, uint32_t count = 0xFFFFFFFF) {
146161
while (count--) {
147162
digitalWrite(ledPin, LOW); // turn the LED on (HIGH is the voltage level)
148163
delay(50); // wait for a second
@@ -152,7 +167,7 @@ void blinkLED(int ledPin, uint32_t count = 0xFFFFFFFF) {
152167
}
153168
154169
void setup() {
155-
pinMode(LED_BUILTIN, OUTPUT);
170+
pinMode(LED_BUILTIN, OUTPUT);
156171
pinMode(LEDR, OUTPUT);
157172
digitalWrite(LED_BUILTIN, HIGH);
158173
digitalWrite(LEDR, HIGH);
@@ -167,7 +182,7 @@ void setup() {
167182
168183
/**
169184
* Sends a chunk of data over a serial connection.
170-
*
185+
*
171186
* @param buffer The buffer containing the data to be sent.
172187
* @param bufferSize The size of the buffer.
173188
*/
@@ -182,21 +197,21 @@ void sendChunk(uint8_t* buffer, size_t bufferSize){
182197
*/
183198
void sendFrame(){
184199
// Grab frame and write to serial
185-
if (cam.grabFrame(fb, 3000) == 0) {
200+
if (cam.grabFrame(fb, 3000) == 0) {
186201
byte* buffer = fb.getBuffer();
187202
size_t bufferSize = cam.frameSize();
188203
digitalWrite(LED_BUILTIN, LOW);
189-
204+
190205
sendChunk(START_SEQUENCE, sizeof(START_SEQUENCE));
191206
192207
// Split buffer into chunks
193208
for(size_t i = 0; i < bufferSize; i += CHUNK_SIZE) {
194209
size_t chunkSize = min(bufferSize - i, CHUNK_SIZE);
195210
sendChunk(buffer + i, chunkSize);
196-
}
197-
211+
}
212+
198213
sendChunk(STOP_SEQUENCE, sizeof(STOP_SEQUENCE));
199-
214+
200215
digitalWrite(LED_BUILTIN, HIGH);
201216
} else {
202217
blinkLED(20);
@@ -215,9 +230,9 @@ void sendCameraConfig(){
215230
}
216231
217232
void loop() {
218-
if(!Serial) {
233+
if(!Serial) {
219234
Serial.begin(115200);
220-
while(!Serial);
235+
while(!Serial);
221236
}
222237
223238
if(!Serial.available()) return;
@@ -227,26 +242,30 @@ void loop() {
227242
switch(request){
228243
case IMAGE_SEND_REQUEST:
229244
sendFrame();
230-
break;
245+
break;
231246
case CONFIG_SEND_REQUEST:
232247
sendCameraConfig();
233248
break;
234249
}
235-
250+
236251
}
237252
238253
```
239254

240255
### Step 2: Web Serial
241256

242-
Open the Webserial Interface which allows you to view the camera feed. As data is streamed via serial, make sure you close the Serial Monitor during this process, else it will not work.
257+
Open the [Webserial Interface](https://labs.oniudra.cc/en/labs/web-serial-camera) which allows you to view the camera feed. As data is streamed via serial, make sure you close the Serial Monitor during this process, else it will not work.
243258

244259
Press on **Connect** and select the correct port.
245260

246-
![Select Port](./assets/webSerial_example_connect.png)
261+
![Select Port](./assets/connect_port.png)
247262

248263
You should now be able to see the camera feed.
249264

265+
There is also a variety of video filters that can be applied.
266+
267+
![Video Filters](./assets/video_filter.png)
268+
250269
## Summary
251270

252-
In this article, we learned a bit more about the camera connector on board the GIGA R1 board, how it is connected to the STM32H747XI microcontroller, and a simple example on how to connect an inexpensive OV7675 camera module through web serial.
271+
In this article, we learned a bit more about the camera connector on board the GIGA R1 board, how it is connected to the STM32H747XI microcontroller, and a simple example of how to connect ArduCam camera modules through web serial.

0 commit comments

Comments
 (0)