How to get MCP3002 to work with arduino?

Hello,

In my arduino project I have added a camera, an analog to digital converter (MCP3002) and are using an Arduino pro 5v. I can not get the camera to work with this ic chip. Does anyone have some code to test with? Or can anyone help me to get it to work?

[quote author=The Crusher link=topic=130546.msg981742#msg981742 date=1351971478] ...a camera, an analog to digital converter (MCP3002) and are using an Arduino pro 5v. I can not get the camera to work with this ic chip. Does anyone have some code to test with? Or can anyone help me to get it to work? [/quote] How do you want the one to work with the other? What's their interaction?

Which camera?

Mark

Sorry, I did forgot to post the links...

Camera: http://www.hobbyking.com/hobbyking/store/__26833__Micro_Camera_with_LED_Lamp_420TVL.html MCP3002: https://www.sparkfun.com/products/8636

I want it to make the analog video signal from the camera digital and transfer it wirelessly trough a bluetooth or rf module to my computer. The ADC that is intergrated in the arduino is not good enough. I have no sample pictures of it yet.

But since the ADC I got uses SPI, do I have to send the video signal trough the arduino then? Or can I send it directly to a bluetooth/rf module?

And how should I connect the ADC to the arduino? Any test codes?

I know this is an older topic but I was having trouble getting this to work and thought I’d share with the rest of the crowd.

// MCP3002 - Example code using Arduino UNO.
// March 17,2013
// Wiring
//    Pin 10 to /CS
//    Pin 11 to Din
//    Pin 12 to Dout
//    Pin 13 to CLK
//
// Do a conversion on both channels and write results to serial port.
//
// Include the SPI library:
#include <SPI.h>

// Set pin 10 as the slave select for A/D converter
const int slaveSelect = 10;

void setup()
{
  // Initialize serial port for com to host
  Serial.begin (9600);
  // Set the slave select pin as an output
  pinMode (slaveSelect, OUTPUT);
  // Initialize SPI
  SPI.begin();
  SPI.setBitOrder (MSBFIRST);
}

void loop()
{
  // Going to be doing a conversion on both channels (ch0,ch1)
  byte conversionMSB,conversionLSB;
  word chA,chB;
  digitalWrite (slaveSelect,LOW);
  
  // Communication with the device starts when /CS line brought low.
  // The first '1' bit transmitted is the start bit.
  // The next 3 bits define
  //    Single Ended Input / Differential Input
  //    Ch0 / Ch1 if single ended input or polarity if differential
  //    MSBF / LSBF (Most/Least Significan Bit First)
  // The returned value is ten bits long so if the bit pattern transmitted
  // is placed correctly, the two most significant bits will be sent back
  // with the first transfer. the rest on the second transfer.
  conversionMSB = SPI.transfer (0x60);
  conversionLSB = SPI.transfer (0);
  
  chA = word (conversionMSB,conversionLSB);
  digitalWrite (slaveSelect,HIGH);
  Serial.print (chA,DEC);
  Serial.print("  ");
  
  // Do the same conversion but with the second channel.
  digitalWrite (slaveSelect,LOW);
  conversionMSB = SPI.transfer (0x70);
  conversionLSB = SPI.transfer (0);
  chB = word (conversionMSB,conversionLSB);
  digitalWrite (slaveSelect,HIGH);
  Serial.println (chB,DEC);
  delay (100);
}

Moderator edit: Code tags, Grrrrr. AWOL

I'm a little surprised with how the original thread trailed off at the end. First, there is MCP3208 code in the Playground, http://playground.arduino.cc/Code/MCP3208

Secondly, although I don't see a datasheet for it, that camera appears to have a straightforward NTSC or PAL output, and the ADC in question would be way too slow to capture the video. Plus the Arduino is also lightyears too slow, and has too little RAM to do much.