Hello, new to this world.
I have a Mega 2560 R3 and a NuElectronics Data and IO Shield. The data storage to a SD memory card seems to be working fine. I can write to it and read the card on my PC. I noticed the file name listing has the correct time/date.
I am having zero luck reading time/date from RTC 1302 clock. I am using pins 50-53 and have tried several sketches. In one, I get like 2165 65 65 65 etc for time/date. I think there is simple solution that is evading me for a few days now.
I have the Ping, the two line backlighted LCD, two axis accelerometer, and analog voltage readings, all working in different sketches. But the clock, no. Any help would be appreciated!
The Nuelectronics schematic (http://www.nuelectronics.com/download/projects/sensor_shield_v1.0.pdf) shows the RTC as being connected to pins 3, 4 and 6.
Have you tried using the library they provide? http://www.nuelectronics.com/download/projects/sensor_pff.zip
Hi John,
Thanks for the reply. I am sorry, I do not see what you are pointing to. In the schematic, the RTC, pin 3 is connected to X2, pin 4 is gnd, and pin 6 is IO. I believe I had to connect to the 50-53 pins for the data card to work. Can you give me a bit more info on the pins that I should connect?
Yes, I've tried about 3 or 4 different sketches and on one get the results that were in my orig message or I get compile errors on the include DS1302.h, even though it is in the library...
Hi again John,
I sorta see what you are referring to, pins 3, 4 and 6. Pin 6 (IO) on the 1302 chip connects to J1 pin 4. On the NuElect schematic, J1 is numbered starting at 1 but on the NuElect silkscreen, numbering starts at 0. Getting past that, where is J1 pin 4 connected to???
Thanks again....
Pete999:
Hi again John,I sorta see what you are referring to, pins 3, 4 and 6. Pin 6 (IO) on the 1302 chip connects to J1 pin 4. On the NuElect schematic, J1 is numbered starting at 1 but on the NuElect silkscreen, numbering starts at 0. Getting past that, where is J1 pin 4 connected to???
Thanks again....
J1 pins 1 through 8 seem (also labeled PD0 through PD7) to be connected to Arduino data pins 0 through 7.
RTC pin 5 (CE) is connected to PD6/J1-7 and therefore Arduino data pin 6.
RTC pin 6 (IO) is connected to PD4/J1-5 and therefore Arduino data pin 4.
RTC pin 5 (SCLK) is connected to PD3/J1-4 and therefore Arduino data pin 3.
Typically this sort of three-wire interface would be read by setting CE to LOW (usually CE would be active-low) and then putting data on the IO pin and pulsing the SCLK pin.
The NuElect shield plugs into the top of the Mega, so J1E plugs into J1 and so forth. And the RTC pins do connect to the J1 pins as you described. So I guess that takes care of any wiring issues?
I've tried about 3 or 4 RTC or Datalog sketches with no success. One of them gave me 2165 165 165 165 etc for the date and time. The others produce an error when compiling, usually DS1302 include related, I believe, even though DS1302.h and DS1302.cpp (?) is in the library directory. Thanks for your time. Any ideas?
This one works, at least on an Uno, I don't have a Mega.
When the shield sits on top of the UNO, the connection are as johnwasser says
http://www.henningkarlsen.com/electronics/library.php?id=5
// Init the DS1302
DS1302 rtc(6, 4, 3);
One of them gave me 2165 165 165 165 etc for the date and time
Yes I get that too if I connect the wrong pin numbers