Pages: [1]   Go Down
Author Topic: Arduino BT with Parallax GPS module  (Read 590 times)
0 Members and 1 Guest are viewing this topic.
Greece
Offline Offline
Jr. Member
**
Karma: 0
Posts: 75
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Im using the ArduinoBT with the Parallax GPS module.





I'm powering the board with just one 1.5V battery at the moment.
I wrote a small program to test if I can read the NMEA strings. The program checks if I can get the first character of the NMEA string ( first character = smiley-money. The GreenLed (pin 13) will turn on when the first character of the string is $, otherwise the RedLed(pin 12) is on.

The code is below:

Code:
#include <ctype.h>
#include <string.h>

int ledPinRed = 12;            //Led-On = if I dont get the $ char
int ledPinGreen = 13;         //Led-On = If I get the $
int rxPin = 0;                    //Serial Communication Pin Rx (Receive)
int txPin = 1;                    //Serial Communication Pin Tx (Transmit)
char buffer;                  
int incomingByte=-1;        
char check='$';                 //The first Valid Char of  a NMEA string


void setup()
{
Serial.begin(4800);
pinMode(ledPinRed,OUTPUT);
pinMode(ledPinGreen,OUTPUT);
pinMode(rxPin,INPUT);
pinMode(txPin,OUTPUT);

}
void loop()
{
digitalWrite(ledPinRed, HIGH);
digitalWrite(ledPinGreen, LOW);
incomingByte=Serial.read();
if (incomingByte == -1){
  delay(100);
                        }
else{
  if(incomingByte == check){
    digitalWrite(ledPinRed, LOW);
    digitalWrite(ledPinGreen, HIGH);
    delay(5000);    
                           }
    }
}

Im new at this and I have a few questions:

First of all, is my code ok?

Do you think the 1.5V supply is the reason my gps module doesnt seem to work? The "low-battery" led on the board is always on.

Should I use the NewSoftSerial Library for the communication?

I wonder if the board can get serial data, in my code with the SerialRead function.
« Last Edit: May 09, 2009, 04:52:59 am by blank » Logged

Switzerland
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I cannot judge the quality of your code.
The board certainly communicates over the serial port.
Use the getting started Guide http://arduino.cc/en/Guide/ArduinoBT and you will be up and running over serial communication in no time.

Regarding the power, unless you haven't done so, pls refer to http://arduino.cc/en/Main/ArduinoBoardBluetooth.
To me 1.2V seems a bit low, add some juice as the GPS module needs some of it too. Maybe use a battery pack with 2-3 batteries providing 3V or 4.5V.

Good luck, Hans.
Logged

Dig-IT-all

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Blank,

I was wondering if you ever got this working? I am trying the same thing now. Thanks.

-Thomasbot
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 644
Posts: 50452
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You should use the Serial.available function to determine if there is data to read, before calling the read function.

You can also use Serial.print (and Serial.println) to print data to the Serial Monitor window, when the Arduino is connected to the computer, so that you can see all the data being read.
Logged

Pages: [1]   Go Up
Jump to: