Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: claesson92 on October 29, 2007, 10:17:32 AM
-
Hi, if it doesn't cost to much. I'm planning to buy an external crystal oscillator for my ATmega168 (for the 50$ robot). Where/How should i connect it. And wich type of external crystal oscillator can i use? How many Mhz? Anything else?
-
its a bit tricky at first . . .
http://www.societyofrobots.com/robotforum/index.php?topic=595.0
Double check me on this, but I think you can get a 20Mhz crystal for the ATmega8.
Then go to mouser.com and look up the datasheet of the crystal and it will tell you what capacitor values to get. Chances are it will be 22pF ceramic.
Then hook it all up like you see on the left side of this schematic:
(http://mercury.chem.pitt.edu/~sasha/LinuxFocus/common/images/article231/schematic.gif)
(note that this schematic is for a different AVR)
Note that you will have to change the servo timing in my $50 robot code.
-
OK, here is another diagram, its a lttile more easy to understand. Note: crystal diagram is shown for the ATMEGA8 but as you can see from the ATMEGA168 pin out, they have the same pin outs. From what iv read your supposed to use 4mhz crystal with 2 22pF decoupling capacitors.
-
If you're running at 5 V, the mega168 can support up to a 20 MHz external oscillator.
From the front page of the mega168 datasheet:
Speed Grade:
- ATmega48/88/168: 0 - 10 MHz @ 2.7 - 5.5V, 0 - 20 MHz @ 4.5 - 5.5 V
-
Unrelated noob question (sorry to interrupt):
Admin, on your schematic you have pin one reset connected to the VCC, making it normally high, and going to the reset pin on the programmer header.
Killtacularmods has it going just to the reset pin on the programmer header, making it normally low (?).
Im making the $50 robot, should I connect pin 1 to the regulated power or not?
-
That above schematic isn't mine, found it on the web . . .
So for the $50 robot, just use the schematic on my tutorial and you will be fine. I've had no problems with the way I did it . . . nor on the ATmega644 either . . .
I haven't read the datasheet about the reset pin, but have a look if you want more info . . . I'm definitely not an expert on it . . .
-
From the mega168/mega644 datasheets, it looks like the reset pin has an internal pullup resistor, meaning that you'd be ok leaving the pin connected to nothing but the programming header.
-
OK, Thanks!
-
Im adding an external oscillator to my "$50" Robot... actually so far it has cost about $130 but I am taking the Admin's advice and buying good quality parts because I am planing on this being more than just a hobby at some point. Anyway beside the point... I found the datasheet for the oscillator I bought and don't know If I am reading it correctly. It says
"Load Capacitance (CL) | 10 pF ~ Series (Customer Specified)"
I am taking that to mean that I need 2-10 pf caps or does that mean that the total capacitance for the portion of the circuit involving the oscillator should be 10 pF (2-5pF caps), if i use the 2nd schematic above? Also linking the actual PDF datasheet so all info is available. PDF attached in case link is invalid for som reason.
http://www.foxonline.com/pdfs/hc49slf.pdf (http://www.foxonline.com/pdfs/hc49slf.pdf)
I have the FOXSLF/200-20 model of Oscillator.
Other than that I would just like to say that the $50 Robot Tutorial is a great guide for beginners. Im not new to electronics, I'm an electronics tech for the US Army, but I am new to robotics even though I have been interested in them for as long as I can remember. It has really helped me get started with my first robot and it definitely will not be my last. Thanks.
-
Hi,
Please don't wake up that old threads, start a new one instead.
What you have is an X-tal, not an oscillator, which is a complete device with X-tal, oscillator and buffer in the same 4-pin module, outputting TTL-like clean pulses.
You should allways go with the lowest value caps that gives you a 100% stable startup of the oscillator (to get it as precise as possible) and since your PCB will have some capacitance, you need to find it empirically.
Usually you'll end up with between 12pF and 22pF.
-
Sorry for waking up an old thread. In other forums that I have been on, people get "flamed" for starting new threads when there are already threads pertaining to the question that is being asked.
I only have a crystal oscillator. Its only a 2 pin module, and unless X-tals are really cheap (< $0.53 ea.) its probably not an X-tal. I am going to o with the 2-22pF caps according to the 2nd schematic above. I found references to that using different brands of crystals and it seems to be what the ATmega168 uses.
Thanks.
-
Hi,
No, you have an X-tal (crystal), which is a thin slice of quartz crystal suspended between two electrodes/holders.
An X-tal oscillator is a unit containing both an X-tal, an oscillator circuit and an output buffer.
Here is what an oscillator look like:
(http://www.wellgainelectronics.com/ProductImages/osc/SCC%20%20MCO8100%2025.000MHZ%20%20XTAL%20OSC%20W2.jpg)
Found at:
http://www.wellgainelectronics.com/index.asp?PageAction=VIEWPROD&ProdID=6182 (http://www.wellgainelectronics.com/index.asp?PageAction=VIEWPROD&ProdID=6182)
I know that discrete X-tals are often called oscillators but that's incorrect, as they have no means to oscillate without further circuitry.