Sunday, May 4, 2008

GPS Receiver (minor revision)



In my previous post I brought up several ideas regarding how I wanted to upgrade my GPS receiver. After further investigation, most of my ideas are not practical for a variety of reasons. The PIC microcontroller I was planning on using does not support the math functions I would need to calculate directions and distances between waypoints. Even the saving of waypoints became far too complicated when I attempted to code it (due primarily to the way the GPS passes information). This was made even more difficult because the larger LCD I was planning on using would have required a much larger case than I wanted to use and thus was eliminated as well.

Long story short, the only change made to my GPS was its external appearance. This was accomplished by getting a new frontpanel and replacing the two slide switches with push-on-off switches, as you can see in the photo. The left button is for power and the right turns the LCD's backlight on and off. Since the backlight toggle is performed via a digital input on the PIC I had to modify the circuit slightly by adding a 1M ohm pull-down resistor to the digital input which the pushbutton wires to. This is required because in the previous version the single pole double throw slide switch would either connect the digital input to +5V or ground; since the circuit now uses a single pole single throw pushbutton it cannot perform this same functionality. Therefore, the pull-down resistor grounds the digital input when the switch is not on and then when the switch is turned on its resistance is so high that it is effectively an insulator to ground in comparison to the straight +5V from the power supply circuit.

As I mentioned previously I could most likely completely rebuild this project using the much more powerful Arduino and a larger LCD to accomplish my design goals. However, such an undertaking's cost would approach that of a commercially available GPS unit with considerably more functionality.

Labels: , ,

Monday, April 28, 2008

GPS Receiver Revision Ideas

In the seven months that I have been using my GPS Receiver I have been thinking about a lot of improvements I could make that could greatly improve the usability and power of the unit. The following is my wish list of improvements.
  1. Rechargeable battery - while running off of a standard 9V has its advantages; having a battery with more capacity, lighter weight, and smaller size(assuming I would use a Lithium-Polymer battery) would be very handy
  2. Ability to save GPS Waypoints - I had thought about this from the beginning of the project but was somewhat lazy and didn't look into it too much; now that I have used the unit for a few months I realize that adding this capability is a must
  3. Distance & Direction calculations between GPS Waypoints - this idea came about from doing the calculations by hand on a calculator which isnt' difficult but still a pain
  4. User Interface Upgrades - this aspect of the revision directly follows the ideas listed above, especially upgrading the display and adding a rudimentary menu structure to allow the saving of waypoints and performing calculations; I also want to change the backlight switch from a slide switch to a press and hold momentary pushbutton
Since I first developed this wish list I have done some analysis into what I would have to do to realize these upgrades. I considered the possibility of completely rebuilding the unit based around the Arduino, especially since I could upgrade the software via the USB port at any time. The arduino, however is somewhat overkill for this application (16K Flash & 512 bytes EEPROM) and is also a rather large board to fit into a small handheld device with an LCD and GPS receiver. The arduino does come in another form factor called the Arduino Mini. While this is much smaller, at $37 for the unit itself and another $20 for the USB adapter, it is a larger financial investment than I am willing to make for an upgrade of a device such as this (considering I already spent $100 on the current unit).

The rechargable battery has also turned out to be somewhat unfeasible. I did find a small LiPoly battery charger board for $17 and a 1100mAh LiPoly battery for $12 at Sparkfun. This isn't too much money, especially since a rechargeable battery pays for itself over time, but since the charger only works with single cell batteries (which only put out 3.7V) it is not compatible with a 5V system such as this and using multiple cells could get complicated.

After further research I realized that the PIC16F84A that I based the current unit off of contains 64 bytes of EEPROM which could be used to save waypoints. I recalled, however, that my current GPS program is running toward the limits of the PIC's 1024 word Flash memory. The solution to this problem comes from the fact that the PIC16F84A has been replaced by the PIC16F628A. The 16F628A is a pin-for-pin equivalent to the 16F84A so I can reuse my existing circuit board and simply program the new chip and drop it into the existing socket. The 16F628A has the added benefit of 2048 words of Flash and 128 bytes of EEPROM. This should allow the 16F628A to have enough program memory to implement my UI changes and the calculation options I would like to add as well as store up to 32 waypoints (4 bytes per waypoint). The best part is that I have a couple of these lying around so it costs me nothing. The only items I will have to purchase will be a larger LCD, a new case and a couple of switches.

Labels: , , ,

Sunday, February 10, 2008

Aqua Teen Hunger Force Animated LED Art




On January 31, 2007 Boston was shutdown when pieces of LED artwork that looked like characters from the Cartoon Network show Aqua Teen Hunger Force were mistaken for bombs. Ever since this occurred I have wanted to build my own version to hang up in my apartment.

My version is designed to look like the character Ignignokt; in case you don't watch the show Ignignokt and Err (his sidekick) are Mooninites (residents of the moon, designed to look like characters from an 8 bit video game) who occasionally come down to Earth to annoy the Aqua Teens. I chose Ignignokt because he is green and blue (Err is purple and blue) and green LEDs are cheaper than purple LEDs. My design used 72 green and 40 blue LEDs.

