Archive for category Programming

Dot Matrix Clock: Display board assembly

Well, here it is. The moment I have been anticipating for a good while: The boards came in and I assembled them. I made a few videos and took a few pictures. I won’t post the videos yet since I am still going through them and making sure that I don’t go and make a fool of myself.

The boards unadultered

The boards unadultered

After soldering the MOSFETs and the column sink

After soldering the MOSFETs and the column sink

After soldering a few more column sinks

After soldering a few more column sinks

All the ICs soldered on the backside (and on the front, but you cant see that)

All the ICs soldered on the backside (and on the front, but you can't see that)

After soldering the diodes and resistors

After soldering the diodes and resistors

The completed back of the display board

The completed back of the display board

After getting that far, I believe my camera died. Anyways, I assembled the breakout board and completed all the parts of the display. I did not solder down all the display modules to the pcb because I am going to be fiddling around with the resistors on the column sinks and I didn’t want to have to desolder a display before being able to do anything else. The next day, I started testing:

The breadboard setup

The breadboard setup

As for testing and stuff, it mostly works. I made a few errors in both the hardware and the software, but I at least got the LEDs to turn on (I have not, however, gotten them to turn off properly…). My original program which should have been immediately portable to the hardware did not work so well and I ended up writing the entire display portion of the program in assembler: Apparently doing a variable bit shift on a 32 bit number takes up a very…long…time when compiled in C for the PIC18F. The main issue with the original program was that when I expanded the display size to 40×16 it suddenly had no refresh rate to speak of. This was mainly a product of the way I had organized memory. I had stuck the entire display into an array of long ints so that access to individual pixels could be done almost entirely by index. Sadly, when the size of the display was multiplied by 10 the computation of the bitmask began to take too long and made it impossible to properly refresh the rows. The assembly program I made to replace this organizes memory in the same fashion that I believe VGA cards organize the memory: Everything in one big long array which has no end-of-row designation and just wraps around when it is displayed. This ended up being much faster and hopefully it will work for the finished product.

As for the hardware problems, I have several. First of all, I made the primary mechanical engineering mestake when designing the package footprints: I didn’t factor in tolerances. All the through-hole parts BARELY fit. In fact, I have to coax everything in using a craft knife to get the pins lined up exactly before the part will even go in. The button pins are going to have to be sanded down since there is a taper to the pins that was not in the datasheet which makes the pins too large for the holes. The next big problem is that the column sinks are behaving very strangely. After the voltage into the LEDs passes above 3.3V or so some of the columns just stop sinking while others stay on. I have a few ideas to find out exactly what is going on here, but I have no real plan of action to fix that as of yet. My final problem is that I somehow managed to lift a pad when soldering down a resistor. How this happened I am not sure, but I think it has to do with cheap board construction and using a solder wik that is too big. I barely managed to find a trace to solder to, so it is kind of fragile even with the hot glue I used to secure the wirewrapping wire I used as a trace extender. The next time I do this I am putting a via in EVERY trace that runs into a pad, even if it doesn’t need one just for this sort of situation.

Anyway, aside from the mentioned problems the boards turned out pretty well. Olimex was fast and relatively polite. Their construction wasn’t too bad (aside from the pad, but that may have been mostly my fault) and the boards shipped right on time and arrived right on time (to the day, in fact). Overall I would say this whole board experience wasn’t bad and since it mostly worked I will say I didn’t waste my money.

1 Comment

What is this with premade stuff??

I was recently talking to a friend online after conferring with him about my dot matrix clock circuit board layout (now to rev. 3.4) when he mentioned that all people have to do nowadays to become a hardware “hacker” is to go buy an premade Arduino kit, attach it to some other premade piece of hardware, and load a premade program into it. More and more I have noticed this to be true. People no longer design and program their own stuff; they just buy something and say they hacked it together. Although I think having a standardized hardware to work with for embedded stuff like what I mainly do would be nice, I don’t see the fun in assembling and programming somebody else’s code into somebody else’s device. What is the novelty in that? Where is the learning?

Even with this trend I have seen a few other examples of people coming up with something cool using premade hardware. A good example is from my History of Creativity class I took my first two semesters at BYU. At the end of each semester each student had to create and present a “creativity project” which showed creativity at some level and related it to the class. My second semester, one person in the class made something that absolutely astounded me in its simplicity and how obvious it was to construct. He basically made a multitouch enabled touch screen using an LCD with the backing taken off, a bunch of infrared LEDs shining into a glass plate, and a camera with a remote control bezel over the lens. He hooked up the webcam to the computer and used open source software to interface it to his computer as a multitouch human interface device (HID). He said it cost him about $200 mainly because of the monitor he bought and cannibalized. I was impressed. I was so surprised I hadn’t thought of doing something like that. It’s things like that with premade stuff that I find awesome. I had never before seen a monitor like this and from what he said it was the cheapest yet from a quick look around on the web.

Now why would it bug me that people are using so much premade stuff? Well, it puts people like me who design their own custom boards and software without using very many ready made libraries or a premade circuit layout into the shadows. It really does. When I say something like “I built this…take a look…” people then ask “Oh, where did you buy that?” I never buy stuff and say I built it. I believe the only kit I have ever purchased was a solar racer from solarbotics when I was younger. Other than that everything I have made was from my own self. The only time I buy something is because I can’t make it for cheaper. People buying all this premade stuff kind of dulls the novelty of people using “custom” hardware on computers and the like. Its like what happened to CB radios: When everyone was on clogging up the channels the novelty was lost. Although I have never been into CB radios, I can see the point of that. Something is novel because its something few people do. When I first started with microcontrollers in 2005, very very few people I knew had experience with them. Now, its like everyone is buying their Arduino’s and sumo bot boards, programming them with some premade software, and setting them loose as their own creation. Of course, there are the people who go buy these things but then make up their own projects with them. I happen to know one person who has a sumobot that he made from premade boards that he installed a webcam on, programmed some interface software, and now has a person (or rather, bright colored object) seeking robot.

The only way in my mind that people redeem themselves from falling into the bandwagon of buy it yourself fake hacker stuff is by expanding it to fill another need. Innovation is what drives the world nowadays, not invention. The only people who can invent things now are people with clean rooms and lots of money. Since there aren’t many of those people in the world, the vast majority of us “normal” people have to suffice for innovation. Being in the United States, I would mainly refer to improving American innovation so that I can live in a country that has cooler innovations than other countries, but since the internet is a global audience its better to say that the world should be more innovative.

No Comments

Ghetto Chronometer

For once, I did something simple. I have always wanted to know how fast my potato gun shoots and I have also known how to find out, but I had never gotten around to actually building something to measure the speed of a moving object. I built this almost completely out of parts that are available at your local radio shack and hardware stores. The device consists of a 2″ PVC pipe with two sets of infrared diodes/detectors placed in holes spaced a foot apart which are connected to a PIC microcontroller that I have programmed to act as a “stopwatch” measuring in microseconds. Once a time is captured, the value is written to EEPROM for later gathering at the computer.

The Ghetto Chronometer. It looks rather like a pipe bomb doesn't it?

The Ghetto Chronometer. It looks rather like a pipe bomb doesn't it?

Parts List

I noticed while building this that I was using parts that were originally purchased on radioshack (aside from the microcontroller) and the home depot/ace hardware. Here is the list of parts with a few prices:

  • (2) Infrared Emitter/Detector sets ($3.49, radioshack)
  • (2) 330Ω 1/4W resistors ( $0.02 apiece if you get the 500 piece resistor set, otherwise $0.20 apiece in the 5-pack; radioshack). This value can be fudged just about anywhere as long as it doesn’t drop below 90Ω or so. The lower the value, the more chance of breaking the infrared emitters. The higher the value, the less light the emitters give off (which increases the chance for noise). Use the values on the back of the package to calculate the exact resistor value if you want a fully bright light. I think about 37Ω or so will push 150mA through it with a ~3V drop.
  • (1) ~470Ω 1/4W resistor. This is for the yellow and green LEDs
  • (2) 5mm (T1-3/4) LEDs, yellow and green. These can be picked up at radio shack for various prices depending what package you get them in.
  • (1) solderless breadboard (what I used) or those grid pcbs (both at radioshack)
  • (1) 7805 (5V) Regulator ($1.59, radioshack)
  • (1) PIC16F628A or a BasicStamp. The Basic Stamp is available at radio shack for an exorbitant price, but the PIC can be purchased for about $3 at most parts suppliers (look on octopart.com for prices). The programmer is not included in this estimate, but I built the programmer described in the WinPic manual for less than $20 (google it). I currently use a K128 USB Programmer.
  • (2) 4.7K 1/4W resistors, same story as the 330Ω except you shouldn’t adjust this one.
  • (2) >=100uF, <=500uF capacitors (radioshack again, not sure on price…depends what you get)
  • (1) 9V battery clip (radio shack. price depends on the type)
  • (1) 9V battery
  • 16″ of PVC pipe 1/2″ larger than your current barrel size (leaves clearence for the emitter/detectors)
  • Enough bushings to get the above PVC down to your barrel size for attachment (mine took two…stupid hardware store)
  • A PVC connector 1/2″ larger than your current barrel size for connecting the device to the bushings

Instructions

These instructions assume enough knowledge to construct a circuit on a breadboard from a schematic along with enough mechanical skill to saw and drill stuff.

  1. Attach (I would solder them, but you can twist and tape if you like) relatively long wires to the ends of each infrared emitter and detector. There should be two of each in total. Make the wires different colors per pin on each device so that they can be distinguished later. Make a note of where each wire went on the back of the package they came in which should have an internal diagram for each part if you got it at radio shack. Twist each pair of wires together so that each device has a long twisted pair of wires coming off of it.
  2. Heatshrink or tape each lead coming off of the emitters and detectors individually and then per device. This is so that no short circuits happen and so that the device is easier to insert and remove from the PVC.

    Chronometer Schematic

    Chronometer Schematic

  3. Assemble the circuit per the schematic. The schematic uses the PIC microcontroller, so it will have to be modified for a basic stamp.
  4. If you used the PIC, program the microcontroller with fps.hex in this file. I have also included the assembly listing for anyone who is interested
  5. In the 16″ length of PVC, drill two sets of holes directly across from each other 2″ from either end. They should end up a foot apart.
  6. Attach the bushings and connector to the PVC. Which ever end you attach these to is called “start” in the schematic. The projectile (potato) should travel from “start” to “stop”.
  7. Duct tape what ever you assembled the circuit on to the PVC in the fasion shown in the picture of the device above.
  8. Insert each emitter/detector set into the holes on the PVC. They should be lined up with an emitter on one side and a detector on the other. The potato will interrupt the beam of light going between the emitter and detector.
  9. If the device is going to be used outside, it might be good to put duct tape or electrical tape over the ends of the emitters/detectors so that no light leaks into the 16″ tube. Light leakage can cause considerable interference since the lights are not modulated in any way.
  10. Load your potato gun.
  11. Attach this to the end of your barrel and turn it on
  12. Fire. The green LED should light up if it caught the speed correctly, the yellow one will light up if there was an error.
  13. Read the microcontroller’s EEPROM. The time it took in microseconds for the potato to go one foot should be written in locations 0×03 and 0×04, most significant byte first. Use a hex->decimal converter to get the value, multiply it by 0.000001, and take the inverse. This is the FPS of your gun. Subsequent firings will be written in locations 0×05 & 0×06, 0×07 & 0×08, and so on. It should remember where it was last written between runs until you reprogram it or run out of space.

How it works

Overall its pretty simple: A potato interrupts the “start” beam which starts the 16-bit timer and it interrupts the “stop” beam a few microseconds later which stops the 16-bit timer. After the timer is stopped, the value of the timer (which also happens to be the number of microseconds between the start and stop pulses) is written to the internal EEPROM at the address specified in location 0×00. The green LED is then turned on and the microcontroller wants for the next “start” interruption. If there is an error (like the EEPROM not being able to write or the timer overflowing), the yellow LED lights up and the microcontroller waits for the next start pulse.

The microcontroller runs on the internal oscillator which gives 1MIPS. The 16-bit timer is connected to the internal oscillator with no prescaler so that it increments every microsecond (1MIPS = 0.000001 per instruction) when the timer is turned on. Since it is a 16-bit timer, it can time a maximum of 65535 microseconds or 0.065535 seconds. This gives a minimum speed of 15.26fps and a maximum speed of 1,000,000fps. I guess this could be used on a rifle, but I am pretty sure the emitter/detector pairs would have to be switched out with something with less lag time.

To test to see if the infrared emitters are even working try looking at them through a digital camera. A digital camera has better eyes than we do, so it can see infrared as a whitish/purpleish light. The emitters are rather narrow beam, so they will have to be pointing right at the camera to be visible. Oh, and if any part of this heats up, thats bad. Nothing on this should generate much heat, including the regulator. The whole thing should draw about 50mA with the parts listed above.

Things to add

Obviously, there are some things that could be done with this to make it even cooler. Some of my ideas:

  • Add an LCD screen that shows the milliseconds it took (or even fps)
  • Store the value in feet per second instead of milliseconds. I would have done this in the first plac, but I don’t feel like finding out how to do division like that in assembler.
  • Add a serial interface so that it can hook up to a computer and report its findings. I was originally going to do this, but I didn’t have enough 0.1uF capacitors for my MAX232 chip.
  • Something to prevent the wires coming off of the emitters/detectors from getting bent if the gun roles around.

No Comments

Eureka! The Dot Matrix Displays Work!

Running one display block

Running one display block with pixel 0,0 turned off

I have finally managed to get a dot matrix display running full bore without resorting to outrageous voltages such as 18V on 5V logic. I have been working towards this moment for probably 2 or 3 years now.

This uses a pinned version of the hardware described in previous posts and more or less proves that it will work with that hardware with few modifications. The only major difference is that I am not using the same chip for the LED current sink. In the picture on the right it is running at an input voltage of 6.37V@325mA which is regulated down to 5.26V and 4.78V.

One major deviation from the hardware mentioned previously is that the row decoder is running at a slightly higher voltage than the rest of the circuit (5.26V). This is to remedy a problem I noticed with the MOSFETs in which their gates are not fully turned on unless the gate voltage is above the drain voltage. What I ended up doing was running a 5.1V zener off of the input from my power supply to create a higher voltage than the 7805 supplies to the rest of the circuit (including the MOSFETs). This is marvelously ineffecient and seems to be causing the 7805 to heat up, but that also might be from the problem that I will go over next.

The other major deviation is how I am running the column sink driver. I ordered one that I thought was almost the exact same as the one I planned to use on the PCB, but doesn’t behave like the datasheet says it should. I ended up having to take away the external resistor and replace it with a direct short to ground. This effectively removed the current cap and now the chip is drawing 120mA by itself (which is bad). In contrast, the chip draws 20mA with a 300Ω resistor, but half of the rows get turned off. This in itself makes no sense since this is the column sink and for something like this to happen it would have to have something to do with the row drivers (i.e. the MOSFETs and accompanying logic), but it consistently shows up when I put a resistor on the resistor pin of the column sink chip. However, if a row starts flickering irregularly all I have to do is increase the input voltage a bit and it goes away. Any ideas as to why this would happen are appreciated (leave a comment).

From a coding standpoint I think I grossly overestimated how hard it would be to strobe this display. The chip is running at 12MIPS and so far is able to render an entire 40×16 buffer at 30fps with a ton of idle time. I have not yet implemented the grayscale dimming functionality, but even that won’t add much to the overhead. Looking at my scope I can see that out of the 584uS between rows only ~290uS is actually used for writing to the column sink and switching which row is turned on. This means that my “processor usage” slightly less than 50%. I was expecting it to be significantly more, but now I see that implementing the 8-bit parallel bus which will be the link between this and the “computer” board will be easier than I’d hoped.

3 Comments

The MCC18 built-in libraries

They suck. While waiting for my parts for the clock to come in I have been trying to get my WirelessUSB transmitter to communicate through the USART properly. I ended up discovering that it was having trouble syncing with the start and stop bits and was giving me a bunch of frame errors when receiving, but it had no problem transmitting. I was absolutely puzzled as to why this was happening and I asked around a few forums to see if anyone could shed some light on the subject. One forum (I can’t remember which one) said I should try controlling the USART “manually” without using the MCC18 libraries. To my great astonishment, it started echoing back and reading my characters properly without throwing any errors. Obviously, the MCC18 libraries don’t work right. I have had similar problems with the MSSP libraries, but I was unable to manually control it at the time because of my lack of experience with it (I could do it now). Basically, I now say: DON’T USE THE MCC18 LIBRARIES

No Comments

Revision two

After looking at my design of a few days back I decided it definately needed another revision. For one thing, I switced out the serial->parallel chips to a more common chip that I can get off of digikey (497-5746-1-ND) for $3.30 apiece which isn’t too bad (it’s not the best though…but it will save on shipping). I also got rid of most of that empty space that I was not using and managed to compress the entire thing so that it is as small as it can get unless I drastically change my design.

 

Dot Matrix revision 2

Dot Matrix revision 2

 Major Changes

As you yan see I have moved all of the chips underneath the displays. I had not done this before because I thought the autorouter wouldn’t be able to handle it and I would be left with 100 airwires to resolve. However, when I upgraded the chips the package size had to go up from SSOP to SOIC. This drastically reduced the complexity of routing and made it possible to fit everything beneath the displays. I was a bit sad about this change, but I could only find SOIC versions of the more popular chip (I enjoy soldering small chips because of bragging rights).

Another major change is the position of the mosfets. I have moved them from more or less a column into two “blocks” which are more or less symetrical. I had never thought of this before and it made the airwire ratnest much less dense in the long run with being able to position the column sink chips underneath the adjacent dot matrix module. The mosfets I am using are BSS138LT1GOSDKR-ND (say that 5 times fast) and are $0.58 apiece for 20 (they only way I could find them was on digireel, so the price changes with quantity).

The final major change was an error correction. I found that I had accidentally named all of my clock lines CLK. I have probably 4 different clocks and they were all connected together. I had to separate them and that pretty much broke the last design since I didn’t feel like layout out the board in exactly that pattern again.

Releasing my designs

I have decided that I am going to publicize my designs if anyone wants them. However, I will not be giving out the eagle files for my own reasons. Eventually I will export the schematic in JPG (I have to clean it up a bit) and I will include the board as gerber and excellon files. This could take time, so don’t expect them for a bit.

Fabrication

I am now thinking of how to get this board fabricated. I have found one company, olimex, who will do it for around $40 per board (no minimum quantity) which is really quite cheap. The also allow panelizing and will cut your boards for you if you want, so I might wait until I have the entire clock finished before sending it off for fabbing. The only problem so far is that my board is .3″ too wide for their smaller double sided panel. The upgrade is over $100 and adds about 6″ on every side to the space which I don’t need unless I decided to make two clocks and panelize all the parts into one board. Hopefully it isn’t too hard to get these fabricated since I kind of need them to be fabricated before I can do serious testing on my software.

No Comments

Resurrecting the Dot Matrix Clock

Man, I have been working on this project since probably 2006.  This is by far my longest lived project with about 4 different breadboarded prototypes, 2 or 3 different control schemes, 2 differnt types of displays, and 3 different microcontrollers designed for. I think I have settled on a final design and I do have to say that this clock is more like a computer than an actual clock.

Background

A few years back I saw a POV clock made using a PIC16F84 which I thought was pretty cool. The only drawback that I saw at the time was the fact that it depended on moving parts that made noise. I really wanted to make something like that, so I looked into Dot Matrix displays. At first they seemed really expensive and difficult to get, but I eventually learned that surplus sites and eBay had very cheap displays that I could get. I proposed the idea to my mom to see if she would pay for it and she agreed (to a reasonable limit). I expected the project to take 6 months to a year. I was  dead wrong. Getting a display to even be bright enough to see was a challange on its own, but eventually I learned enough about how to push LEDs to their limits that I could get a visible display running. Originally I used LPT747R displays, but these turned out to be too dim and even after pumping 18V through my 5V logic (resulting in the literal explosion of a hex inverter, but no damage to any of the other parts strangely) they were still barely visible under normal lighting. I discovered that even though LEDs may seem bright when powered constantly they are dimmed to about 1/16 of their original brightness when ran multiplexed. An added bonus of this is that you can pump about 16 times the amount of rated current through an LED (this reduces the LED life though…and if your display freezes those pixels are shot). The other brightness limiting factor is the maximum current driving capacity of the chips used to supply the current and to sink the current. Using standard 74HC logic didn’t work very well since they simply couldn’t supply enough current (this is probably why 18V didn’t blow up the LEDs…not enough current). It took a while, but I have been able to figure out how to drive enough current through the displays to get them to be bright enough (more on this later). Recently I switched over to some 8×8 dot matrices which have also increased visibility greatly.

The display uses an array of serial->parrallel shift registers driving (now sinking) the rows with either a multiplexor or mosfet array sinking (now driving) the rows. I now use a combination of a multiplexor and mosfet array to drive the rows. The entire system is controlled by a microcontroller (originally a 16F628A, but now an 18F4550). The microcontroller stores two entire screens in memory and displays one at a time. During the displaying process each row is clocked out to a chain of shift registers and once the entire row is out the registers shift their data out to some latches which turn on specific LEDs. The rows are controlled by the microcontroller in some fashion which has varied depending on the current mockup.

The current hardware

The current version of the Dot Matrix clock consists of two main boards: The display board and the controller board. As of this writing I have only completed the PCB layouts on the display board. An 18 pin connector connects the two board. Each board has a microcontroller on it with the display board having a PIC18F4550 and the controller board having either another 18F4550 or a PIC24HJsomethingorother (I haven’t decided yet). The displays are 10 8×8 displays arranged into a 5×2 pattern giving me 40×16 pixels to work with. I plan on having 4 brighness levels possible per pixel, but this depends heavily on the amount of memory I will be able to spare for display buffers on the microcontroller. The displays are column-cathode, row-anode so power is supplied to the rows.

The PCB layout as it stands now (and as it will probably look in the next revision more or less) is displayed below. There is quite a bit of unused space, so it is possible that I will upgrade to a 4 layer board and just put the entire clock on one board.

 

Layout as it stands now

Layout as it stands now

 

 

Row driving

Row driving is accomplished by using a 4->16 multiplexor switching 16 mosfets which drive each row. Each mosfet is rated at something around 200-400mA which should be more than enough to drive 40 LEDs at a 1/16th duty cycle at full current with all of them on. Current limiting is accomplished by the column driving/sinking chips and will be explained next.

Column Driving/Sinking

Current capacity was a big problem with my previous designs using the 74HC595 chips for column sinking. The chips could only sink so much current at once and would start limiting it at a certain point. This lead to unequal brighness and low visibility. I found a solution to this on one of the pages at this site. It showed a demonstration of a display using an MBI5027 shift register to sink columns. This shift register is capable of sinking 50mA per output pin and limits current by use of a set resistor on one of the pins. It also has short/open circuit fault detection. The only problem with this chip is that it isn’t very available. The only place I could find it was on this King Fish electronics or something like that. They used UPS for shipping which was a minimum of $10. I was not about to pay $10 shipping for a few $1 chips, so I put out a plea for help on one of the various forums I troll and got a response about this MAX6979 chip from Maxim-Dallas. It does the exact same thing as the MBI5027 and even adds a watchdog so that it blanks the display if serial input stops for over a second (could save my modules if my controller crashes). What’s more, it was only $0.26 more than the MBI chip and it was sampleable. I have not yet gotten this chip (I think it is in the mail) and I can’t wait to try it out.

The shift registers are arranged in a chain and data is entered rightmost pixel first. The previous row’s data is displayed even during clocking and isn’t replaced until an entire new row is ready.

The Software

As of yet I am not ready to release any of the software for this, but I will give the basics of its operation below. The software is mostly incomplete, but I have most of it thought out.

The Display

I have spent most of my time debugging the software for this. Until I got an oscilloscope this was very slow going and my code was very error prone. Even with an oscilloscope I tend to make mistakes like not blanking the previous row before turning on the next one (causes ghosting) or clocking out the data backwards. So far I have only experimented with going right to left, but as I write it has occured to me that arranging the shift registers in the opposite direction and outputting the data left to right would be easier on my mind (and would avoid having to flip my arrays). In either case, the basic sequence this uses to output a row is as follows:

  1. Clock out the new row with the rightmost bit first
  2. Turn off the row currently on off
  3. Shift all the new data into the latches on the shift registers
  4. Turn on the new row and repeat step 1 with the next row keeping this row turned on during step 1

Switching steps 3 and 4 causes slight ghosting and that was probably one of my larger mistakes when I was first writing the code a while back. The rows are stored as two arrays of 40 16-bit words using a row mask. Only one array is actually displayed at any given time and the array that is not being constructed with graphics data is being displayed. After the graphics array is constructed the active array switches and the opposite array is writen to. This prevents screen flicker, makes animation smoother, and allows for a constant framerate without fear of interrupting a write and getting something funky displayed for a frame or so. This is a commonly used technique that I first learned when programming BASIC with I was about 10 or so and applying it to this is not difficult as long as I have the memory.

Adding “color” to the pixels is one of the possible features of this. Instead of having each array be 40 16-bit words it will have 40 32-bit words. This doubles the memory requirement and starts to approach the memory limit of the 18F4550 (remember there are two arrays). The row displaying sequence will be quadrupled so that instead of displaying 16 rows it effectively displays 64 rows, 4 for each actual row. This shouldn’t reduce the overall brightness of the screen since all it does it add PWM to each individual row with 2-bit resolution giving 4 “colors”.

Data will be written to the display using an 8-bit master-slave parallel bus between the display board and the clock board. I have not yet come up with a control sequence, but the basic functionality will be like the Parellel Slave Port that I have seen on a few higher end microcontrollers. I am leaning toward something along the lines of the following for a control sequence:

  1. Master sends commands that specify where to start writing data and how much data will be written
  2. Master enters data mode and writes raw data to the bus. The address pointer is incremented with each byte sent
  3. After the specified number of data bytes the slave enters back into control mode
  4. The master can either issue more writing commands or send a “refresh” command that will switch which array is written to and display whatever data it has just written.

The program is going to be interrupt driven with the row displaying on a timer so that the framerate is constant. Switching arrays will only happen after an entire frame has been displayed, so there will have be a few flags between the bus “process” and the display “process” to facilitate this. Hopefully the controller won’t be overwhelmed, but I plan on running at the full 12MIPS using the fastest crystal possible and the PLL. 

Obviously, most of this code is not yet written but I do have a good idea of what I have to write and after getting a hardware prototype working it sould be relatively easy to put this code in.

The Clock iteself

I haven’t even started writing the software for this, but it will be probably even more complex than the display software. I plan on using one of the 24HJ series of PIC microcontrollers to handle this to try and process as much as possible. Some features that this clock will definately have and I have already figured out are as follows:

  • Timekeeping using a RTC with a supercap as a backup power supply
  • Multiple alarms (maybe up to 32 or so?)
  • Number changing animations
  • Menu system

Other possible features that I could add given enough time:

  • Multiple fonts for numbers
  • Use an SD card with uncompressed WAV files on it to get alarm “ringtones” (I have done something like this before, but never using an SD card or actual WAV files…only arrays of numbers)

Outlandish features that could only be added if my current programming experience is significantly increased:

  • Get and read RSS feeds using wifi
  • Sync a calandar with a computer wirelessly
  • Who knows…

Conclusion

As always, do not take my ideas without asking me first or crediting me somehow. Feel free to use this as a resource for your own projects, but if I see an exact duplicate of my clock out there somewhere that I didn’t know about previously it could be bad. The point of this clock is to be unique, so if you end up making a clock based off of information you found here then try to make it unique enough so that it could be distinguished from mine easily.

I am not sure how often I will be able to actually work on this clock, but I will post updates when I reach milestones and such.

No Comments