Using Data Logger Shield with Mega

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Using Data Logger Shield with Mega

Postby dir » Wed Jun 23, 2010 4:01 pm

I had a question about using the data logger with the Mega.

In another topic fat16lib said that:
The problem is that the Mega hardware SPI pins don't connect to a 168/328 shield's pins. The Data logging shield and normal Ethernet shield connect to SPI pins 10 - 13, not the Mega hardware SPI pins 50 - 53. People have made this work by adding wire to the Mega SPI pins.

The NKC shield connects to the ICSP header on the Arduino. This only works if it plugs into the Arduino Mega and stacking the Data logging shield on top may not work easily.


So can I just connect wire from the Data Logger shield digital pins 10-13 to the pins 50-53 of the Mega?

Is there also going to be code I need to replace?
dir
 
Posts: 9
Joined: Sat May 22, 2010 9:59 pm

Re: Using Data Logger Shield with Mega

Postby adafruit » Wed Jun 23, 2010 4:15 pm

we havent tested it outright but the SD card code is intended to work seamlessly with the mega - we'll try to verify functionality
User avatar
adafruit
 
Posts: 10491
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Using Data Logger Shield with Mega

Postby fat16lib » Wed Jun 23, 2010 7:09 pm

The other thread was about stacking an Ethernet Shield with a Data logging Shield.

If you are only using the Data Logging Shield on the Mega you can select software SPI by removing '//' in this line in Sd2Card.h at about line 36.

Code: Select all
//#define MEGA_SOFT_SPI

SdFat will then use pins 10 -13 for software SPI.


You can also connect the hardware SPI pins on the Mega with wires. SdFat will then work with no changes.

The RTC chip is also a problem on the Mega since the I2C pins are 20 (SDA) and 21 (SCL) on the Mega. This is not in the same location as the I2C pins on the Duemilanove or Diecimila.
fat16lib
 
Posts: 586
Joined: Wed Dec 24, 2008 12:54 pm

Re: Using Data Logger Shield with Mega

Postby domajo » Wed Jul 14, 2010 10:27 am

Could you be more specific about rewiring the RTC pins? I removed the // in front of //#define MEGA_SOFT_SPI and I was still getting an error (card.init failure, codes 1 and 0) do I have to recompile Sd2Card.h separatly or does it happen automatically? I wish these problems with the MEGA were a little better documented, I bought another datalogger shield thinking thay I had mis-assembled the first one. It is mentioned in the documentation that there are modifications for the datalogger/GPS shield but it doesn't seem to acknowledge the plain data logger having a problem, and it certainly doesn't mention having to rewire anything.
domajo
 
Posts: 1
Joined: Fri Jun 18, 2010 4:57 pm

Re: Using Data Logger Shield with Mega

Postby fat16lib » Wed Jul 14, 2010 12:20 pm

If you edit Sd2Card.h so the // is removed like this
Code: Select all
#define MEGA_SOFT_SPI

and run the SdFatWrite.pde sketch from the SdfFat/examples folder on the mega you should get:
Type any character to start
Writing to: WRITE00.TXT
Done

The recompile of SdFat should be automatic.

Rewiring the RTC is not so easy if you want to use hardware I2C. You need to add wires from the I2C header on the Data Logger shield to mega pins 20 and 21. The mega pins are marked with SDA and SCL. Connect the shield SDA pad to the mega SDA pin and shield SCL pad to the mega SCL pin. Do not use the mega analog pins 4,5 in your sketches since they are also connected to the RTC chip.

I have a soft I2C library that will allow the RTC to be used without the wires. I have only released a demo version. Here is the url

viewtopic.php?f=25&t=13722&p=66953&hilit=softi2c#p66953

If you install the SoftI2CMaster library and edit the softDS1307.pde sketch like this:
Code: Select all
// pins for DS1307 with software i2c
#define SCL_PIN 59
#define SDA_PIN 58


You should get this when you run the sketch on the mega:
The current time is 07/14/2010 Wed 09:48:32
Control: 03

Options are:
(0) Display date and time
(1) Set time
(2) Set date
(3) Set Control
(4) Dump all
(5) Set NV RAM
Enter option:


You could use code from this sketch to read the RTC chip on the mega with no hardware mods.
fat16lib
 
Posts: 586
Joined: Wed Dec 24, 2008 12:54 pm

Re: Using Data Logger Shield with Mega

Postby jer291113 » Wed Aug 04, 2010 11:05 am

I was able to get the SD card to read and write but I can not get the s/w I2C to access the DS1307 on the Data Logger Shield and the Arduino Mega.

Has anyone gotten the sketch softDS1307 using the SoftI2CMaster to work?

Any help would be appreciated...Thanks!
jer291113
 
Posts: 9
Joined: Fri Jul 23, 2010 8:56 am

Re: Using Data Logger Shield with Mega

Postby Garitron » Sun Jun 12, 2011 5:13 pm

The last post to this thread was a year ago, but the Subject line seems appropriate...

I'm about to populate the Data Logger Shield Kit v1.0 and I'd like to be able to use it on a Duemilanove or a Mega 2560 using the built-in hardware SPI and I2C.

What I want to do is sever the SPI circuit from pins 10,11,12,13 and the I2C circuit from analog pins 4 and 5. I'll then either jumper them back (for Duemilanove) or re-route them via wires to pins 50-53 and 27-28 on the Mega.

I'm finding it difficult to see the traces under the solder mask and the silkscreen markings on the logger board. It would be very helpful if Adafruit could provide pictures of both sides of the logger board before the solder mask and silkscreen are applied...

Attention Moderator: Are such pictures available? Can they be made available?

(Note: SparkFun posts the full layout file of their SD board...)

73,
Garitron
Garitron
 
Posts: 2
Joined: Sun Jun 12, 2011 1:50 pm

Re: Using Data Logger Shield with Mega

Postby adafruit » Sun Jun 12, 2011 10:00 pm

http://www.ladyada.net/make/logshield/download.html you can download the raw pcb layout files here!
we'll update the documentation soon to use the software SPI for mega which is how we suggest using it
User avatar
adafruit
 
Posts: 10491
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: Using Data Logger Shield with Mega

Postby Garitron » Tue Jun 14, 2011 2:29 pm

Thanks "adafruit"! Having the layout file makes the job a lot easier. I guess I thought that "Downloads" only contained software, so I didn't click it.

If you are re-working the board at some point, you might note that the SCK signal has a redundant connection to Pin 3 of the ICSP connector.

73,
Garitron
Garitron
 
Posts: 2
Joined: Sun Jun 12, 2011 1:50 pm


Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: Google [Bot] and 5 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [103]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[61]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]