Introduction: Arduino Email Camera (VC0706 + 3G Shield + Arduino M0 Analogue)
Once I got a camera VC0706 in my hands. I successfully connected it to Arduino UNO, took a photo, recorded it on micro SD. I wanted something more - to transfer the received photo to somewhere. For example, via 3G/GPRS shield. The simplest is to send MMS. But the cost of MMS is quite high. I wanted to do something cheaper. For example, send a photo to email.
In this guide, I will show you how to connect a VC0706 camera and 3G/GPRS shield to the analogue Arduino M0, take a photo and send it to an email.
We will need:
1) Camera VC0706
2) 3G/GPRS shield SIM5320
3) Analogue Arduino M0
4) Micro SD
5) Power adapter 6-12V
6) Pin Angle connector with 2.54 mm pitch
7) Tips on the wires type "female"
Analogue Arduino M0 was chosen for several reasons:
- More available hardware serial ports - "Serial" (for connecting the camera), "Serial1" (for connecting 3G/GPRS shield), "SerialUSB" (for communication with the PC).
- The level of logic signals 3.3V - convenient for connecting the camera VC0706. But there is a compatibility problem with some GPRS-shield, which are designed for level 5V.
- The presence on the motherboard connector microSD to connect a memory card.
- More memory, higher operating frequency and more.
Analogue Arduino M0 software compatible with the original Arduino M0. Sketches for Arduino UNO was rather easily adapted for the Arduino M0 analogue.
Step 1: Preparation of Camera
The camera has a RS-232 output for direct connection to a PC. It is necessary to remove the MAX232 (RS-232 converter) and close the contact pads between the corresponding pins 7-10 (TX), 8-9 (RX).
The six-wire cable that came with the camera needs to be slightly redone:
- Remove the two wires from the connector.
- Rearrange the red (+ 5V) and black (GND) wires as shown in the figure.
On the bare ends of the wires must be soldered tips like "female".
Step 2: Preparation of Analog Arduino M0
As already mentioned, the Analogue Arduino M0 is hardware and software compatible with the original Arduino M0, but it also has an onboard microSD connector for connecting a memory card.
To connect the camera to the Arduino M0 Analogue on the board it is necessary to solder the angular connector to the terminals TXD, RXD (connector X6) as shown in the figure. This port matches to the "Serial".
White (Camera RX) and yellow (Camera TX) wires from the camera must be connected respectively to the terminals of the TXD and RXD (connector X6) as shown in the figure.
You must insert a memory card (at least 32MB) formatted in FAT32 format into the microSD slot.
Step 3: Preparation of 3G/GPRS Shield
Before installing a sim card in the slot, you must disable the PIN code request. Then install the SIM card in the slot on the bottom side of the board as shown in the figure.
Two jumpers must be installed in the position RX-1 (D1), TX-0 (D0).
Step 4: Final Build
For the final assembly it is necessary to connect the 3G/GPRS shield to the Arduino M0 analogue.
After that, we connect the camera VC0706. The power supply of the camera (red wire "+ 5V" and black wire "GND") must be taken from the "+5V" and the "GND" terminals from the 3G/GPRS shield connector. You can also use a angle connector for this.
Do not forget to connect the 3G antenna.
Step 5: Device Programming
First of all, it is necessary to install libraries for working with the camera VC0706 and for working with an Xmodem (transferring images to a 3G/GPRS shield):
Attention: in the library file for working with the camera VC0706_UART.h it is necessary to comment out the following lines:
// # include "SoftwareSerial.h"
and set constants:
#define DEBUG 0
#define USE_SOFTWARE_SERIAL 0
#define TRANSFER_BY_SPI 0
Next, you need to submit to the board analogue Arduino M0 power 6-12V. Connect micro USB cable.
Launch the Arduino IDE. Open the sketch EmailCamera.ino.
Select in the settings "Tools-> Board:" Arduino M0 Pro (Native USB Port)"".
In the sketch it is necessary to register the following lines (instead of '*'):
const char smtp_server  = "*****"; // SMTP server
const char smtp_user_name  = "*****"; // SMTP user name
const char smtp_password  = "*****"; // SMTP password
const char smtp_port  = "***"; // SMTP server port
// Write here you SIM card data
cons char apn  = "*****";
const char user_name  = "***";
const char password  = "***";
// Write here your information about sender, directions and names
const char sender_address  = "*****"; // Sender address
const char sender_name  = "*****"; // Sender name
const char to_address  = "*****"; // Recipient address
const char to_name  = "*****"; // Recipient name
Remove the camera cover from the lens. We direct the camera to the object being photographed.
Launch the Serial Monitor. Click the button "Upload", compile the sketch, program the board. In Serial Monitor we observe debug information. After successful completion, check the recipient's email.
I would like to express my great help in creating a sketch:
Limor Fried, Tom Igoe, Peter Turczak.
In a few days I plan to make and post a video with a demonstration of work.
During the work, defects were found in the Xmodem library (non-critical for this instruction).
In the future, there is an idea for a new instruction: add a motion sensor function with cyclic polling and sending pictures.
Thank you for watching.