Few questions

Hi I want to make a small device that tells me a few details. If i rebuild the orangutan mega8 robot controler on a breadboard, so that i can remove the components i dont want like motor controllers etc can i do that or do i need to take into account a certain something?

how do i access the onboard mega8 timers, so that when i press a button, then press the button again, it can time the time between the two presses (with milliseconds). Does anyone have a little example of this?

if i bought a smaller or larger lcd and wired it the same, would it work or do i have to take into account certain somethings?

This guy on this page rpi.edu/~kouttd/03/Rage_agai … duino.html gets a microcontroller to play music by converting the music to a text file. has any one done this, because is schematics are very bad, but i would love to do this.

he mentions using a flash drive to hold the songs, how can you access a flash drive from the mega8?

Sorry about ignorant questions


Lets tackle these questions one at a time:

You can set up an ATMega8 microcontroller on a breadboard. All the controller really needs to operated is 4.5V to 5.5V power (regulated is best) and a pull-up resistor of at least 4.7Kohm between the reset and power pins. You will also need to work out connecting your programmer to the proper pins. SparkFun has a good tutorial for doing this, using the similar ATMega16 microcontroller. The tutorial is split into parts on this page, under the heading “Beginning Embedded Electronics Tutorials”.

For more specific information on using the ATMega8, you should read Craig Limber’s (Climber) AVR Tutorial Page.

There several ways to do this. The simplest would be to poll the button, start a timer when it is first pressed, then stop the timer when it is pressed again. There are lots of things to take into account, like button debouncing, timer prescale value, and polling vs interrupting. If you want millisecond accuracy you will also probably need to count how often the timer overflows. Anyway, this is making it sound complicated when it’s actually not that hard. Rather than pointing you to a sample code that won’t really illustrate any of this I think you should definitely read Craig Limber’s Timers ROCK tutorial. He’s right, they do.

Most parallel character LDCs have the same interface, the HD44780 interface. They also commonly have the same 14 or 16 pin connector (LCD’s with LED back-lights will have two extra pins for power the LED power). Of course, individual modules may vary, so you should compare data sheets first.

That looks very neat. Jim Remington has a much simpler project here where he translates MIDI files and plays them on the Orangutan’s buzzer.

SD cards generally have a built-in SPI interface, which an ATMega8 can access directly, but direct implementation is quite complicated. To simply read/write an SD or Flash card, or a USB thumb drive, you can use a separate interface chip to handle the file system protocol. For example, you can read/write SD cards with this board from DOSonChip, or one of these [SD|uSD] from SparkFun. You can also access a USB thumb drive with this board from Parallax.

Good luck with whatever project you pick first!


hey nexisnet
thanks for reply.

instead of using the onboard timers, can i use an inverse delay that counts a delay rather than creats one. i need it in seconds though???

I had trouble understand climbers explanation of timers. they seem a bit complicated if all i want is the orangutan to display to the time between two clicks of a button on the lcd…

This is the kind of application timers are ideal for, and using timers really isn’t that complicated. Still, if you want an alternate approach, you can time things using a series of mini-delays. For example:

unsigned long time_ms = 0;
while (some condition is true)
time_ms += 10;

When I get out of the loop, time_ms will hold the amount of time that has passed in milliseconds, with a resolution of 10 ms. For this technique to work, the mini-delay period (in this case 10 ms) needs to be much longer than the time it will take to perform the rest of the operations in the loop. Additionally, this approach will monopolize 100% of your MCU’s processing power during the timing, so you won’t be able to do anything else. If you use hardware timers, you can generally go off and do other things while waiting for the time period to elapse.

- Ben