Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: Radiken on May 19, 2007, 11:11:19 PM
-
I designed my first schematic, and It would be nice to get it checked out from someone with experience before I start building...
http://aycu13.webshots.com/image/17492/2005621959605693018_rs.jpg
-
hi Radiken,
so the only thing i can see wrong is the lack of charge capacitors on the MAX232.
the MAX232 has to generate voltages in excess of VDD for communication with RS232 devices.
it does this using a charge pump and stores the power in capacitors.
there should be capacitors between pin 2 (V+) and VDD
and between pin 6 (V-) and VSS.
just to add confusion, the Eagle package you used to create your circuit diagram doesn't show you the actual connection to VSS and VDD.
it just presumes these exist.
all this is clearer if you just look at figure 5. here:
http://datasheets.maxim-ic.com/en/ds/MAX220-MAX249.pdf (http://datasheets.maxim-ic.com/en/ds/MAX220-MAX249.pdf)
the only other thing i might be concerned about is the maximum current provided by the MAX667. glancing at the datasheet, it's only rated up to 250mA.
from experience, it's always worth putting a voltage regulator on your circuitthat can provide as much current as possible.
one servo could draw 250mA when under load.
as long as you don't intend to run anything power hungry off this regulator you should be allright though.
dunk.
-
oops, i missed something obvious.
i don't theink the pic16f877 has an internal oscilator.
you are going to need a timing circuit.
(section 12.2 of the datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf (http://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf))
dunk.
-
I've never had to deal with oscillators until now,(As I said, this is my first board) so how do I figure what frequency of crystal to use? ???
-
You can use a ceramic resonator - if you buy one that has bulit-in capacitors, you only need the one component - they have three legs. You would connect each of the outer pins to one of pins 13 and 14, and the center pin to ground.
You can use any frequency you like, up to 20 MHz. I typically use 20 MHz on my PIC projects.
Digikey part# X909-ND would do the trick, and will cost 53 cents.
- Jon
-
Which is better: Ceramic or Crystal?
When hooking it up the the crystal, are any other electronic components needed, or is it just connected strait to the controller?
-
If you're using a crystal, you need two 18 pF capacitors. If you're using a ceramic resonator like the one I pointed out, you don't.
A crystal is more accurate than a resonator, but either is accurate enough unless you are dealing with very picky timing interfaces.
- Jon
-
Ok, I revised the schematic...
The only question is:
If servos are plugged into the unregulated V. ports, are they connected to the correct place on the PIC16F877?
(http://img513.imageshack.us/img513/1374/schematic3ax7.th.jpg) (http://img513.imageshack.us/my.php?image=schematic3ax7.jpg)
-
If servos are plugged into the unregulated V. ports, are they connected to the correct place on the PIC16F877?
yup. controll servos from PWM loops within their program so any I/O pin capable of digital output will do.
i don't think you have the right pins connected on your DB9 connector X1.
from memory, ground (VSS) should be connected to pin 5, RX to pin 2 and TX to pin 3. (check that though.)
i don't usually bother with hardware flow controll so i generaly only need these 3 pins.
the other thing you might think about, how are you going to program the AVR?
i like to put in a connector for an in circuit programmer.
dunk.
[edited to correct a typo in pin numbers.]
-
As far as I know, on the DB9 connector Tx goes to pin 2, Rx goes to pin3, Reset (Attn) goes to pin 4 and GND (VSS) goes to pin 5.
-
Ok, another revision has been made:
(http://img119.imageshack.us/img119/7784/schematic3oj3.th.jpg) (http://img119.imageshack.us/my.php?image=schematic3oj3.jpg)
I believe that the serial connector is correct now...
Dunk, what do you mean about programming the AVR? I was just planning on programming everything through the serial port... Or are you talking about programming something else?
-
I think Dunk had a hunch when he asked you how you will program the robot...
You need to program a bootloader into the microcontroller using an in circuit programmer before you can program it from the serial port. This is valid for PIC and AVR microcontrollers.
-
hmm... That is useful information I didn't know about.... :'(
oh well, luckily I found a PIC that comes preprogrammed with a bootloader! :D
http://www.junun.org/MarkIII/Info.jsp?item=12
I would appreciate one last look at my schematic, and If I get an ok, then I will start ordering parts...
Thanks for all of the help!
-
yea, there are a few different ways to program PICs.
when you first buy a blank PIC it will need programmed using a special programmer.
there are two general versions, the first you need to remove the chip from the circuit, pop it into the programmer, program it, then return to the circuit.
the other kind of programmer is an "in circuit" programmer. with this kind of programmer you run all the connections the programmer needs to a plug so when you want to program, just plug the programmer into your board.
(this is the method i was suggesting you go with but a bootloader may suit you better.)
the way you are currently intending to program your pic involves a bootloader program being installed first.
microcontrollers can actually write to the flash memory where their program is stored. bootloaders take advantage of this.
the bootloader takes anything it sees on the serial port at switch on time and stores it in program space. if it doesn't see anything on the serial port then it jumps to the program space and starts executing what it finds there.
if you end up doing a lot of work with PICs you will probably end up getting a dedicated programmer but for a first project the bootloader is the cheaper option.
good luck!
dunk.
-
Thanks for all the help, I'll start ordering the parts, and let everyone know when it's done! ;D
Thanks again!