Sunday, March 20, 2011

Arduino and GPS

I found a a cheap GPS module from a finnish electronics dealer, Partco, for only 10€. It's a bit old, from 2004 but whatever, it's cheap :) It's a Fastrax uPatch100 with a Sony chipset (CXA3355 and CXD2956). There are four different models, but the only one available is the -C9 with CMOS level serial output. Acctually that is perfect as the Arduino as you can plug it directly into the arduino (well, almost, TX can, RX needs a level conversion as the Arduino I/O pins are 5v).

I did it :)
The module outputs plain NMEA so it's easy to parse. You can also talk to it and set different parameters. Datasheets are available on the net, just google for uPatch100 and you should find them.

Anyway, I'm not very experienced with electronics but I've done my fair share of soldering, but mainly easy stuff like making my own RCA or RS-232 cables. Or easy "high" pitch breadboard.

The pitch of the device was a bit scary at first, but I was able to solder a ribbon cable just fine after some careful soldering.

I used a long flat cable and a IDC for easy attaching for any GPS project. I didn't have a female IDC connector so it cut one from an old motherboard serial port adapter and soldered that to a breadboard. And on the breadboard a pin strip for easy plugging to a solderless breadboard.
I made a very simple arduino sketch to read the serial TXD0 port from the module and output it to the serial port. I used the softserial library and first thought it was the reason for the problem I had. Only the first couple of NMEA messages came trough succesfully and then output stopped. The datasheet mentions for the RS-232 level module that "RXD0 line must be electrically connected in the uPatch100-Rx versions even if it is not used!"
My module was not the -Rx version but I connected RXD0 to ground and that fixed my problems. Clear NMEA messages startet coming!


Next is to make something fun with all this :)

Sunday, March 13, 2011

Deciding on vacation destination and mapping the destination

Me and my gf finally decided where to go this summer, first the country and the final destination. We where to Parga, a nice little village in Greece, last summer and fell in love with greece. Friendly people, very good and cheap food, especially the sea food.

So, it was easy to decide on Greece for the country this year too. Then to pick the destination. After looking around in various (finnish) travel agencies we found Limnos (or Lemnos) (Λήμνος). Aurinkomatkat had a cheap 2 week package, but when we finally had decided, it had gone. But who cares about packages... so we just booked the flights EFHK-LGAV-LGLM-LGAV-EFHK from blue1 and now we are looking for somekind of hotel.

Anyway, I beeing an openstreetmapper (and semi-active geocacher) checked out the map of Limnos.. google maps sucks, bing sucks and openstreetmap sucked, but not anymore ! Thanks to the Bing satellite images available I've been tracing roads couple of hours per day now for almost month and it's starting to look like something now.

My target is to have every single road that I can see from the satellite images drawn before going, so I have about 3.5 months time to do it :)

Unfortunately there are only on geocache on the whole island.

Arduino and a 16x1 LCD (Displaytech 161A)

Got myself an Arduino last year, unfortunately I didn't have time to get into it that much yet, but I started playing with my LCD display today. You would imagine that the LiquidCrystal library would take care of the 16x1 display but no, it needs a bit on tweaking as you have to address it like a 8x2 display.
Below is my very simple serial monitor testing code. It will just take whatever comes in from the serial line and write it to the display and wrap to the beginning every 16 character.

/* Testing code for using a 16x1 LCD display with Arduino LiquidCrystal library.

   LCD used is a Displaytech 161A 16x1 display.

  See this page for an explanation how it works (161A is a "Type-1"):
  http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html
*/

#include 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int c=0;
int r=0;

void setup(){
  lcd.begin(8, 2);
  Serial.begin(9600);
  lcd.clear();
  lcd.cursor();
}

void loop()
{
  int i=0;
  if (Serial.available()) {
    while (Serial.available() > 0) {
      i=Serial.read();
      if (i==-1)
        break; 
      lcd.write(i);
      c++;
      if (c==8) {
       r=(r==1 ? 0 : 1);
       c=0;
       lcd.setCursor(c,r);
      }
      Serial.print(c);
      Serial.print("\t");
      Serial.print(r);
      Serial.println("
      ");
    }
  }
}