About Me

Showing posts with label ATmega8. Show all posts
Showing posts with label ATmega8. Show all posts

Tuesday, November 25, 2008

Dumb ATmega8 project

Finally finished the ATmega8 library.  Has API to use a 7-segment LED, pins, PWM, 2-bit flip flop, timers and some other random stuff.  The code size is pretty big though.  Not sure how to optimise the size away without losing the abstraction.  So for the final Alkali programme, it's able to detect light pulses with a reverse biased LED.  Depending on the length of the pulse, it will generate one of three events.  These three events will be "reacted" on by setting the speed of the fan and writing one data bit to the 2-bit flip flop.  The fan has three speeds; maximum, medium and off.  There's an LED that blinks on and off at close to 1 second intervals.  There is an LED that indicates the persistence of a light pulse and its indication will also persist.  The output of the tachometer of the fan is connected to a couple of external interrupt pins and these are used to turn the decimal point of the 7-segment LED on and off.

So yeah, a pretty dumb project . . .

Monday, November 24, 2008

Dumb ATmega8 project, Open Flash Chart

Had some problems with reading in the tachometer output through a couple of external interrupt pins.  It seemed that every time the fan turned on, the "latency" light would turn on.  If it wasn't doing that, it the fan would turn off after a while.  I couldn't really figure out why it was doing this because the timers must have stopped working or the wireless sensor was being triggered automatically.  Eventually I found a remedy.  It was to increase the prescaler for the PWM timer.  I was using a prescale of 1 which may have been too fast and caused the interrupts to fight over each other.  I tried to get some meaningful output written to the 7-segment display but because of the distortion of the tachometer by the PWM, the numbers didn't really make sense.

I finally made changes to the Python library for Open Flash Chart.  Each graph variety class has its own "set" functions to properties that are fairly unique to other graphs.  This means you can change the properties after creating the graph dictionary.

Sunday, November 23, 2008

Dumb ATmega8 project, Open Flash Chart

I've got the tachometer fan being driven by an n-channel MOSFET.  Was done pretty easily.  Vcc is around 7V and the input voltage is either 5V or 0V.  The MOSFET seems to be fully forward conducting at 5V so that's good.  Right now, I have the fan turning on and off every time the wireless / light sensor detects a light event.  So, that's pretty dumb so it fits with the whole theme of the project.  I'm going to try and work on this tachometer thing.  The third year electronic design paper involved using a three pinned tachometer fan so I'm basically going to be doing their project.  Hopefully it'll be easy.

Going to work a little more on the Open Flash Chart Python API as well.

Thursday, November 20, 2008

|-| @< |< ! |\| 7 0 5 |-|, ATmega8, Photoshopping

Managed to update to the 5th release.  Was easier than I expected because last time I borked the installation.  Just had to make sure a file was deleted and to change one line of the start up script.  Still stuck with VESA 3.0 video.  Still can't get it past the max resolution.  Got wireless so that's good enough for me.  One thing that does bother me is that I have to reduce the allocation of shared graphics memory (Intel 3100 GMA) for it to boot through.  But if I do that, then Vista falls back to the "basic" window manager.  Meh.

I did some more improvements to my ATmega8 library.  The wireless / light sensor now reacts to any pulses of light.  Whenever the light is de-asserted the counter will increment.  Basically I have a function / method for detecting positive edges (sensor is active low).  I also added a reaction to the length of time that the wireless sensor is asserted.  When the period exceeds a threshold, a status light is asserted and remains asserted until the wireless sensor does not detect the light anymore.  I managed salvage the Intel Pentium !!! CPU from the old Compaq desktop.  It's a Coppermine revision.  I also took the fan and heat sink used to cool the CPU and I've now attached it to my dumb ATmega8 project.  It's got three inputs; ground, Vcc and a tachometer output.  Since it's only a three terminal fan, the tachometer output is distorted for any PWM input signal.  Basically the ideal tachometer output is AND-ed with the input PWM since the tachometer will output a low whenever the PWM is low regardless of whether the tachometer should be outputting a high or low; Tachometer output = (Ideal tachometer output) AND (PWM).  I have yet to write a library for abstracting the tachometer output and PWM output and control.

Started photoshopping some cards today.  Got a birthday card and two good-bye cards to make.  I'm having a photoshopping block.  I've run out of ideas for making good-bye cards.  Getting harder and harder each year because you can't exactly give someone a card they've seen before . . .

Wednesday, November 12, 2008

The start of a dumb ATmega8 project

I've continued to extend my C code for my ATmega8. It now does more than count from 0x00 to 0x0F. Every time it counting overflows, the speed of the counting gets changed. All this is done using my fancy time struct and functions. I've implemented "optical wireless communication" using a single LED as the receiver. It's very crude but works. I've got it to reset the counting every time light is shone on it. Hopefully I'll be able to make an "event based" controller. So I'll have it recognise light patterns and act on them. Wonder if I can use some sort of software exceptions (interrupts produced by running code). Code size is getting too big though for what seems to be a small amount of functionality. I shall document my System library later on.



Tuesday, November 11, 2008

AVR ATmega8 madness

Now that I've finished writing the Python API for Open Flash Chart 2, I decided to start working on some ATmega8 coding.  Got a free ATmega8 a while back so I decided to put it into use.  I found a seven segment LED display so I ended up making a simple one digit hex counter. I should really use a 3-bit decoder to address my LED display.  Taking too many ports up.  I'm using the decimal point as a blinking indicator so show that my timer is actually ticking.  I'm writing in C and I've started making my own "System" libraries.  I've got a timer struct and a single digit seven segment driver.  I also have an 2-bit Flip-Flop but I haven't got any plans to use it right now.  Might use it as a 2-bit memory storage device?  That would be silly though.