Show Posts
Pages: 1 [2] 3 4 ... 97
16  Using Arduino / Project Guidance / Re: gaining accurate time on time sensitive measurements. on: April 11, 2014, 03:16:52 pm
I'm curious as to why you need to record from a pyranometer and anemometer at 20Hz. Seems fast to me.

For 20Hz, you could use the pulse-per-second signal from the GPS as an interrupt to give an accurate indication of the start of a second, take a reading,  and then use a blink-without-delay type of code to trigger the other 19 readings after that.

Pete
17  Using Arduino / Programming Questions / Re: array value changing mysteriously on: April 09, 2014, 09:42:45 am
This is suspect:
Code:
          for ( int y = 2; y <=22; y++ ) {
            letterstore [y] = buf [y];
letterstore is declared to be 22 characters but you are storing a value in letterstore[22] which is off the end of the array.
There may be other similar problems.

Pete
18  Using Arduino / Programming Questions / Re: String Array Not Working on: April 05, 2014, 09:55:45 pm
Strings are enclosed in double quotes "like this" - not with single quotes.

Pete
19  Using Arduino / Programming Questions / Re: Re-defining a string in array of string on: April 05, 2014, 05:41:02 pm
The problem is that strdup uses malloc to allocate space for the duplicate copy of the string. On a UNO, for example it has a total of 2kB ram which must have space for the stack and local variables. What's left over can be used by malloc but in less than 2kB it will rapidly run out of free memory and start returning NULL.

Pete
20  Using Arduino / Programming Questions / Re: Data type comparison on: April 05, 2014, 01:57:40 pm
You are just comparing the addresses of the strings, not their content. You can use strcmp which returns zero if the strings are equal:
Code:
  if(strcmp(sms_rx,ON) == 0) {
    // the strings are equal - ON
  } else if (strcmp(sms_rx,OFF) {
    // the strings are equal - OFF
  } else {
    // Neither string is matched
  }
Make sure that sms_rx is null-terminated and also beware of sms_rx having carriage-return and/or linefeed on the end.

Pete
21  Using Arduino / Programming Questions / Re: conversion to ppm for methane sensor on: April 04, 2014, 02:52:39 pm
The math looks right.
They might be able to get a better estimate of the high end of the range using a balloon. Put the sensor in the balloon and squeeze the balloon down around the sensor to get all the air out. Attach it to the gas outlet and partially fill the balloon with gas then take a reading. Needless to say - NO SMOKING smiley-twist
That ought to be very close to the top end. It'll probably be quite a bit higher than 690 but they can just plug the new value into the formula to derive k and away they go.

Pete
22  Using Arduino / Project Guidance / Re: GPS suggestions? on: April 03, 2014, 07:03:29 pm
In some circumstances, yes. It all depends upon which birds it was seeing when it was shutdown and which birds are visible when it is powered up again.
I have had my Adafruit Ultimate GPS sometimes obtain a lock after 10 seconds when it has been off for several hours - with external antenna connected.

Pete
23  Using Arduino / Project Guidance / Re: GPS suggestions? on: April 03, 2014, 11:18:09 am
AFAIK some GPS can do a fast start but they require an upload of an ephemeris of the satellites' orbit from a PC/mobile device. This update is available by subscription but I don't know how much they cost. Uploading the ephemeris means that the GPS receiver does not have to wait until it has downloaded the ephemeris from the satellites thereby speeding up the acquisition of the birds and locking on.
A battery backup, such as in the Adafruit Ultimate GPS, allows retention of the recently received ephemeris but it isn't accurate for very long and may not contain info on all possible satellites. When you start up the GPS a few minutes or hours later the data is still good and the GPS can fix very quickly. Once that data is out of date you have to wait again.

Pete
24  Using Arduino / Programming Questions / Re: Floating-point numbers on: April 01, 2014, 08:15:43 pm
Code:
Serial.println(myFloat,4);
etc.


Pete
25  Using Arduino / Programming Questions / Re: Bug with character arrays on: April 01, 2014, 08:10:45 pm
Looks like txt starts out like this:
txt[0] = '0';
txt[1] = 0;
txt[2] = '1';
txt[3] = '2';
txt[4] = 0;

Nothing wrong with the compiler at all.

Pete
26  Topics / Science and Measurement / Re: A/D converter on: April 01, 2014, 04:03:35 pm
Ohhh, I see what you mean now. Yup.

Pete
27  Topics / Science and Measurement / Re: A/D converter on: April 01, 2014, 01:17:30 pm
Yes, you would have to calibrate it to know what the fullscale voltage is and adjust the formula accordingly. If it can exceed that, I would submit it hasn't been engineered properly.

Pete
28  Topics / Science and Measurement / Re: A/D converter on: April 01, 2014, 12:33:16 pm
It depends what the formula is used for. The resolution is Vref/1024. But if what is needed is a fraction of full scale (0.0 to 1.0) then Vref/1023.  is appropriate.
For example, if Vref is 5V, then the resolution is 4.88mV per bit.
But if you want to convert an ADC reading to a voltage then you need (5*Vref)/1023. so that a reading of 1023 (full scale) gives you (5*1023)/1023. = 5V

Pete
29  Using Arduino / Programming Questions / Re: Weird little math problem on: March 31, 2014, 12:55:02 pm
Integer division truncates.

Pete
30  Using Arduino / Programming Questions / Re: Weird little math problem on: March 30, 2014, 09:43:32 pm
Code:
target_rpm = ((8000/1023)*potvalue) + 1000;
That's not a good solution because 8000/1023 is 7 so it reduces to 7*potvalue+1000
If you want better precision you have to do a long multiplication. I think this will do it:
Code:
target_rpm = ((8000L*potvalue)/1023 + 1000;

Pete
Pages: 1 [2] 3 4 ... 97