Sunday 1 April 2012

Take a picture with Arduino

Have you ever thought to attach a camera on your Arduino? Well, today it's your lucky day because I can show you an example of you can connect the Linksprite camera to your Arduino.

Items:
  1. Arduino uno
  2. Linksprite Camera JPEG
  3. SD Reader
Library:
  1. SD
  2. Adafruit VC0706 ( download )
 It's time to connect everything together! Connect your SD Reader as usually, I choose the SD Shield because it's simple to have everything in a pile, after that you can connect your camera on the pins 2,3.

2 => TX
3 => RX


When everything is connected, you need to open the Arduino IDE and try the example of Adafruit, make sure that the CS of the SD Reader it's the right one, otherwise you will not able to run the script.

You should see something like that:

When Arduino has finished to write the image on your SD Card, plug it on your computer and check the result.

**** ATTENTION *****
The example works only on Windows ( maybe OSX as well ).


Issue with Linksprite and Linux


Today, I want to create this article because I have been looking for a solution in 3 months.
The problem was with the magic Linksprite Camera JPEG, that you can buy on Sparkfun. This camera is a good solution to  have implement a camera on your project.
I was working on my project and I couldn't finish it because I found a problem with the communication between my Arduino and the Camera.


Basically every time that your turn on the camera you should receiver an INIT STRING:

VC0703 1.00
Ctrl infr exist
User-defined sensor
625
Init end

and in HEX codes is:
56 43 30 37 30 33 20 31 2E 30 30 0D 0A 43 74 72 6C 20 69 6E 66 72 20 65 78 69 73 74 0D 0A 55 73 65 72 2D 64 65 66 69 6E 65 64 20 73 65 6E 73 6F 72 0D 0A 36 32 35 0D 0A 49 6E 69 74 20 65 6E 64 0D 0A 

I was checking to get the same init when I was turning on the camera but I was getting something strange:
096A198136999B2C1C11514DE1E4AC90B457595CA82CAFD5175788AC6AD5E45AA4B2B32D6B455DAD5DCE6AFB98D859B498D21E189B7B45A48294BD5A4FC

How you see the result on Linux isn't right, is totally wrong!

I was looking for a solution on the internet, forum, etc... I found one post where a person was talking about the issue to compile the same code on difference OS, in particular that on Windows works and on Linux doesn't.


In the end I tried to use the same Arduino IDE on Linux and Windows and then I compared the result:


Windows:
056433037303320312E3030DA4374726C20696E6672206578697374DA557365722D646566696E65642073656E736F72DA363235DA496E697420656E64DA

Linux:
096A198136999B2C1C11514DE1E4AC90B457595CA82CAFD5175788AC6AD5E45AA4B2B32D6B455DAD5DCE6AFB98D859B498D21E189B7B45A48294BD5A4FC

Evidently there is something wrong on the Linux's compiler.
So, my solution now is to move the project on Windows and finally complete it.

I hope this article will help someone that has got the same problem.