Page 2 of 5

Re: Data Logger Shield (HCARDU0093)

Posted: Sun May 17, 2015 9:43 pm
by DIY_Monster
When I attempt to compile the first example sketch "Data_Logger_Shield_HCARDU0093_Example" I get the following error:
Arduino: 1.6.4 (Linux), Board: "Arduino Uno"
<snip>
/home/william/ArduinoProgs/libraries/HCRTC/HCRTC.cpp: In constructor 'HCRTC::HCRTC()':
/home/william/ArduinoProgs/libraries/HCRTC/HCRTC.cpp:35:2: error: 'Wire' was not declared in this scope
Wire.begin();
and on lines: 113:4:131:4:158:3:166:3:172:3:178:3:187:3:

I have pared down to the following code that has the problem;

// start sketch
#include <HCRTC.h>
void setup()
{}
void loop()
{}
// end sketch

Arduino: 1.6.4 (Linux), Board: "Arduino Uno"
Using library HCRTC in folder: /home/william/ArduinoProgs/libraries/HCRTC (legacy)
<snip>
/home/william/ArduinoProgs/libraries/HCRTC/HCRTC.h:33:18: fatal error: wire.h: No such file or directory
#include "wire.h"
^
compilation terminated.
Error compiling.


I am using Arduino 1.6.4 in Ubuntu. The following sketch does compile.

// start
#include <Wire.h>
void setup()
{}
void loop()
{}
//end

The compiler can find the wire library. Please could you help.

Regards, William.

Re: Data Logger Shield (HCARDU0093)

Posted: Mon May 18, 2015 9:10 am
by andrew
Can you try adding the following line to the top of the sketch:

Code: Select all

#include <SPI.h>
I think that will fix it. If so I'll get the sketch updated.

Re: Data Logger Shield (HCARDU0093)

Posted: Mon May 18, 2015 10:28 am
by DIY_Monster
Thanks. The sketch certainly compiles now. Interestingly, I just downloaded the older Arduino software 1.0.6 and the original sketch compiles.
Regards.
William.

Re: Data Logger Shield (HCARDU0093)

Posted: Mon May 18, 2015 1:02 pm
by andrew
Thanks for confirming. Arduino probably changed the order in which libraries are compiled in the latest version of the IDE. That line is actually included HCRTC library but it looks like on newer versions of the IDE it needs it to be in the sketch itself. I'll get the example sketch updated.

Re: Data Logger Shield (HCARDU0093)

Posted: Thu May 21, 2015 2:39 pm
by astrolabio
Hello,

I just got one of these shields and I am facing a weird problem. When I use it, Arduino only starts looping once I open the serial monitor, and it stops when closing it. I have tried with the provided sample program and happens the same. Any thoughts?

Thanks a lot!!

Re: Data Logger Shield (HCARDU0093)

Posted: Fri May 22, 2015 7:20 am
by andrew
That is weird. Do you get the same weird behaviour if you try it with something else such as the blink sketch or better still one of the serial port example sketches? Try them with and without the shield connected. If they seem to work can you try the example sketch in the 5th post down on the first page of this thread

Re: Data Logger Shield (HCARDU0093)

Posted: Mon Jan 18, 2016 12:25 pm
by solar82
Hi,

The shield works fine with my UNO. However, I can't get it to work with a DUE. I am having problems with the instance of HCRTC library. If I uncomment this line board will print to the serial. However, if this line is active nothing prints to the serial.

thank you for your help

p.d. So I just realized that in the description it says the shield is for the UNO, Leonardo and Mega. Will it not work for the DUE? Is a firmware update expected for the shield to work with the DUE. thank you

Re: Data Logger Shield (HCARDU0093)

Posted: Mon Jan 18, 2016 2:27 pm
by andrew
For some reason when the HCRTC library is complied for a Due it does't like the wire library initialisation function being run when an instance of the library is created. I'll get this moved when the library is next updated but for a quick fix open up the HCRTC.cpp file in a text editor and change this:

Code: Select all

HCRTC::HCRTC(void)
{
	Wire.begin();
}
to this:

Code: Select all

HCRTC::HCRTC(void)
{
	//Wire.begin(); <- COMMENT OUT THIS LINE
}

Save it and then in the setup() function in your main sketch add this as the first line:

Code: Select all

Wire.begin();

Re: Data Logger Shield (HCARDU0093)

Posted: Sat Apr 23, 2016 1:07 pm
by AndreTarta
Hi! I bought on ebay this module some day ago.
I have problem to run it: I'm able to set the current time but when I read it the value (hour and date) is not correct (I try to change the battery so I think that it is not the problem).
I use Arduino Uno R3.

I readed some old post and I tried differet libraries:

1)
Time.h https://www.pjrc.com/teensy/td_libs_Time.html
DS1307RTC-master https://www.pjrc.com/teensy/td_libs_DS1307RTC.html
With the example I correctly set the time, but when I run the read example I obtain always the same data and hour (different from the one that I set).

2)
RTClib.h https://github.com/adafruit/RTClib
With the example sd1307 (I correcly uncommented the set time line) I don't obtaine the correct hour and date and the time don't update: on monitor always the same hour is printed.

3)
HCRTC.h https://github.com/dtu-mekatronik/HCRTC. (Library indicated in this forum)
With this one I'm able to set the time, but when I read the hour I receive in output alway the same result (the settled value).
I attach the sketch, there is something wrong?

Code: Select all

//SET TIME AND READ VALUE

/* Include the wire library */
#include <Wire.h>
/* Include the Hobby Components RTC library */
#include <HCRTC.h>
/* Include the SPI library */
#include <SPI.h>

/* The RTC has a fixed addresses of 0x68 */
#define I2CDS1307Add 0x68

/* Create an instance of HCRTC library */
HCRTC HCRTC;

void setup(){
  /* Initialise the serial port and wire transmission*/
  Serial.begin(9600);
  Wire.begin();
  Wire.beginTransmission(0x68);
  
  /* Read the current time from the RTC module */
  HCRTC.RTCWrite(I2CDS1307Add, 16, 4, 23, 15, 2, 0, 5);
}

void loop(){
  /* Read the current time from the RTC module */
  HCRTC.RTCRead(I2CDS1307Add);
    
  /* Lets output this data to the serial port */ 
  Serial.print(HCRTC.GetDay());
  Serial.print("/");
  Serial.print(HCRTC.GetMonth());
  Serial.print("/");
  Serial.print(HCRTC.GetYear());
  Serial.print(" ");
   
  Serial.print(HCRTC.GetHour());
  Serial.print(":");
  Serial.print(HCRTC.GetMinute());
  Serial.print(":");
  Serial.print(HCRTC.GetSecond());
  Serial.print(" DOW:");
  Serial.println(HCRTC.GetWeekday());
  delay(2000);
}

Re: Data Logger Shield (HCARDU0093)

Posted: Mon Apr 25, 2016 2:38 pm
by andrew
HCRTC.h https://github.com/dtu-mekatronik/HCRTC. (Library indicated in this forum) With this one I'm able to set the time , but when I read the hour I receive in output alway the same result (the settled value).
I attach the sketch, there is something wrong?
I assume that the seconds also do not change?

When using the HCRTC library what time and date do you actually read back out of the module? It may give a clue as to the problem.

Also, although you've posted in the Data logger shield thread I assume it is not actually this product but something else? Is it defiantly using a DS1307 for the RTC?