Thursday, May 31, 2012

Sparkfun Venus GPS and Arduino

I've just been playing with the Sparkfun Venus GPS module.

Very neat! It comes with more interfaces than you can shake a stick at, see the spec on the Sparkfun page. But I decided to use good old serial (or to be accurate the Software Serial library on the Arduino), so I just attached header pins to the RX0, TX0, 3.3V and GND connections and pushed it into some breadboard.

Upload the following sketch to your Arduino BEFORE making any connections. 5V from an IO pin left high on the Arduino may well kill the 3.3V output from the Tx pin on the GPS module.

#include <SoftwareSerial.h>

SoftwareSerial gpsSerial(10, 11); // RX, TX (TX not used)
const int sentenceSize = 80;

char sentence[sentenceSize];

void setup()
{
  Serial.begin(9600);
  gpsSerial.begin(9600);
}

void loop()
{
  static int i = 0;
  if (gpsSerial.available())
  {
    char ch = gpsSerial.read();
    if (ch != '\n' && i < sentenceSize)
    {
      sentence[i] = ch;
      i++;
    }
    else
    {
     sentence[i] = '\0';
     i = 0;
     displayGPS();
    }
  }
}

void displayGPS()
{
  char field[20];
  getField(field, 0);
  if (strcmp(field, "$GPRMC") == 0)
  {
    Serial.print("Lat: ");
    getField(field, 3);  // number
    Serial.print(field);
    getField(field, 4); // N/S
    Serial.print(field);
    
    Serial.print(" Long: ");
    getField(field, 5);  // number
    Serial.print(field);
    getField(field, 6);  // E/W
    Serial.println(field);
  }
}

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';
} 

Make the following connections
  • The red lead goes from 3.3V Arduino to 3.3V GPS Module
  • The blue lead, GND to GND
  • The yellow lead Arduino Pin 10 to TX0 on the GPS Module



Open the Serial Monitor and view your position!


There is a really useful resource here, on the Arduino Playground, that tells you all about the various fields that your GPS unit is sending.

About the Author
These are my books. Click on the image below to find out more about them.


Monday, May 28, 2012

Getting Started with .NET Gadgeteer

My book 'Getting Started with .NET Gadgeteer' has just started shipping - at least at Amazon.com.


Its a short book, designed to get you started and then lead you into a few projects, to explore some of the features of this interesting platform.

Here are some details of the projects. More information as well as downloads can be found at the books official website.



Spy Camera
This project uses the camera module to capture images peri- odically and save them to the SD card. The LCD touchscreen is used to set the recording interval of between 5 and 60 seconds.

Snowflakes Game
This is a simple game in which you guide a tongue back and forth across the screen in order to catch snowflakes that are falling from the sky.
The project uses the display and joystick modules included in the Fez Starter Kit.

Web Messenger
The Gadgeteer with an Ethernet module can be put to work as a small web server. In this project, the web server constantly serves the contents of the Gadgeteer screen. You can draw sketches on the screen with your finger or a stylus and leave messages for the world to see.
Camera Backup Gadget
This project  is intended for the digital camera user who, while travelling, might feel insecure about having all his or her precious photo- graphs on just one SD card that could become damaged or lost. Instead of copying the files to a laptop, this gadget will copy everything on an SD card to a USB flash drive.

Monday, May 21, 2012

Bay Area Maker Faire - Photographs

The Caltrain - double-decker and straight through the town like in a Western. This is in Redwood City where I stayed.


Pier 39 in San Francisco





I took the ferry to Angel Island and had a lovely day walking around the island.






Great views of Alcatraz and the Golden Gate Bridge
3D printers were arround in great numbers. Lots of different kits and ready made printers. These amazing figures one of the many amazing printings on display.




Cupcakes vs Dalek

Thats what I call a PC!

Super-sized Arduino for teaching





R2D2 Makers club



Massive Tessla Coils
Steampunk

Sunday, May 20, 2012

Eclipse Photos

I took these photographs at the Bay Area Maker Faire Earlier today.