AVRProject Mega PCB

The Mega PCB is designed for the Atmel AT90S8535, Mega-16, and Mega-32 pinout microprocessors. These AVR Processors have Analog to Digital (ADC) ports, larger memories, and many other embedded functions such as serial ports, timer/capture/counters, analog comparators, interface/network methods, and EEPROM internal storage. The major effort in this Protoboard is to clean up the accuracy and noise on the ADCs.

Picture of Populated Mega PCB

This PCB facilitates those functions by providing:

Silkscreen Layout

Theory / Block Diagram

Power Supply configuration:

Power Input and Regulators

This power supply provides two features that reduce the noise that adversely effects the ADC converters. First, the Analog and Digital grounds are separated. The AVR Processor provides about 2 ohms of resistance between the two grounds. However, the uProc may be damaged if excessive voltage is applied across the two grounds. For this purpose. Shottky diodes D1 and D2 prevent more than .6V from happening between the grounds. Second noise reduction feature is U5 and U3 are identical 5V regulators capable of providing 100mA suitable for most CMOS based circuits. This keeps noise from digital operation from feeding back to the analog area. If more power is required, additional regulators may be placed in the prototype areas. D3 protects against incorrect polarity voltage being applied (battery installed backwards?). J11 is the 'Unregulated' DC supply input. It can be from batteries, 'wall wart' power pack, or bench supply. AC input is not recommended without additional filtering capacitors between D3 Cathode to DGND.

Analog to Digital Converter Interface:

ADC Inputs and Conditioning

Selection of resistor values and jumper settings allow the designer to choose the input voltage range and polarity for the desired ADC response. R4 is the Series resistor header (16 pin socket) and R1 is the Dropping (shunt) resistor header. The selection at J1 pins 1-2 sets the bias of ADC4-ADC7 to 5V for monitoring negative or bipolar voltages. Selecting J1 pins 2-3 sets the bias at GND for monitoring positive voltages. If monitoring power supplies or low impedance voltages, it's better to use lower resistance values (in the K ohms range) at R1 and R4 to cut down on RFI induced noise. Higher impedance signals like audio or instrument monitoring often has less drive capability. Using resistors above 22K ohm may start resulting in more jittering in the readings. Readings will get worse above 1Meg ohm. J7 pin 2 would connect to an external reference voltage, otherwise, the two pins at J7 are wired together to set the reference at 5V. J3 provides the 8 Analog inputs, with Analog 5V and Analog GND. The smaller prototype area is intended for analog circuits. There are two busses at the ends of the analog area that are uncommitted.

Conversion of reading to Display Voltage is as follows:

ADC ports A0-A3 and A4-A7 (jumper J1=2-3) Positive value only

Voltage = (reading/1024) * 5 * [(R1+R4)/R1]

ADC Ports A4-A7 (jumper J1=1-2) Bipolar Voltage value gives + or - result

Voltage = [(1023-reading)/1024] * (-5) * [(R1+R4)/R1] + 5

Choose resistor values that will not exceed their wattage value at max voltage. Choose resistor values that will not place excessive load on analog power supply if jumper J1 is in the 1-2 position.

 

LCD Interface:

LCD Interface

The LCD Interface is designed for an HD44780 compatible LCD Display (character only) using the 4 bit mode of operation. The LCD Interface pins are also shared with the ISP Interface allowing more remaining pins for the designer.

R3 provides LED Backlight current for the display. EL backlight is not supported, but a circuit can be added (beyond the scope of these instructions - check LCD Manufacturer). WARNING: Make sure the current through R3 does not exceed the current rating of the backlight. LED Backlight voltages are usually 5V and the current is usually around 100mA nominal. With 15V unregulated in, the voltage drop across R3 is 10V resulting in 100mA for a 100 ohm resistor. Check with the manufacturer's specifications; some displays specify 80mA at 3.3V maximum rating (100 ohms would destroy the backlight). R3 will get hot, so be careful.

