I'm facing a serious problem in making the Sirf Star iii EM-408 GPS work, it outputs for me some weird characters on the serial screen, I'm sure about my baud rate and here's the code that my GPS is working on:
knut_ny:
speed problem.
Try change GPS speed to 9600
Serial windows speed is set according to "serial.begin"
Remove word "byte" when printing
Unfortunately, it still didn't help. Btw, I can't remove "byte", because it outputs for me the data, even though, I tried removing the byte and it didn't output for me anything. I've also tried increasing the GPS's speed and it didn't help at all, 4800 seems just fine.
michinyon:
Your loop( ) function looks wrong to me. Shouldn't you be checking if a serial input char is "available", before reading one ?
Is this's what you mean ??.
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == '\n') {
stringComplete = true;
}
}
}
If so, do you suggest putting it in the main loop or put it in a function and refer to it from the main loop ?!!.
I've read something interesting in the GPS's datasheet, but I didn't fully understand it, and the solution could be there. It says explaining the RX: "When not in use this pin must be kept “HIGH” for operation.". I couldn't understand what they mean by "HIGH" as I haven't pinned anything to my RX on the arduino board.
Here's the link for it's datasheet: http://www.usglobalsat.com/store/download/47/em408_ug.pdf.
So, do I need the RX in my wiring based on what's explained in the datasheet ??. And, is it necessary to use RX in order to get the readings or is TX just enough for it ?!!.
The data sheet is correct in that Rx needs a pull-up resistor. I would try a 10K unless you just happen to have that value of zener lying around.
The GPS module is a dedicated (likely masked) microcontroller in its own right. So, if you change anything from power-on defaults you must send a properly constructed command line back to that Rx lead... This interrupts the GPS to read the TTL serial data stream.
// minimum test code for serial gps
#include <SoftwareSerial.h>
SoftwareSerial gps(3,4); // RX, TX Connect GPS TX to pin 3 (UNO pin 4 - no need to be used)
void setup()
{
Serial.begin(115200); // faster than read GPS
gps.begin(4800); // may be 9600 or even faster
}
void loop()
{
if (gps.available()) Serial.write(gps.read());
}
SoftwareSerial gps(3,4); // RX, TX Connect GPS TX to pin 3 (UNO pin 4 - no need to be used)
void setup()
{
Serial.begin(115200); // faster than read GPS
gps.begin(4800); // may be 9600 or even faster
}
void loop()
{
if (gps.available()) Serial.write(gps.read());
}
Still, it's outputting the same strange characters !.
Before I go to the software part, I need to make sure of the physical part first so I could make sure that the problem is not from it !!. The GPS's manual says describing the RX: From Vcc connect a 470 Ohm resistor in series with a 3.2v Zener diode to Ground. Then, connect the Rx input to Zener’s cathode, so, I'm going to attach a photo and I want you guys to comment on it if there's anything wrong in it !.
The grey wire is the 5v or vcc, the white one is for the ground, and the purple one is for the TX.
Amazingly there are two versions of the EM-408 with the same part number. The standard version uses TTL voltage levels on its serial output (idle is 2.7V, the start bit and logic 0 are zero volts). The alternative uses RS-232 voltage levels and polarity (idle is -6.8V, the start bit and logic 0 are +6.8V).
The only way that you can tell the difference is by physically looking at the module. The TTL version has the shield extended over the connector as shown in the photo at the top of this page while the RS-232 version does not have this feature as shown in the photo on the right. The documentation only refers to the TTL version and when you are ordering one of these modules you have no idea of what one you are going to receive as the part numbers (EM-408) are the same.
It is incredible that a supplier would create such confusion in the market place and unfortunately their crime is compounded by the dreadful documentation that they supply. dx.com has a very cheap TTL/RS-232 converter board (link) that you can use to convert from one to the other.
There is also a later version on the market called EM-408E. It looks like the RS-232 version (without the extended shield) but what documentation is supplied claims that its output uses TTL voltage levels. I have not tested this version but it appears to have a few other differences including replacing the enable input with a battery backup input.
Amazingly there are two versions of the EM-408 with the same part number. The standard version uses TTL voltage levels on its serial output (idle is 2.7V, the start bit and logic 0 are zero volts). The alternative uses RS-232 voltage levels and polarity (idle is -6.8V, the start bit and logic 0 are +6.8V).
The only way that you can tell the difference is by physically looking at the module. The TTL version has the shield extended over the connector as shown in the photo at the top of this page while the RS-232 version does not have this feature as shown in the photo on the right. The documentation only refers to the TTL version and when you are ordering one of these modules you have no idea of what one you are going to receive as the part numbers (EM-408) are the same.
It is incredible that a supplier would create such confusion in the market place and unfortunately their crime is compounded by the dreadful documentation that they supply. dx.com has a very cheap TTL/RS-232 converter board (link) that you can use to convert from one to the other.
There is also a later version on the market called EM-408E. It looks like the RS-232 version (without the extended shield) but what documentation is supplied claims that its output uses TTL voltage levels. I have not tested this version but it appears to have a few other differences including replacing the enable input with a battery backup input.
Well, according to the link, my GPS is RS-232, and, according to the same link, this's what it says !!: "RS-232 Version Output
If you are connecting this version to a microcontroller you will need to use an interface chip like the MAX232 to convert the output to TTL levels and signaling polarity. An alternative is to clamp the output to +5V/0V using a resistor and diode then invert the serial data stream in software in the microcontroller.". But, is the arduino considered as a microcontroller, and therefore, I'll need the MAX232 ?!!.
Arduino is the board and GUI programming environment, Atmega328P is the microcontroller
If RS232 you will need the interface chip or you can search Google for discrete circuits to do similar.
I wish you had followed and read the link when I posted it... I really do not like to cut&paste from others blogs.
mrburnette: Arduino is the board and GUI programming environment, Atmega328P is the microcontroller
If RS232 you will need the interface chip or you can search Google for discrete circuits to do similar.
I wish you had followed and read the link when I posted it... I really do not like to cut&paste from others blogs.
Ray
Do you mean I need both microcontroller and Arduino ??. Or, just take the microcontroller and leave the arduino ?!!.
But, if you have an RS232 signal you must condition it before attaching it to the Arduino board (which subsequently connects it to the embedded microcontroller.)
mrburnette:
Arduino boards all have microcontrollers.
Arduino is not the microcontroller.
But, if you have an RS232 signal you must condition it before attaching it to the Arduino board (which subsequently connects it to the embedded microcontroller.)