กลับไปหน้ารวมไฟล์
email-3ggprs-camera-4f6aee.md

ชื่อโปรเจกต์: Email 3G/GPRS Camera

ผมขอแนะนำวิธีเชื่อมต่อ UART JPEG Camera VC0706 เข้ากับ Arduino Uno, ถ่ายภาพ, บันทึกลงใน micro SD card และส่งรูปภาพนี้ไปยัง Email โดยใช้ 3G/GPRS shield พื้นฐานของบทความนี้มาจาก บทความอื่น ที่อธิบายขั้นตอนคล้ายกันแต่ใช้แพลตฟอร์มต่างกัน (Arduino M0) ดังนั้น สิ่งที่เราต้องมีคือ:

  • Arduino UNO
  • MicroSD card
  • Chip resistor (1206) 2.2 kOhm และ 3.3 kOhm
  • สายไฟ, หัวแร้ง ฯลฯ

แผนภาพบล็อก

Figure 1. แผนภาพบล็อก.

การตั้งค่ากล้อง (ฮาร์ดแวร์)

ในขั้นตอนแรก จำเป็นต้องเชื่อมต่อ UART JPEG camera VC0706 และ micro SD card เข้ากับ Arduino Uno เพื่อตรวจสอบการทำงานของกล้องและการบันทึกลงใน micro SD card

Micro SD card adapter เชื่อมต่อตามที่แสดงใน Figure 2

Figure 2. การเชื่อมต่อ micro SD และกล้อง.

โปรดให้ความสนใจเป็นพิเศษกับกล้องของคุณ มีอย่างน้อยสองตัวเลือก กล้องรุ่นแรก (www.adafruit.com/product/397) สามารถเชื่อมต่อกับ Arduino UNO ได้โดยไม่ต้องดัดแปลง

กล้องอีกแบบหนึ่งคือแบบที่มีไดรเวอร์ RS-232 MAX3232

จำเป็นต้องถอดบัดกรี MAX3232 chip (RS-232 driver) ออก และบัดกรี jumper ระหว่างแพดสัมผัสของขา 7 และ 10 ที่ตรงกันของ chip — ขาเหล่านี้มีหน้าที่สำหรับเอาต์พุต TX ของกล้อง คุณสามารถบัดกรี jumper แบบเดียวกันระหว่างแพด 8 และ 9 ได้ — กล้องก็จะทำงาน (Figure 8)

อย่างไรก็ตาม จะถูกต้องกว่าหากลดความกว้างของสัญญาณ RX (อินพุตกล้อง) ให้มีค่าไม่เกิน 3.3 V โดยใช้ตัวต้านทานสองตัว (voltage divider) ดังที่แสดงใน Figure 10

ดังนั้น เราต้องเชื่อมต่อกล้องตามที่แสดงใน Figure 2 ผลลัพธ์ที่ได้ควรมีลักษณะดังนี้ (Figure 14) Micro SD card จะต้องฟอร์แมตเป็น FAT32 อย่าลืมเชื่อมต่อสาย USB

Figure 14. ทดสอบกล้องและ micro SD card.

ถึงเวลาตรวจสอบการทำงานของกล้องและการบันทึกลงใน micro SD ก่อนการใช้งานครั้งแรก จำเป็นต้องติดตั้งไลบรารีเพิ่มเติม

การตั้งค่าซอฟต์แวร์

การตั้งโปรแกรมทำผ่าน Arduino IDE ไลบรารีเพิ่มเติม (สำหรับทั้งโปรเจกต์):

การเริ่มต้นครั้งแรก

เรียกใช้ Arduino IDE, สร้าง sketch ชื่อ CameraTest.ino:

#include "SoftwareSerial.h"
#include
#include
#include
#define SS_SD 4
//use software serial
SoftwareSerial cameraconnection(2,3);//Rx, Tx
VC0706 cam = VC0706(&cameraconnection);
//use hardware serial
//VC0706 cam = VC0706(&Serial);
void setup()
{
Serial.begin(115200);
Serial.println("VC0706 Camera Snapshot Test ...");
if (!SD.begin(SS_SD)) {
Serial.println("SD Card init failed...");
return;
}
if(true == cameraInit()){
snapShot();
}else{
Serial.println("camera init error...");
}
}
void loop()
{
//nothing to do
}
bool cameraInit()
{
cam.begin(BaudRate_38400);
char *reply = cam.getVersion();
if (reply == 0) {
Serial.println("Failed to get version");
return false;
} else {
Serial.println("version:");
Serial.println("-----------------");
Serial.println(reply);
Serial.println("-----------------");
return true;
}
}
void snapShot()
{
Serial.println("Snap in 3 secs...");
delay(3000);

ข้อมูล Frontmatter ดั้งเดิม

title: "Email 3G/GPRS Camera"
description: "Photographing an object (VC0706 camera), saving a photo from a camera on a micro SD card, sending a photo using 3G/GPRS shield to an email."
author: "ASimon"
category: "Internet of Things, BT & Wireless"
tags:
  - "photo"
  - "email"
  - "vc0706"
  - "camera"
views: 25080
likes: 7
price: 2450
difficulty: "Intermediate"
components:
  - "1x Arduino UNO"
  - "1x Soldering iron (generic)"
  - "1x 3G/GPRS/GSM Shield for Arduino with GPS - European version SIM5320E"
  - "1x Wires, etc."
  - "1x MicroSD card breakout board+"
  - "1x TTL Serial JPEG Camera with NTSC Video"
  - "1x Commercial MLC microSD"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "96571cdbce5f296f40f40131ad20bb728e79470c87cf39c0daff68a687731805"
encryptedPayload: "U2FsdGVkX18oEuzZlueDCw6uP7c0sLwD+BauP36D+4B0u9vlf4mxud5tbhdXcLqCk9SLoWmODQMbzagGdEB281QGBqIyxQol3NX0iI5M78c="
seoDescription: "Create an Email 3G/GPRS Camera using VC0706 camera to capture, save to micro SD card, and send photos via 3G/GPRS shield."
videoLinks:
  - "https://www.youtube.com/embed/bK6o-5oO6r4"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/email-3ggprs-camera-4f6aee_cover.jpg"
lang: "th"