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: , , ,

Tuesday, March 25, 2008

Panel Meter Clock (Part 2)


In order to make the panel meter faceplates read time instead of current I had to make a new set of scales for the three gauges. I started with the templates available on The Chronulator website (I particularly liked the VU meter as you can see in the photo). Since these are vector graphics images you can easily resize them without losing detail like you would in a bitmap image. I used a free conversion tool called FreeSVG to convert the files from PDF to SVG (Scalable Vector Graphics) format which can be read by the free, open source vector graphics editor Inkscape. Note: I believe that the new version of Inkscape will include the ability to open PDFs.

I used Inkscape to resize the faceplates to match the dimensions of the panel meters I had purchased (which were larger than the template). I also inverted the color scheme of the template since text on a white background is more visible than with a black background. I printed the new faceplates out on 4"x6" glossy photo paper (which really shows off the colors of the scale better than regular paper). After cutting out the new gauges with a razor blade, I then used rubber cement to glue each of the completed faceplates onto the original aluminum gauges. I allowed the finished gauges to dry overnight and they went on without issue.

This is an excellent project to get your feet wet with the Arduino, and it looks great too.

Labels: ,

Monday, March 24, 2008

Freeduino (Arduino Clone Kit)


The Freeduino is a great kit for those interested in the Arduino platform. It is essentially identical to the Arduino Diecimila, but made with through-hole components to allow for easy assembly as a kit. I assembled mine in about 30 minutes. Unlike my homebrew Arduino, the Freeduino shares the Arduino's form factor and therefore is interchangeable with the pre-assembled board (including compatibility with the various shield kits that are available for the Arduino). Another benefit of the Freeduino is that, due to its onboard female headers, it allows for prototyping without the use of a solderless breadboard.

Pictured above is a side-by-side comparison of the finished Freeduino kit (on the left) and my scratch built Arduino.

Labels: ,

Wednesday, March 12, 2008

Panel Meter Clock (Part 1)



There are several versions of this project, including one which can be purchased as a kit (The Chronulator). In this case I based it off of the one featured in Issue 13 of Make Magazine (original code and schematics). I liked this iteration as opposed to The Chronulator because not only can I easily build it from scratch using an Arduino board, it also has a seconds display

In order for panel meters to tell time the Arduino pulses three of its outputs according to what the clock demands. For example, if it is 6:45 the Arduino will pulse the hour meter output 50% of the time and the minutes meter output 75% of the time. The pulses occur so fast that the meters can't react in time, consequently it appears as if they are receiving a constant supply of current. Since the Arduino's outputs are 5VDC and the meters were chosen to read 1mA maximum, then a resistance of 5000 Ohms is necessary between the outputs and the meters. 5000 Ohms is not a standard resistor size so I used some parts I had lying around in my junk box, in this case 4700 Ohm resistors and 1000 Ohm potentiometers. The potentiometers allow you to adjust the total resistance of the circuit enabling you to set the peak value of the meter to the correct reading (1mA).

To finish the project I took an 8"x6"x3" plastic enclosure from Radioshack and cut holes in the lid to mount the meters. I also placed the mode, hour set, and minute set buttons on the top of the enclosure. To finish it off I added a power connector for a 9V power brick which will be the power supply for the clock (in the lower left corner of the circuit board you can see the power circuit consisting of a protection diode, a 5V regulator and 2 capacitors which together supply 5V to the Arduino from the incoming 9V supply).

Total cost was about $60 for my scratch built Arduino, 3 panel meters, pushbuttons and enclosure.

Update (3/27/08)
I discovered that the hour scale did not behave properly (it took longer than an hour to move the gauge 1 hour). I checked the code and found that the hour code was set to run on a 24 hour scale, while my hour gauge has a 12 hour scale. After editing the code to account for this difference (and adding some comments), the clock now runs properly.

Labels: ,

Monday, March 10, 2008

Arduino (Part 2)

Having never dealt with the Arduino's software package before, I wasn't sure what to expect. It is a simplistic Java application which provides a very user friendly environment to write your programs (or sketches as they are called) in. The programming syntax used is similar to C, but the environment has many useful functions already built in so it's very easy to do simple tasks such as set a pin as an output or toggle an output on & off. As someone who has used other languages, PICBasic for example, I can attest to how intuitive these functions are when compared to manually setting register ports in BASIC. Like in C you can also create your own functions and call them, making this a very powerful language despite its simplicity.

