May 23, 2011
I recently replaced my Holux GPSlim236 with a Holux M-1000, so I decided to work out how to connect the 236 to an Arduino.
Initially I pulled it apart and found the 7 test points on the left of the board. These turned out to be a serial interface, from top to bottom:
- ?
- Ground
- RTS
- CTS
- TXD
- RXD
- ? - maybe power in?
Connecting Ground to an Arduino ground, and TXD to a digital in gave a nice serial stream of data from the GPS
A bit for experimenting and research found that the serial data is also available via the USB port. Simply chopping off the end of a $2 mini USB cable and connecting the ground (black) wire to the Arduino ground and (green) wire to a digital in pin gave me exactly what I needed.
Also connecting the +5v wire (red) to 5v on the Arduino will power/charge the GPS. I didn't check the drain on this pin but I would be careful connecting this up with a flat battery as the charger may draw more current than the Arduino is able to safely supply.
So here's some code to get it working:
#include#include /* GPS */ #include "NewSoftSerial.h" #include "TinyGPS.h" NewSoftSerial gpsNSS(9, 0); TinyGPS gps; void setup() { /* Serial output */ Serial.begin(38400); Serial.println("Waiting for GPS"); /* Start GPS */ gpsNSS.begin(38400); } void loop() { while (gpsNSS.available()) { if (gps.encode(gpsNSS.read())) { float lat, lon, alt; unsigned long age; gps.f_get_position(&lat, &lon, &age); alt = gps.f_altitude(); /* Display new GPS data when we get it */ Serial.print("Lat: "); Serial.println(lat, 5); Serial.print("Lon: "); Serial.println(lon, 5); Serial.print("Alt: "); Serial.print(alt, 1); Serial.println("m"); } } }
Connect the GPS to Ground and Pin 9. Uses NewSoftSerial and TinyGPS libraries from Arduiniana
<< Blog < "Track View" Part 1 | New Website >