Hello,
Following my problem of faulty camera, I received (thanks for the customer support of Adafruit) a new camera and the first part of the tutorial works perfectly. Then, I continue the tutorial and the camera was perfectly detect on the pins 8 et 7. But there is a problem with the read of the picture to write it on the sd card. I asked the arduino forum and you can see tests which I made. I noticed that when you tested the camera (in the first post on the second page) you don't have the finish "Done !". So I thinks that when you test the camera, you don't had the picture on the sd card and like me and you have the same problem like me isn't it ? (Maybe you don't noticed this because my problem was the detection of the camera.)
Somebody has an idea to save the picture taken ?
Thanks you for your answers
[Solved] Save a picture on Arduino Yun
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- ArduinoYun123
- Posts: 15
- Joined: Thu Jan 08, 2015 1:22 pm
[Solved] Save a picture on Arduino Yun
Last edited by ArduinoYun123 on Wed Feb 18, 2015 7:34 am, edited 1 time in total.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Save a picture on Arduino Yun
I can confirm that my Yun behaves the same way. It seems to be a problem with the bridge to linux. I don't know how to fix it. Why not use a SPI SD breakout instead?
https://www.adafruit.com/products/254
https://www.adafruit.com/products/254
- ArduinoYun123
- Posts: 15
- Joined: Thu Jan 08, 2015 1:22 pm
Re: Save a picture on Arduino Yun
I found the solution !!!!
The problem is on the pin 7 who is link to the AR9331 processor (you can see this on the pinout diagram).
So to take a picture and save it on the sd card with the Arduino Yun :
-connect the wires like this : -you must obtain something like this : -put this program on the Yun (I had problems of compilation with the IDE 1.5.8 and the 1.6.0 on Windows 8.1. So I made the compilation on Ubuntu 12.04LTS with the IDE 1.5.4 and all works perfectly. You can download all the version of the IDE at this link) :
-Then you must have this :
-You have now your picture on your sd card :
Enjoy your pictures ;)
The problem is on the pin 7 who is link to the AR9331 processor (you can see this on the pinout diagram).
So to take a picture and save it on the sd card with the Arduino Yun :
-connect the wires like this : -you must obtain something like this : -put this program on the Yun (I had problems of compilation with the IDE 1.5.8 and the 1.6.0 on Windows 8.1. So I made the compilation on Ubuntu 12.04LTS with the IDE 1.5.4 and all works perfectly. You can download all the version of the IDE at this link) :
Code: Select all
#include <Adafruit_VC0706.h>
#include <FileIO.h>
#include <SoftwareSerial.h>
SoftwareSerial cameraconnection = SoftwareSerial(9, 8);
Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection);
void setup() {
while (!Serial);
Bridge.begin();
Serial.begin(9600);
Serial.println("VC0706 Camera snapshot test");
if (!FileSystem.begin()) {
Serial.println("Card failed, or not present");
}
// Try to locate the camera
if (cam.begin()) {
Serial.println("Camera Found:");
} else {
Serial.println("No camera found?");
return;
}
cam.setImageSize(VC0706_640x480);
Serial.println("Snap in 3 secs...");
delay(3000);
if (! cam.takePicture())
Serial.println("Failed to snap!");
else
Serial.println("Picture taken!");
// Create an image with the name IMAGExx.JPG
char filename[23];
strcpy(filename, "/mnt/sda1/IMAGE00.JPG");
for (int i = 0; i < 100; i++) {
filename[15] = '0' + i/10;
filename[16] = '0' + i%10;
// create if does not exist, do not open existing, write, sync after write
if (! FileSystem.exists(filename)) {
break;
}
}
// Open the file for writing
File imgFile = FileSystem.open(filename, FILE_WRITE);
if (!imgFile) {
Serial.println("Open Failed !");
}
else{
Serial.println("Open done !");
}
// Get the size of the image (frame) taken
uint16_t jpglen = cam.frameLength();
Serial.print("Storing ");
Serial.print(jpglen, DEC);
Serial.print(" byte image.");
int32_t time = millis();
pinMode(8, OUTPUT);
// Read all the data up to # bytes!
byte wCount = 0; // For counting # of writes
while (jpglen > 0) {
// read 32 bytes at a time;
uint8_t *buffer;
uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups!
buffer = cam.readPicture(bytesToRead);
imgFile.write(buffer, bytesToRead);
if(++wCount >= 64) { // Every 2K, give a little feedback so it doesn't appear locked up
Serial.print('.');
wCount = 0;
}
jpglen -= bytesToRead;
}
imgFile.close();
time = millis() - time;
Serial.println("done!");
Serial.print(time); Serial.println(" ms elapsed");
}
void loop() {
}
Code: Select all
VC0706 Camera snapshot test
Camera Found:
Snap in 3 secs...
Picture taken!
Open done !
Storing 48956 byte image........................done!
48005 ms elapsed
Enjoy your pictures ;)
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: [Solved] Save a picture on Arduino Yun
Good find!
Please be positive and constructive with your questions and comments.