I got my LEDs from Mouser and I chose them based primarily on their diffusion angle (over 40 degrees), which allows for better viewing angles than other LEDs. In order for an LED array like this to function properly the LEDs must be wired in parallel (ie. all of the cathodes are connected together as well as all of the anodes). I also had to subdivide the LEDs into a group of all of the green LEDs (D6 on the schematic) and all of the blue LEDs (D5 on the schematic). This had to be done because the LEDs were different types and there were more greens than blues, causing the current draw of the groups to be unbalanced. This created a problem where only the green group would light, consequently, I adjusted the resistor values such that I balanced the current drawn by both LED groups. There are also four additional groups to create the effect of Ignignokt giving the finger. These groups are controlled by a PIC16F84A microcontroller which orchestrates the animation of the LEDs. As shown in the schematic, group D1 is the hand and groups D2-D4 are the finger. The code (written in PicBasic) is very simple, involving only turning on specific digital outputs of the PIC for set periods of time. I can power the whole thing off a 9 Volt battery using a power circuit similar to that shown in the schematic for my GPS project (I substituted a 78L05 for the 7805 voltage regulator since this circuit draws less current). Check out the video to see Ignignokt in action.
Parts:

video

Labels: , ,

Saturday, September 22, 2007

GPS Receiver (Part 2)




In the previous post I described how I prototyped my own GPS receiver. Since then I modified a small plastic enclosure to hold the LCD, GPS module and circuit board holding the PIC microcontroller and power circuit. I also added code (see link below) that checks for the state of a switch to determine if you wish to have the LCD's backlight on or off. I decided to add this feature after measuring the current draw of the receiver as a whole. With the backlight on, the receiver draws an average of 165mA; with the backlight off, the receiver draws an average of 125mA (that's about a 25% savings). Since the receiver runs off of a single 9 volt battery (alkaline - 600mAh typically), that power savings is equivalent to as much as 72 minutes of additional time the unit will now be able to run. With a lithium 9 volt (1200mAh - typically) it could add another 2 hours and 24 minutes.

The picture on the right shows the receiver as completed; I will be the first to say that it is not the most professional looking, but it works. The switch on the right is for power and the other switch is for the backlight. The center picture shows the 4 possible LCD states: searching with backlight off, searching with backlight on, receiving GPS data with backlight off, and receiving GPS data with backlight on. The last picture is the schematic for the receiver unit.

I did some research and here are some constants that show how useful this unit can be for many different functions.
  • 1 Degree = 60 Nautical Miles (69 Miles)
  • 1 Minute = 1 Nautical Mile (1.15 Miles)
  • 1 Second = 101.2 Feet
  • 0.1 Seconds = 10 Feet
With these relationships and some basic geometry, I can determine distances and directions to and from GPS way points.

This was a really satisfying project to do. With just a handful of parts and a couple of modules I have a fully functional and now portable GPS receiver.

Parts List:
  • LCD with backlight (2 lines, 16 characters per line)
  • Parallax GPS Module
  • PIC16F84A
  • 7805 (5 Volt Voltage Regulator)
  • 4700 Ohm Resistor
  • 4 MHz Crystal Oscillator
  • 100uF Electrolytic Capacitor
  • 0.1uF Ceramic Capacitor
  • 9 Volt Battery
  • SPST Switch (power)
  • SPDT Switch (backlight)

Labels: , ,

Sunday, September 16, 2007

GPS Receiver (Part 1)


If you have never been to the MAKE Magazine website you should really check it out. They have tons of project ideas on their site and more are posted every day on their project blog. In July I saw an article regarding a project that took a GPS module, a simple LCD display, a Basic Stamp to interface the two together, and created a GPS receiver. The receiver displays your coordinates in degrees, minutes, and seconds.

I was intrigued because for such a complex sounding project it appeared very straightforward and relatively inexpensive. Upon further digging I discovered that this project used a Basic Stamp 2 chip for a processor, along with a Basic Stamp Development Board and software; these together cost around $200, not including the cost for the LCD Display and GPS module (another $100).Then I remembered that the Basic Stamp is actually based off of and very similar to the PIC series of microcontrollers that I had previously worked with in college. After looking at the code provided on the project page, I decided that with a little effort I could convert it for use with a PIC (I used a PIC16F84A, but others can be used, they cost $6).

To program the chip I used the programmer
I had from college. Built from a kit, it is USB compatible and has a ZIF socket so you don't wear out the PIC's pins pulling it in and out of the socket while troubleshooting your projects. It is not the cheapest programmer available at $85. Many other programmers are available for much less money, or you can build your own. The last item necessary is a BASIC compiler for the PIC. While the Basic Stamp is also programmed using the BASIC computer language (hence the name), the PIC uses a slightly different version called PicBasic. The compiler I used is called PicBasic Pro ($250) which I had from college (there is a cheaper version called PicBasic Compiler for $100); I also found another compiler which offers a free demo. For me, since I already have all of the pieces I need for PIC development it was much cheaper ($6 vs $200) to use a PIC instead of a Basic Stamp. The casual hobbyist should decide which route they want to take since the Stamp ($200 to get started) offers a more user friendly path, while the PIC ($150-$300 to get started depending on programmer and compiler) offers more customization and more processing power.

It took me most of an afternoon to refresh my memory and convert the code from PBASIC to PicBasic. The photo above shows my version of a homebrew GPS receiver using a PIC as I prototyped it on my breadboard. The GPS module has an LED that flashes to show it is acquiring satellite signals (at least 3 are needed for valid GPS data) and is solid once enough connections have been made. Since I plan on putting this project in some sort of handheld enclosure, the LED will no longer be visible. To get around this I added some code which makes use of one of the built-in features of the GPS module. This feature will report back how many satellites have made connections with the module, when this value is below 3 the LCD displays the text "Searching for satellites...". When the value is above 3 the LCD displays the GPS location data. Overall this project was a lot of fun and a great refresher for me regarding PICs. In part 2 I'll talk about how I powered this project off of batteries, integrated it into an enclosure, and provide my final schematic and parts list.


Parts List:
Links:

Labels: , ,