Mega 2560 + data logger shield problem

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

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
tgmeiner
 
Posts: 40
Joined: Sun Jan 15, 2012 12:52 pm

Re: Mega 2560 + data logger shield problem

Post by tgmeiner »

Sorry, new to forums. I thought I was asking a user not tech support. :$

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Mega 2560 + data logger shield problem

Post by adafruit_support_bill »

I thought I was asking a user
That's OK. But include a link to your existing thread so everyone knows what's up. :D

Bucky99
 
Posts: 13
Joined: Mon Jan 30, 2012 9:53 am

Re: Mega 2560 + data logger shield problem

Post by Bucky99 »

Another semi-beginner joining the folks thanking fat16lib for the answers to fix the problem. I had the same problem did what fat16lib posted and got my Mega 2560 running with my Data Logger. MOF I'm running ada's Frig logger right now seemless. Nice! Now to clutter up all those pins on the MEGA! Yea

Bucky99
 
Posts: 13
Joined: Mon Jan 30, 2012 9:53 am

Re: Mega 2560 + data logger shield problem

Post by Bucky99 »

Spoke a little bit too early. The Data Logger is read and writing to the SD card fine, but after looking at the data it seems there is a problem with the clock on the Data Logger with a Mega.

This is the same reading I get everytime the logger wrote to the SD card.
"2165/165/165 165:165:85"

The Stamp is always '2028820689'

The millis changes from one record to another.

The light value seems consistant but the temp seems to jump around now and then.

Any thoughts on the Data Logger Clock with the Mega?

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Mega 2560 + data logger shield problem

Post by adafruit_support_bill »

Did you remember the blob of solder under the battery clip? It is necessary for good contact & the RTC chip will act strange without a battery there.

Bucky99
 
Posts: 13
Joined: Mon Jan 30, 2012 9:53 am

Re: Mega 2560 + data logger shield problem

Post by Bucky99 »

Yes I have the blob of solder under the battery clip. thank you for that note. Which makes me check the battery - just tested the battery to make sure it is still good and I'm getting 3.13v on the solder under the PCB

I should have noted the shield has been tested with a UNO and the Friglogger sample worked fine.

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Mega 2560 + data logger shield problem

Post by adafruit_support_bill »

The Mega uses different pins for I2C communication. You need to use softi2c:
http://forums.adafruit.com/viewtopic.php?f=25&t=13722

Bucky99
 
Posts: 13
Joined: Mon Jan 30, 2012 9:53 am

Re: Mega 2560 + data logger shield problem

Post by Bucky99 »

fat16lib wrote:Here are two i2c libraries i promised to post.
There are two libraries, SoftI2cMaster and TwiMaster. They are both derived from a TwoWireBase base class. This allows applications to use either library by only changing the init() call in setup().

SoftI2cMaster is a software i2c library that can use any two Arduino pins for SCL and SDA. It has an i2c clock rate of about 65 kHz.

TwiMaster uses the ATmega TWI hardware so you must use the hardware SCL and SDA pins. It is setup with a i2c clock rate of 400 kHz.

26 Dec 2011 new version as file i2cv2.zip
I take it the Soft12cMaster is the i2cv2.zip and the TwiMaster is the i2c.zip? (Zip files for download on that post)

You noted to use the i2cv2.zip (Soft12Master) - is there anything else that needs changed?
fat16lib mentioned a change in the setup() wiht the init() - not sure I understand that part.

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Mega 2560 + data logger shield problem

Post by adafruit_support_bill »

i2cv2.zip is the newer version that includes both tI2cMaster and TwiMaster. There is a readme.txt file as well as a SoftDS1307 example file. The example file shows how to talk to the RTC chip via software I2C.

Bucky99
 
Posts: 13
Joined: Mon Jan 30, 2012 9:53 am

Re: Mega 2560 + data logger shield problem

Post by Bucky99 »

adafruit_support wrote:There is a readme.txt file as well as a SoftDS1307 example file. The example file shows how to talk to the RTC chip via software I2C.
Maybe it shows a C+ coder how to talk to the RTC chip via software i2C, but to a hack like me it shows me a headache... LOL But after many hacks I got the uglest date time code working. Thank you very much for the resource - it does fix the problem, but MAN DO I MISS Adafruit tutorials.

I'll take the following
// fetch the time
now = RTC.now();
logfile.print(now.year(), DEC);
Over hexPrint(r[6]); ANY day of the week

Anyone puts a Hacker friendly lib together one day I want to be first in line. :)

elighcash
 
Posts: 3
Joined: Wed Dec 30, 2009 7:10 pm

Re: Mega 2560 + data logger shield problem

Post by elighcash »

I was having the same problem with the timestamp always showing "2165/165/165 165:165:85" and I JUST figured out what the issue is! Take a meter to the VCC pin on the DS1307. I bet it it reading something below 5v (mine was showing 3.3ish). The vcc pin into the ds1307 should be >=5v. I was using one of the old v1 solar shields from seeedstudio and for whatever reason, it was outputting 3.3 volts to the arduino. This voltage was enough to get the unit running and logging, but the ds1307 didn't like it and would always show "2165/165/165 165:165:85" as the time.

The reason I checked that pin was because the logger always posted good timestamps when I had the unit plugged in via usb to my computer but never worked when I was using a battery pack and the solar shield. I really hope that helps!

On another note, just FYI, I hooked up my meter to measure the total power usage of the logger shield, logging every 3 seconds, basically running the stock sketch from adafruit, and the usage is about 28-30mA using an Arduino Uno. That should help if you are trying to calculate how long some batteries might last.

geoana
 
Posts: 11
Joined: Tue Jul 15, 2014 6:16 am

Re: Mega 2560 + data logger shield problem

Post by geoana »

Sorry, the replacement of the UNO with the MEGA has been one big disaster. I badly need the additional sram! Big many processes sketch.
I am using the latest IDE (beta)!! Mega 2560
When I make the SPI 1 change I get:
C:\Program Files (x86)\Arduino\libraries\SD\utility\Sd2Card.cpp: In member function 'uint8_t Sd2Card::setSckRate(uint8_t)':

Also, along with no SD card, the RTC is now also dysfunctional. I seem to recall that someone posted (on the arduino forum, as I recall) that he/she 'would rewrite the library'.... 'but there didn't seem to be much interest?

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Mega 2560 + data logger shield problem

Post by adafruit_support_bill »

I am using the latest IDE (beta)!! Mega 2560
I would recommend using version 1.0.5. You do not need the Yun or Due support from 1.5.x and many of the libraries in that version are not quite ready for prime-time. That is why it is still "beta".

geoana
 
Posts: 11
Joined: Tue Jul 15, 2014 6:16 am

Re: Mega 2560 + data logger shield problem

Post by geoana »

My apologies to all; here and arduino forum. I threw away everything (IDE and my add-on libraries) and started from scratch and it appears that now, with JUST that one change (..SPI 0 to 1) everything works well. The major change is that I no longer use SOFTWARESERIAL and now use #include <AltSoftSerial.h> - it only appears to allow the one serial connection (pins 46 and 48) but that was what I needed so sketch seems workable now. In my opinion, SOFTWARESERIAL isn't compatible with the MEGA.
At this time, 'the Mega is great' and with the additional sram and 'pins' (I use about 14), does the job!
Thanks AdaFruit,
Geo

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Mega 2560 + data logger shield problem

Post by adafruit_support_bill »

We haven't had any problems with SoftwareSerial on the Mega. You just have to be aware of the pin limitations. Not all Mega pins support pin-change interrupts, so you have to select ones that do:

http://arduino.cc/en/Reference/SoftwareSerial
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”