R2 potentiometer provides LCD Contrast. The PCB has a very thin trace between pin 3 and GND to allow the trace to be cut and a jumper added to -10V on the PCB from the RS232 converter (VN on schematic). This allows the infrequent display type requiring a negative bias input for contrast.

The design allows either in-line display connection or Ribbon cable types using an IDC type connector. An in-line display can be soldered directly to the PCB with right angle SIP pins for a front-panel type application. For applications with tougher environments as in an automobile, ribbon cables make more sense.

Suitable displays can be found on Ebay by searching for text 'HD44780'. Custom displays are found at http://www.eio.com/lcdprodt.htm and http://www.allelectronics.com/cgi-bin/category.cgi?item=LCD-82

 

RS232 and ISP Programming Port:

RS232 and Programming Interface

These two connections provide the two simple communication methods to the host computer. The ISP (In System Programming) interface attaches to the PC/Laptop parallel printer port. The RS232 interface attaches to the PC/Laptop serial COM port (or some other RS232 device). Under most circumstances, both cables may be left connected between the PC and the AVRProject until a program is completely debugged.

The ISP interface reuses the same pins as the LCD Interface. The LCD display may 'go nuts' during programming, but will not be damaged. J6 is the standard connector for the BASCOM-AVR Sample programmer (set up in compiler options-programmer menu to use the Sample Programmer with the parallel port). Other ISP Programmer dongles use a different pinout and many require 5V from the AVRProject. J5 was added in line with J6 to add 5V and SS (Single Step debug) signals to form a larger programming connector for these dongles needing +5V. Consult the manufacturer to find the needed pinout of the dongle. The corresponding programming signal names are stamped on the AVRProject Mega PCB.

A MAX232 chip does the RS232 conversion. It connects to the embedded serial port in the AVR, converts to RS232 signals, and connects to a 5 pin SIP header that matches the top row of pins leading to a PC's COM port (pins 1-5). See below for construction details for cable assembly:

Also supplied from the MAX232 converter is +10V and - 10V at a limited current. These pins can power additional MAX232 converters (without the need for capacitors) or other circuits like the LCD contrast as mentioned in the LCD section. The extra RS232 pins are clearly labeled. Pins 1 and 4 of RS232 connector J10 have extra pads as well. These could be used for additional hardware data handshaking (i.e. RTS/CTS).

Cable Construction Details

 

Crystal Oscillator and Reset Circuit:

Crystal Oscillator and Reset

C1 and C2 are loading capacitors. If critical timing accuracy is required, an adjustable capacitor may be substituted for C2 (Input side). In timing applications, there has never been more a couple seconds a day drift seen from quality components, though. For the AT90S8535-8, the maximum crystal frequency is 8Mhz. Check with your Atmel AVR Specification sheet for the processor you are using to find the accepted range of crystal frequencies.

The use of a Reset controller like the DS1233 is the only way to guarantee the integrity of the internal EEPROM on the AVR processor. Without this 3 pin reset chip, havoc can be wrought from a brown-out or repeated power on/off. The Atmel manual, in a subtle manner, recommends not using the internal EEPROM data storage for this reason. I didn't accept that excuse when I designed this PCB. If you plan on using the AVR Internal EEPROM, make sure you have a DS1233 chip in U2.

Warning: The SilkScreen for U2 on the PCB is BACKWARDS.

This 'EEPROM reset' problem does not corrupt the program Flash memory. If you don't plan on using the data EEPROM, U2 would help in only a few occurrences.

 

