Showing posts with label DIY Computing. Show all posts
Showing posts with label DIY Computing. Show all posts

Wednesday, May 5, 2010

Adventures with the EM406a GPS

I was going through my files and realized I never posted this series of videos that I shot while working with the EM406a Paralax GPS.




















The two codes that I talk about throughout are here:


Paralax Code:
/*
 Example code for connecting a Parallax GPS module to the Arduino
 Igor Gonzlez Martn. 05-04-2007
 English translation by djmatic 19-05-2007
 Listen for the $GPRMC string and extract the GPS location data from this.
 Display the result in the Arduino's serial monitor.
 */ 
 #include
 #include
 int ledPin = 13;                  // LED test pin
 int rxPin = 0;                    // RX PIN 
 int txPin = 1;                    // TX TX
 int byteGPS=-1;
 char linea[300] = "";
 char comandoGPR[7] = "$GPRMC";
 int cont=0;
 int bien=0;
 int conta=0;
 int indices[13];
 void setup() {
   pinMode(ledPin, OUTPUT);       // Initialize LED pin
   pinMode(rxPin, INPUT);
   pinMode(txPin, OUTPUT);
   Serial.begin(4800);
   for (int i=0;i<300;i++){       // Initialize a buffer for received data
     linea[i]=' ';
   }   
 }
 void loop() {
   digitalWrite(ledPin, HIGH);
   byteGPS=Serial.read();         // Read a byte of the serial port
   if (byteGPS == -1) {           // See if the port is empty yet
     delay(100); 
   } else {
     linea[conta]=byteGPS;        // If there is serial port data, it is put in the buffer
     conta++;                      
     Serial.print(byteGPS, BYTE); 
     if (byteGPS==13){            // If the received byte is = to 13, end of transmission
       digitalWrite(ledPin, LOW); 
       cont=0;
       bien=0;
       for (int i=1;i<7;i++){     // Verifies if the received command starts with $GPR
         if (linea[i]==comandoGPR[i-1]){
           bien++;
         }
       }
       if(bien==6){               // If yes, continue and process the data
         for (int i=0;i<300;i++){
           if (linea[i]==','){    // check for the position of the  "," separator
             indices[cont]=i;
             cont++;
           }
           if (linea[i]=='*'){    // ... and the "*"
             indices[12]=i;
             cont++;
           }
         }
         Serial.println("");      // ... and write to the serial port
         Serial.println("");
         Serial.println("---------------");
         for (int i=0;i<12;i++){
           switch(i){
             case 0 :Serial.print("Time in UTC (HhMmSs): ");break;
             case 1 :Serial.print("Status (A=OK,V=KO): ");break;
             case 2 :Serial.print("Latitude: ");break;
             case 3 :Serial.print("Direction (N/S): ");break;
             case 4 :Serial.print("Longitude: ");break;
             case 5 :Serial.print("Direction (E/W): ");break;
             case 6 :Serial.print("Velocity in knots: ");break;
             case 7 :Serial.print("Heading in degrees: ");break;
             case 8 :Serial.print("Date UTC (DdMmAa): ");break;
             case 9 :Serial.print("Magnetic degrees: ");break;
             case 10 :Serial.print("(E/W): ");break;
             case 11 :Serial.print("Mode: ");break;
             case 12 :Serial.print("Checksum: ");break;
           }
           for (int j=indices[i];j<(indices[i+1]-1);j++){
             Serial.print(linea[j+1]); 
           }
           Serial.println("");
         }
         Serial.println("---------------");
       }
       conta=0;                    // Reset the buffer
       for (int i=0;i<300;i++){    //  
         linea[i]=' ';             
       }                 
     }
   }
 }

Arduino Forums Code