The installation of the Arduino software is fairly straightforward, even on Linux, and I encountered no issues. In Ubuntu it entails downloading the application from the Arduino Software page and following their well written instructions. These mainly involve installing Java and removing a package which inadvertently thinks the Arduino is a braille reading device and grabs your computer's USB port. Left out of the instructions is an issue which caused me some problems; the Arduino software should be run with root privileges in order to gain access to the USB port and consequently the Arduino board. This is done by opening the terminal and executing the following commands:

cd /home/username/Arduino-0010
(navigates to the Arduino software's folder)
sudo ./arduino
(runs the Arduino software script with root permissions)

The application will now launch. Once running I selected my board under Tools - Board - Arduino Diecimila (currently the newest board design and bootloader) and picked my USB port under Tools - Serial Port - /dev/ttyUSB0. Since I built my Arduino from scratch, my ATMega168 did not come pre-burned with the Arduino Diecimila bootloader. The bootloader functions as a sort of operating system for the microcontroller, allowing you to transfer files over a serial port instead of having to re-burn the entire firmware every time you change your program, thus simplifying the entire process. In order to burn the bootloader I plugged my AVR programmer into the 6 pin ISP header on the board and selected Tools - Burn Bootloader - w/ USBtinyISP. The software displays its progress on the bottom of the screen and lets you know when it has finished burning the file to the chip. To check if the bootloader is running properly follow this guide (since the various bootloaders behave differently). Next I wrote a simple LED flasher sketch and after plugging in the FTDI cable I successfully uploaded the sketch to the board and it ran perfectly.

Labels: , ,

Saturday, March 8, 2008

Arduino (Part 1)



If you have been following this blog at all you probably noticed that I have done a fair number of microcontroller projects. In my experience working with the PIC and AVR microcontrollers I ran into a number of issues:
  1. The PICBasic programming environment , while easy to learn, only works on Windows
  2. The C programming environment for the AVR requires more effort than I wish to put into a casual hobby enterprise and I have been unable to get it working in Linux
As I looked for more project ideas I noticed a lot of people using the Arduino development board. The Arduino is an open source hardware and software environment similar in concept to the BASIC Stamp (except it's not expensive). Basically all the Arduino does is provide a standardized microcontroller board using the AVR ATMega168 processor and various power, I/O, and programming connections. They can be purchased as a completed board for around $35 (several versions of unassembled kits are also available). The biggest advantage from my perspective is that the Arduino software is truly cross-platform since it runs in Java and therefore can be used in Windows, Mac OSX and most importantly for me Linux.

One version called the Bare Bones Arduino removes the standard USB-serial adapter from the board itself and instead substitutes a FTDI USB-serial cable to connect the board to your PC. This is done to minimize cost since the adapter cable is a one-time $20 dollar purchase that can be used with an infinite number of compatible boards instead of paying for the adapter chip on the standard Arduino every time you get a new board. Another version of the Arduino called the Boarduino modifies the form factor of the circuit board into one more convenient for use on a solderless breadboard. otherwise it is essentially the same as the Bare Bones Arduino in that it also uses the FTDI adapter cable. Both of these boards are completely interchangeable with the Arduino.

While these are good products, I decided I wanted to build my own version from scratch to better fit my electronics setup. I used the schematic from the Boarduino website to base my design on, but I used the same form factor as the Bare Bones Arduino. Since I use a Graymark 808 Protoboard which has a built in power supplies I removed the power circuitry from my design. In its place I simply put two headers, one for +5V and one for Gnd that connect to the protoboard's power supply (as shown in the pictures above). I also reduced the number of headers (which stab into the solderless breadboard) used to fit the Radio Shack PC board I used for my layout. I retained the power select jumper to choose whether the board is powered by the USB programming cable or the protoboard's power supply. I also left the two indication LEDs, reset button, and the 6 pin ISP and USB programming headers as they are on the Boarduino.

Total cost for my homebrew Arduino was $9 (not including the USB adapter cable).

Labels: ,