Hello guys,
Recently I have a final project to develop digitizer for seismic DAQ using arduino uno.
I have some problems, first I should time stamped the adc data using gps and then send it through serial port.
I'm using Ublox Neo 6m gps, i has pps pin, and update rate can take about 10hz. So i guess it has cenctisecond resolution time.
My first scenario to do it is :
First I connect PPS pin to the digital input arduino, then if PPS signal is coming i take 100sample ADC and update the time and date from gps, then i mark the ADC data with time stamp, then send it through serial port .
My second alternate scenario :
First I take gps data at the first setup arduino program, and then in main void loop , I take the ADC data and also increment the datetime using micros() or millis() from arduino.
For thus two scenarios, which is possible to do ? Or maybe you guys have better option for me .
And the second question is, How to take sample at 100sps properly using arduino ?
I have two sketch to take adc data,
My first sketch to take sample from ADC is like this :
Recently I have a final project to develop digitizer for seismic DAQ using arduino uno.
I have some problems, first I should time stamped the adc data using gps and then send it through serial port.
I'm using Ublox Neo 6m gps, i has pps pin, and update rate can take about 10hz. So i guess it has cenctisecond resolution time.
My first scenario to do it is :
First I connect PPS pin to the digital input arduino, then if PPS signal is coming i take 100sample ADC and update the time and date from gps, then i mark the ADC data with time stamp, then send it through serial port .
My second alternate scenario :
First I take gps data at the first setup arduino program, and then in main void loop , I take the ADC data and also increment the datetime using micros() or millis() from arduino.
For thus two scenarios, which is possible to do ? Or maybe you guys have better option for me .
And the second question is, How to take sample at 100sps properly using arduino ?
I have two sketch to take adc data,
My first sketch to take sample from ADC is like this :
Unsigned long previous
Void setup()
{
Serial.begin(57600);
{
if (millis()-previous >=10) // take sample every 10ms or 100spd
{
previous = millis();
Serial.print(analog.Read(A0));
}
}
The second sketch is :
But when i tried the second sketch, it seems that the signal have some missing part or data,
Why the second sketch become like that, i saw that the first sketch and second sketch have some purpose to take 100 samples per second. ?
Thanks for your advice guys
Void setup()
{
Serial.begin(57600);
previous = 0;
Void loop (){
if (millis()-previous >=10) // take sample every 10ms or 100spd
{
previous = millis();
Serial.print(analog.Read(A0));
}
}
The second sketch is :
Unsigned long previous
Void setup()
{
Serial.begin(57600);
{
if (millis()-previous >=1000) // take 100 samples every 1 second
{
previous = millis();
Serial.print(analog.Read(A0));
}
}
When I tried the first sketch using 1hz sine wave signal, the signal is showed correctly, smooth,Void setup()
{
Serial.begin(57600);
previous = 0;
Void loop (){
if (millis()-previous >=1000) // take 100 samples every 1 second
{
previous = millis();
Serial.print(analog.Read(A0));
}
}
But when i tried the second sketch, it seems that the signal have some missing part or data,
Why the second sketch become like that, i saw that the first sketch and second sketch have some purpose to take 100 samples per second. ?
Thanks for your advice guys