Show Posts
|
|
Pages: [1] 2
|
|
1
|
Using Arduino / Programming Questions / Re: Icomsat v1.1 Software Power On
|
on: May 02, 2013, 08:27:02 pm
|
Ignore me, worked it out. The data sheet says 400us, but I had to may my delay 600 and it worked. I just assumed I was way off track. int GSMOnPIN = 9;
void setup() { pinMode(GSMOnPIN, OUTPUT); // sets the digital pin as output Serial.begin(9600); }
void loop() { digitalWrite(GSMOnPIN, HIGH); // sets the GSM on delay(600); Serial.println("Its now High/On"); digitalWrite(GSMOnPIN, LOW); delay(10000); digitalWrite(GSMOnPIN, HIGH); // sets the GSM off delay(600); Serial.println("Its now High/Off"); digitalWrite(GSMOnPIN, LOW); delay(10000); }
|
|
|
|
|
4
|
Using Arduino / Programming Questions / Re: Serial Read of GPS Every Loop
|
on: April 16, 2013, 07:11:12 am
|
|
That link really helped understand Serial, thank you.
Maybe more background will help. In reality I only want to get GPS data every say 10 seconds. And when I get GPS, I also want to get other sensor data, and log it to a SD Card.
My plan was to use a 10 second delay at the end of the loop, then go around again and collect all readings, and record them. Should I be doing this in a different way?
thanks
|
|
|
|
|
5
|
Using Arduino / Programming Questions / Serial Read of GPS Every Loop
|
on: April 16, 2013, 04:51:58 am
|
I have the below code. I am trying to alter it to read the full 80 character sentence every Loop. I have tried lots of ways, but just cant seem to get it. Does anyone have any ideas please? Its from here: #include <SoftwareSerial.h>
SoftwareSerial gpsSerial(10, 11); // RX, TX (TX not used) const int sentenceSize = 80;
char sentence[sentenceSize];
void setup() { Serial.begin(115200); gpsSerial.begin(9600); }
void loop() { static int i = 0; if (gpsSerial.available()) { char ch = gpsSerial.read(); // Serial.print(ch); if (ch != '\n' && i < sentenceSize) { sentence[i] = ch; i++; } else { sentence[i] = '\0'; i = 0; displayGPS(); } } }
void displayGPS() { char field[80]; getField(field, 0); if (strcmp(field, "$GPRMC") == 0) { Serial.print("Time: "); getField(field, 1); // number Serial.print(field);
Serial.print(" Status: "); getField(field, 2); // number Serial.print(field); Serial.print(" Lat: "); getField(field, 3); // number Serial.print(field); Serial.print(" Lat Dir: "); getField(field, 4); // number Serial.print(field); Serial.print(" Long: "); getField(field, 5); // number Serial.print(field); Serial.print(" Long Dir: "); getField(field, 6); // number Serial.print(field); Serial.print(" Speed in knots: "); getField(field, 7); // number Serial.print(field); Serial.print(" Direction in Degrees: "); getField(field, 8); // number Serial.print(field); Serial.print(" Date in UTC [DdMdAa]: "); getField(field, 9); // number Serial.print(field); Serial.print(" Magnetic cariation: "); getField(field, 11); // number Serial.print(" Variation [E/W]: "); getField(field, 12); // number Serial.print(" Mode: "); getField(field, 13); // number Serial.print(field); Serial.println(); } }
void getField(char* buffer, int index) { int sentencePos = 0; int fieldPos = 0; int commaCount = 0; while (sentencePos < sentenceSize) { if (sentence[sentencePos] == ',') { commaCount ++; sentencePos ++; } if (commaCount == index) { buffer[fieldPos] = sentence[sentencePos]; fieldPos ++; } sentencePos ++; } buffer[fieldPos] = '\0'; }
|
|
|
|
|
10
|
Using Arduino / Project Guidance / Re: Uno Reference Voltage of 1.1v
|
on: January 18, 2013, 01:27:09 am
|
And my reference voltage is 2% out from 1.1v. The bandgap / 1.1V reference would no longer be involved. You can forget about it. The reference you would be working with is Vcc / 5V. Thanks. So in theory, if my VCC drops to 4.8v, I should multiply every value in A0-A5 by 1.041 to get its real value, assuming that item is a 5v item ? Is there a real way to test this? What if I get my 5v battery power source, measure VCC @ I assume 5v. Measure a 1.5v AA battery on A0. Then let the arduino power batteries go flat. When VCC gets to 4.8v, take a second reading from A0, and it should be 4% lower ? Maybe? How low can the source arduino power get before it will no longer function?
|
|
|
|
|
11
|
Using Arduino / Project Guidance / Re: Uno Reference Voltage of 1.1v
|
on: January 18, 2013, 12:47:18 am
|
Thanks for all your help. I actually have no idea how I started down this path. The main thing I want to do is log my voltage of my source batteries. As such, a Voltage Divider ( http://en.wikipedia.org/wiki/File:Resistive_divider.png = 2 resiters of the same value). Then send VOut to A0, and read the value, then double it. Sound right? Do I even need a reference value? But then, since I know the reference value now anyway. And my reference voltage is 2% out from 1.1v. As such, should I treat any value coming into A0 to A5 as being 2% too low? Its only 2%, I don't think I care that much as most of my connections are Digital anyway, and everything anyway seems to have different levels of accuracy. More curious now.
|
|
|
|
|
12
|
Using Arduino / Project Guidance / Re: Uno Reference Voltage of 1.1v
|
on: January 17, 2013, 09:16:09 pm
|
I have 4 x AA batteries connected to the barrel connector. And I have AREF connected to 5v. Aside from that I am running a SD Logger, so I can see the values. Here is my code: const long InternalReferenceVoltage = 1071L; // Change this to the reading from your internal voltage reference
void setup( void ) { Serial.begin( 115200 ); Serial.println( "\r\n\r\n" );
// REFS1 REFS0 --> 0 0 AREF, Internal Vref turned off // MUX3 MUX2 MUX1 MUX0 --> 1110 1.1V (VBG) ADMUX = (0<<REFS1) | (0<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0); }
void loop( void ) { int value;
// Start a conversion ADCSRA |= _BV( ADSC ); // Wait for it to complete while( ( (ADCSRA & (1<<ADSC)) != 0 ) );
// Scale the value value = (((InternalReferenceVoltage * 1023L) / ADC) + 5L) / 10L;
Serial.println( value ); delay( 1000 ); } Here is my output: ~350 is 4 x AA (5.28v on multimeter) connected to Barrel jack. 500 is USB connected from computer. 351 358 357 357 356 357 356 356
500 500 500 500 500 500 500 500 500
|
|
|
|
|
13
|
Using Arduino / Project Guidance / Re: Uno Reference Voltage of 1.1v
|
on: January 17, 2013, 08:29:34 pm
|
No my source is ~5v. My reference voltage is 1.071v So you'll be using the technique described in that post? Using the battery voltage as a reference to measure the 1.071V bandgap? Yes, it seems to be working. The value I am getting off my battery with a multimeter though is 5.28v, but the value I am getting using the second technique in that post is 3.53v (I get 5.0v if I power it off USB). Does that sound right? Basically, I am trying to accurately log battery level for my project. But as a side, I am trying to make sure my analogue values captured are accurate.
|
|
|
|
|
14
|
Using Arduino / Project Guidance / Re: Uno Reference Voltage of 1.1v
|
on: January 16, 2013, 11:02:05 pm
|
...hook up the Positive of my battery power source to A1, read the value, and get 97.36363636363636% of that value as the current voltage in my battery source? Your "battery power source" has a voltage less than 1.071? No my source is ~5v. My reference voltage is 1.071v
|
|
|
|
|
15
|
Using Arduino / Project Guidance / Re: Uno Reference Voltage of 1.1v
|
on: January 16, 2013, 09:51:34 pm
|
Follow up question: if my voltage is 1.071, and the system is expecting 1.1, does that mean I can hook up the Positive of my battery power source to A1, read the value, and get 97.36363636363636% of that value as the current voltage in my battery source? Or would I need to get 102.7077497665733% of it, to get the current battery source voltage. 2.7% is a fair amount to be out. Aside from the above example, where else would you use a value like this? I have a triply axis gyro/accel/temp in my project (connected to A4 and A5 - https://www.sparkfun.com/products/11028) does that mean I should expect my results there are 2.7% out also? Or is it even more complex than that, and I have to apply the 2.7% to the current battery volt. Check that against 5v (or 3.3v), and use that new ratio or 'something' against my values based on if my module is using 3.3v or 5v source from the arduino.
|
|
|
|
|