Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Please check my AVR circuit

Status
Not open for further replies.
Hi, everyone.

I've designed a circuit for an AVR microcontroller. Could you please check and make sure I've done it correctly? I'm an amateur and this is the most complex thing I've ever designed.

1. I've aimed for about 20 mA through LED1 and LED2. Is that about right?

2. What do I do for Q1 and R4?

3. The idea is that the output of one AVR will be carried on the DB-25 connector and become the input to another AVR. If I connect a general purpose I/O pin to another one, do I need to put a resistor between them?

4. Does the LED2 connection look right? Its output will come off a GPIO pin of another AVR. Do I need to put a transistor in there to give it enough current?

5. The idea of the DB-25 connector is that this AVR circuit will be independent of the other, but can be connected at any time. Each circuit has its own power supply. When the circuits are connected, GND for both circuits will suddenly be matched up. Is there anything I need to do to account for sudden potential differences?

Richard
 
Last edited:
1 At 20mA LEDs tend to be pretty bright, something like 5-10mA maybe easier to look at, but why not try for yourself.
2 R4 needs to be high enough so that you don´t exceed the pin current of the avr, but you didn´t say which one, so look into the datasheet.
3 You should use some resistor between the chips, 220ohm on each side shouldn´t hurt anything.
4 I am not too sure about LED2, because your bus protocol seems rather unusual. Can you expand on it?
5 This way you should be ok.
 
The maximum pin current is 40 mAmps. My bus protocol is entirely my own creation. Software, I can do. Don't worry about that. Suffice to say that every pin on the DB-25 is connecting one AVR to another.

Richard
 
Looks pretty good. Some improvements can be done.

- The pull-up resistor R3 should be bigger.. 10k or even 50k.
- Add small resistor in series at least to the "data received" line, because this line is also used by the ISP.
- Add 100nF ceramic capacitors parallel with C3 and C4.
- Add 100nF ceramic capacitors from AREF to ground.
- Add 100nF ceramic capacitors between Vcc and Ground near the ISP header.
- Add 10 nF ceramic from reset-line to ground.
- Add a push button to manually reset the microcontroller.. you will use it a lot.

Read this application note: https://www.electro-tech-online.com/custompdfs/2012/10/doc2521-1.pdf

If you plan to make a printed circuit board from this, it is always useful to add extra capacitors in power lines and other lines that needs to be stable. You don't have to install them all, but you may need them. Resistors between chips are not only good protection, they also help you route the signals (they act like jump-wires) and cut the signals for debugging etc.
 
Last edited:
Some LEDs are rated at 10mA, some at 20mA. The D155, for example, is daylight readable at 2mA, and at 20mA will burn a hole in your eye (yes, I've looked at it).

The controllers are rated for a max mA per pin, but also a max mA per power supply/ground pin (total power sourced or sunk by the part). Do not exceed either of these.

I don't like tying controller pins straight to an outside connector. What happens if someone plugs a RS232 cable into this connector? Also, at what length will your two boards be separated? You may pickup some noise or experience a voltage drop that won't let the micro detect a "1" coming in. I would suggest at least a minimum of 100 ohms in series, and maybe a .1uF cap between the resistor an uC pin. Optoisolators work very well in eliminating board to board noise, and can switch 12V to 5V to eliminate v drop on your line. Unless, of course, you want the line to be bidirectional. These are just things to be considered, the most important of course is dependent on the distance your two boards will be separated by.

IC decoupling is very important, as mentioned by Mr. T, and in addition, put a couple of 10uF caps around the 5V rail, or close to the uC. You may not see any problems while you're developing your board, but proper decoupling can save lots of head stratching over random problems occuring in the field once the board is in use.

If you're doing ADC conversions, separate your VCC and AVCC with an inductor and capacitor filter.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top