How to connect ArduCAM shield to MEGA 2560

Arduino beginners offen face compatibility problems between UNO and MEGA board. The truth is that the UNO and MEGA board doesn’t compatible in some ways, for example UNO SPI port pins are 10,11,12,13, and I2C port pins are A4,A5, while Mega board SPI port pins are 50,51,52,53, and I2C port pins are 20,21. Actually the UNO and MEGA boards made some changes from R0 version to R3 version to make I2C interface compatible.

ArduCAM shield use hardware I2C interface, which is A4(SDA),A5(SCL) on UNO board, and 20(SDA),21(SCL) on MEGA board. Arduino UNO R3 and MEGA2560 R3 add additional pins for I2C interface but the R0 version don’t.
If you have MEGA 2560 R0 or R2 version, you have to re-wire the I2C and make some changes in the sketch.

Mega2560_I2C_rewire-1
Mega2560_I2C_rewire-2

 

 

 

 

 

 

 

 

 

Sketch should be modified as follows:

void Setup()
{
  ....
  pinMode(A4, INPUT);
  pinMode(A5, INPUT);
  ...
}

ArduCAM shield use hardware SPI interface for SD/TF read and write, which is 10(SS),11(MOSI),12(MISO),13(SCK) on UNO board. But on MEGA2560 board they are 53(SS),51(MOSI),50(MISO),52(SCK). When ArduCAM shield used on MEGA board, user should use software SPI, changes should be made as follows:

Open the file …\Arduino\libraries\SD\utility\Sd2Card.h and changed “#define MEGA_SOFT_SPI 0” to “#define MEGA_SOFT_SPI 1”. Then added “pinMode(53, OUTPUT); in the Setup() function.

2 thoughts on “How to connect ArduCAM shield to MEGA 2560

    • Yes, if you want to use the sd card socket in the ArduCAM shield you have to change the Sd2Card.h to make it use software spi library. Or else, you can use hardware SPI port to a additional SD card reader adapter board.

Leave a Reply

Your email address will not be published. Required fields are marked *


7 − = zero

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>