Posts Tagged ‘pic’

LED Pocketwatch

Thursday, March 15th, 2007


Ok, first of all, let me make this clear. I am not giving up on the MP3 Player just yet. I’ve decided to work on a simpler project for a while and take a bit of a break from the MP3 player. I’ve had the idea to make this pocketwatch for quite a while, and finally decided to act on it.

Here’s the jist of the project. 12 RGB LEDs in a clock face (originally I wanted 60, but this proved to be technically not feasible) pattern. If you dont know what an RGB LED is, its basically three LEDs in one package that share a common cathode. With this, you can send three PWM signals to each colour and effectively achieve any colour you can come up with (which is practically limited to around 255 colours).

So my plan is basically this, each hand of a clock will be represented by a different colour. As the hands move and overlap, the colours will be added. When a hand is in between numbers, different shades of the colour will be used (for instance, there will be 5 shades that represent the minute hand. At 12:00, the uppermost LED will be lit fully. at 12:01, it will dim a bit and the 1:00 LED will light by the same amount. This progresses until at 12:05 the 12:00 LED is off and the 1:00 LED is on completely).

I have four major goals that I wish to accomplish with this project:

  1. First and foremost, I want to use this as a chance to design and implement a PCB. I think this PCB may be significantly simpler than my MP3 player, and is a good learning exercise.
  2. Similarily, I will use this as a chance to practice my surface mount soldering. I swear, I’m getting better. =)
  3. I want to finally get the damned MAX1675 DC-DC converter working. This thing has been causing me nothing but headaches, and I think I’ve figured out why. The silly inductor that is required to begin the resonation that increases the voltage is hard to come by. I’ve tried (and ordered) several different inductors and coils to test this with, none of which worked. Recently, I saw on a website another person using this device with an inductor that is nothing like the tiny ones I’ve been trying. It was a big obvious looking coil of wire. I’ve ordered some more inductors to play with, and I seriously hope I get this solved soon (for both the pocketwatch and the MP3 player).
  4. I will use this as a chance to test out a few little tricks and ideas that I’ve picked up here and there, such as testing in circuit serial programming, the behaviour of ground planes on my PCB (hopefully it behaves nicely), i2c devices (such as the real time clock), etc…

Anyway, thats enough ranting for now. I’ll post more on this later, when I’ve got something cool to show. My first step, is to get a prototype working on a breadboard. I’ve rigged up 9 of the LEDs so far in a grid pattern and hope to get the pic multiplexing different colours to them at a reasonable speed with enough power left to do things like calculate hand positions and read the RTC. Unfortunately the PIC only has 2 PWM channels, which means that I’ll have to come up with my own PWM channels and bit bang them (substantially slower, but it should still be adequate).

FAT Filesystem and Wirewrap

Monday, August 14th, 2006

Drag the circle around to see the other side of the board. Click outside of the circle to “flip” the board.
Progress has been booming the past couple of days (or weeks for that matter). I’ve finally gotten around to taking a couple more pictures of my new wirewrap version of the board (pictured above). As can be seen in the photo I’ve got my FAT driver to work for the most part. What you see is the LCD displaying the contents of the root directory on the SD card. When you click one of the two buttons, it displays the next entry in the directory, and the other button, “opens” the selected item (currently it can only open directories).

One achievement that I’ve had that I am quite proud of is support for long file names. You may recall back in the days of DOS and early versions of Windows, you could only have an 8 character filename and a 3 character extension with considerable restrictions on characters (must all be upper case, etc…) They added a bit of a hack to the standard to allow for longer filenames as used and loved by all of us today.

I thought I’d post a couple links to invaluable resources that I’ve found that detail the FAT filesystem (ordered by usefulness).

  1. Fat16 Structure Information
  2. File Allocation Table - Wikipedia
  3. Microsoft’s FAT32 File System Specification

On another note, I really should have researched the PIC16F877A more thouroughly before embarking on my adventure. In the datasheet, it says 368×8 bytes of Ram. I foolishly interpreted this as 2944 bytes of RAM. Upon closer inspection of the datasheet (the memory map region specifically), it turns out that it is actually just 368 bytes of ram. After running through the compiler and leaving space for its own scratch pad’s and temporary variables, I only have enough space left for a 64 byte buffer. After deciding to support long file names, I had to cut this in half so that I could have some room to store the long file names. Suffice it to say, that space is scarce and as such, performance is taking a hit (smaller buffer means more frequent memory calls). Because of this serious limitation I’ve decided to switch to the PIC18F4585 which is very simmilar except that it has around 4Kb of RAM and can run at 40Mhz.

Until my newly sampled PICs arrive, I’ll have to continue to suffer with memory management issues. I’m hoping for a serious speed increase when the new chip arrives (I’ll use a 512byte buffer instead of a 32byte buffer and will be able to store more information at once).