Assembly Tips:

  1. Set up Tools, Supplies, and Work Area.
    1. Soldering iron: This should be a 25 to 30 watt pencil type.
    2. Soldering iron cleaning sponge. It should be wet when used.
    3. Solder - for this work, use the thinnest rosin core 60/40 solder you can find.
    4. Rosin Flux - liquid or paste; to make assembly easier, cleaner, and less damaging.
    5. Alcohol Bath - Simply a small Tupperware container half filled with alcohol solvent (found in hardware stores). This will remove the flux and other messes off the board after assembly.
    6. Small side cuts (can't say dikes), needle nose pliers, small wire strippers, utility knife, and other common hand tools.
    7. PC with Windows 95 or better with an available RS232 and printer port.
    8. Work area with good lighting and good ventilation.
  1. Assemble the Board - common work practices
    1. Orientation of chips and diodes. See Diagram. WARNING: Installing any of the chips in backwards WILL destroy them. Please be careful. WARNING: U2 is labeled backwards on the PCB. For installing U2, please refer to the layout on Page 1 of these instructions.
    2. General Parts Orientation except U2.  Did I mention U2 is Backwards?

      Picture of Proper U2 Placement

    3. Slide the components onto the PCB. Spread leads apart to hold on while upside down.
    4. Apply small dabs of flux to the joints to be soldered.
    5. Solder connections -
    6. clean iron tip on sponge,

      tin soldering iron tip with solder,

      heat up pad and component lead (usually about 1 second

      flow solder into joint. Use enough solder to fill the gap around the lead.

      heat up next pad,

      flow solder into next joint, -- Repeat

      - clean and re-tin soldering iron about every 10 solder joints.

    7. Special Interest on LCD Backlight Resistor R3 (100 ohm 1W).
    8. The leads will need bend as shown to dissipate heat away from the PCB. This component will get hot, so keep it away from wires and other components.

      Proper lead bending technique to keep R3 from burning a hole in the PCB

    9. If desired, solder the LCD display onto the PCB. Please keep in mind that it can accidentally be installed backwards. As a rule, the width of display should closely match the outline on the PCB. The component outline matches the 2x16 character display. For larger displays, find pin 1 of the display. The LCD can also be mounted using straight pins to the PCB. If this is done for secure PCB mounting to a panel, it's also a good idea to mount the RS232 and Programmer port pins on the bottom of the board for accessibility.
    10. One jumper is needed between 330 ohm resistors R6 and R7 to the programmer port pin MISO. Add that jumper using snipped off resistor or capacitor lead from earlier assembly.
    11. Assemble the cables as shown in earlier drawings. The RS232 cable can be done by crimping ribbon cable only, while the Program cable is a little more confusing. The pin connections for the program cable are: Note that the IDE connector is numbered lengthwise like the DB25P rather than staggered across.

IDE-10 DB25P

    1. 25
    2. 4
    3. 5
    4. 11
    5. 2

 

  1. Clean-up
    1. After all soldering is done, place the PCB into the Tupperware type container with alcohol. Let it soak for about 15-30 minutes to remove all the flux. As mentioned before, use Solvent Alcohol. Using household Rubbing Alcohol will leave a sticky residue.
    2. Remove from the tray, and holding it over the alcohol (still dripping), use a small stiff bristle brush to remove any stubborn residue. Rinse off in alcohol and lay aside to dry.
    3. After exposing the bare skin of the hands to Solvent Alcohol, be sure to use soft lotion to avoid skin damage. This type of alcohol removes all the protective oils from the skin. One should use protective gloves to be cautious. (Personally, I found the gloves more uncomfortable than the alcohol).
  1. Test Power On:
  2. a) Without the AVR Processor installed, power the unit on and verify proper power at the processor socket. There should be +5V with the positive probe on socket pin 10 and negative probe to pin 11. Check again with positive probe to pin 30 and negative probe to 31 for the +5V Analog. Troubleshoot as required. Without the AVR Processor installed, there is no resistance between the two grounds. The Diodes D1 and D2 will give .4V difference in ground voltages. Troubleshoot as required.

    b) If the voltages are correct, plug in the processor (note orientation of part) and it is ready.

  3. Download the Programs needed
    1. Program and Test Unit
      1. Sample diagnostic and application programs are also available in the download area.
      2. Troubleshoot as required.
    1. Start writing programs, build circuits, make it work for you!

    Robert J Reeder

    Home

    Full Schematic