//Created August 15 2006
//Heather Dewey-Hagborg
//reworked to GPS reader
//Dirk, december 2006
#include
#include
#define bit9600Delay 84
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94
byte rx = 6;
byte tx = 7;
byte SWval;
char dataformat[7] = "$GPRMC";
char messageline[80] = "";
int i= 0;
void setup() {
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
  digitalWrite(tx,HIGH);
  digitalWrite(13,HIGH); //turn on debugging LED
  SWprint('h');  //debugging hello
  SWprint('i');
  SWprint(10); //carriage return
  Serial.begin(9600);
}
void SWprint(int data)
{
  byte mask;
  //startbit
  digitalWrite(tx,LOW);
  delayMicroseconds(bit4800Delay);
  for (mask = 0x01; mask>0; mask <<= 1) {
    if (data & mask){ // choose bit
digitalWrite(tx,HIGH); // send 1
    }
    else{
digitalWrite(tx,LOW); // send 0
    }
    delayMicroseconds(bit4800Delay);
  }
  //stop bit
  digitalWrite(tx, HIGH);
  delayMicroseconds(bit4800Delay);
}
char SWread()
{
  byte val = 0;
  while (digitalRead(rx));
  //wait for start bit
  if (digitalRead(rx) == LOW) {
    delayMicroseconds(halfBit4800Delay);
    for (int offset = 0; offset < 8; offset++) {
delayMicroseconds(bit4800Delay);
val |= digitalRead(rx) << offset;
    }
    //wait for stop bit + extra
    delayMicroseconds(bit4800Delay);
    delayMicroseconds(bit4800Delay);
    return val;
  }
}
void char2string()
{
  i = 0;
  messageline[0] = SWread();
  if (messageline[0] == 36) //string starts with $
  {
    i++;
    messageline[i] = SWread();
    while(messageline[i] != 13 & i<80) //carriage return or max size
    {
i++;
messageline[i] = SWread();
    }
    messageline[i+1] = 0; //make end to string
  }
}
void loop()
{
  digitalWrite(13,HIGH);
 //only print string with the right dataformat
  char2string();
  if (strncmp(messageline, dataformat, 6) == 0 & i>4)
  {
    for (int i=0;i
    {
Serial.print(messageline[i], BYTE);
    }
  }
  //Serial.print(SWread(),BYTE); //use this to get all GPS output, comment out from char2string till here
}

This Blog was also invaluable! Many Thanks!
http://upuptothesky.blogspot.com/2009/04/gps-module-up-and-running.html

Saturday, April 10, 2010

Creating a Podcast or My Introduction to the H4 Handy Recorder by Zoom

On March 17th, I started writing the following blog post. At the time I was sitting on the couch in the NiCHE room on the first floor of the Social Science Centre at UWO like I have almost every Wednesday afternoon since January. I had just retrieved a box containing the H4 Handy Recorder, its various cords, power adapters, and a rather large navy blue and white manual. I was completely convinced that I needed to know all of the ins and outs of the recorder in order to do a good job recording and totally overwhelmed by that glued together mound of paper. The following passage is what came of that:
  As part of one of my interactive exhibit design projects I’m learning how to record a podcast. Specifically, how to record a podcast with the H4 Handy Recorder from Zoom. I think its going to be a lot of fun- once I finally get there. At the moment, however, I’ve barely hit page 12 of the manual and I’ve already encountered a concept that Zoom seems to think I should understand but I’ve never heard of. 
What on earth is the difference between on-mic and off-mic recording? As far as I can tell from the diagram I’ve been given it might be the difference between recording one instrument instead of the whole band. Another option is that it is the difference between recording instruments that are mic-ed or amped over acoustic. One way or the other I figure we’ll be recording our interviews between 30-50 cm from the mic. Next step, making sure it actually sounds good. The H4 Handy Recorder has A LOT of options. On the front there are the track buttons. Apparently this thing can record up to four tracks at a time and this would allow me to interact with the tracks on the recorder. I’m assuming this is to change the recording properties on each track though who knows I might correct myself before the end of this class. One way or the other I don’t need multitrack recording, so, its interesting but totally beyond my scope. There are also several indicator lights and a menu button with playback controls. For me, this may be all I need to worry about. I’m a little concerned however about the jog dial and the three gain switches.  I need to check what exactly mic gain is. On a positive note, it doesn’t matter what it is as long as I follow Zoom’s suggestion that I adjust gain so that the display reads just below zero. I’m assuming this means that the input will be loud enough.
There is an almost funny feeling of panic through that. I guess I was feeling a bit of pressure. I’d just scheduled my six classmates into 30 minute interview slots starting the following Friday and I didn’t know exactly what I was doing. 
Thankfully, recording my podcast was one of the easiest things I’ve done in awhile. Part of the ease I think came from the fact that my MacBook Pro comes, like most do, with iLife and GarageBand preinstalled and earlier in the semester I decided I wanted a section of the Fraggle Rock theme for my ringtone so I’d played a bit and was generally familiar with the program. The Handy Recorder is designed to not only function as a portable/handheld recorder but also it can be connected as a peripheral mic to a computer using a Digital Audio Workstation like GarageBand. Later on the evening of the 17th I was able to figure out how to connect the recorder to my computer by browsing the manual for a minute or two (its on page 80 if you’re looking) and then through trial and error managed to figure out how to use it with GarageBand. Over the course of the next week or so I recorded interviews ranging from nine to seventeen minutes long which I’m hoping to put up on my website after I’ve edited them- written a jingle (if I’m feeling creative though thats unlikely to happen this late in the semester) and added my own brief introduction to them. I’ll post as soon as they’re available.

Tuesday, February 9, 2010

At long last, the ideas!


I started thinking about my potential Interactive Exhibit Design projects after classes ended last semester. Right away I latched onto the idea of the problems of exhibiting oral history. I’ve always found that oral history exhibits and audio tours can make museum visits a very individual experience. Moreover, I have yet to find an audio guide that provides a seamless experience, most like the Metropolitan Museum of Arts WiFi mobile device formatted website require you to browse to the exhibit you’re interested in, enter an exhibit number, or plug a rented unit into a slot on the wall. My hope was to at least come up with a great idea for creating a seamless, group oral history experience. As yet I haven’t been able to come up with anything that I think could actually work, so I’ve moved on to a few more realistic projects. 
The first project that I want to complete after reading week (next week) is a google SketchUp model of a company house, probably from Glace Bay or New Waterford. It will depend on which I can find the most archival information on while I’m home in Nova Scotia for a few days and can visit NSARM. Worst case scenario I may be able to ask a friend of mine who is a volunteer firefighter in Glace Bay if he has access to the fire insurance plans. I’m mostly interested in this project because I want to learn how to use SketchUp as it is, from what I’ve heard, rapidly becoming an industry standard.
Another project I’ve been thinking about involves a gps enabled audio walking tour. I’d like to program an arduino with a gps shield and an attached mp3 player. The idea is to create a seamless audio tour based on the London Public Library’s Walking Guide to Historic Sites in London. I’ll need to learn arduino gps code and I’ll have to figure out how to connect an mp3 player to the arduino (if there isn’t already a shield for that I just haven’t found yet). I’d also like to eventually learn how to code for the iPhone or another smartphone to potentially make this a mobile app.
The final project I’d like to work on is the project that until recently I’ve been using to procrastinate on the rest of my projects. When we started playing with sensors in class I got it into my head that I’d like to design a wifi enabled sensor that would tell me when I need to fill my cats’ water dish. The project would involve a level sensor of some sort and a code that would, when the alarm on the sensor was tripped, email or tweet to let me know. For this project I’ll need to work with an arduino, a sensor, and a wifi shield. My father and I have talked about this project a bunch and we’ve got a pretty good idea of what sort of sensor I’d need, but I’ll talk about that in a later post.
Throughout all of this, I’m also considering doing some research probably on Nova Scotian labour/environmental history (perhaps the tar ponds and the Sydney Steel Plant) and I’d like to put together one or more podcasts with GarageBand. I very recently started playing with GarageBand making a ringtone and it was fun and relatively simple. I think it would  be really interesting to try recording and cutting together a podcast.
A final project I’ve considered and scrapped was a game that I wanted to eventually code for the iPhone. I scrapped the idea for two reasons, the first was that I wasn’t prepared to hand draw it or draw it in processing, the second, I was beginning to feel like I couldn’t adequately do the other ideas I had and I was much more interested in pursuing them.
I’ll post more details on the projects and where I am with them thus far as soon as possible. I’ll also be posting with more detail regarding some of the things we’ve done in class and some video we shot last week.

Interactive Exhibit Design: A First Foray

Part of my Interactive Exhibit Design (IED) class this semester is blogging about my ideas, projects, and progress. Up until now, I’ve been really hesitant to do that despite the fact that it is a course component. I’m not totally sure why I was so reluctant to blog but I think it probably had a lot to do with the fact that until very recently I really wasn’t sure what I wanted to do for my project(s) and the fact that I didn’t until perhaps two weeks ago feel all that confident in my skills and ability to actually make my ideas happen. It also probably helps that Dr. Turkel gave me the go ahead to actually finish the project I had been using to procrastinate. 

I think the most incredible thing about IED is the world that the class is opening for myself and my classmates. Things that we might not have ever thought about doing are approachable now. We can create virtual 3D landscapes, make a hockey game into an interface and make a t-shirt do something cool. We’re also learning what we can and cannot do ourselves (thought I’m still holding out hope for Objective C). We’ll know when we need to call in the professionals and when we’re the only professionals our employers need. Its exciting, uplifting and empowering! 
I’ll be following this post up with a description of the projects I’m interested in working on, including what I think I’ll need, what I need to learn, and what I think the final product might look like.