My first standalone project - chceck correctness please

Hi, I am projecting my first standalone arduino project. I making LED lighting for my aquarium, there will be 7 branches of serial LEDs. Each branch can be controlled one of 3 pwm signals (signal is choosed by jumper). There will be an i2c display and DS1306 clocks, maybe some sensors in future. 4 buttons for control and one reset button. Can you tell me, if it is correct? It is my first standalone arduino project, so I want to make me sure that PCB will be ok at first time.

I am glad for any comment.

sorry for my bad english

EDIT:

Both ends of LED2 seem to be connected to Ground. It will never light.

If you press the Reset button you will be shorting +5V to Ground. That will fry something.

Place a 100nF capacitor right next to the 7805 pin 1 to 3. Your reset switch is wrong! You are shorting out the +5 to GND.

johnwasser: If you press the Reset button you will be shorting +5V to Ground. That will fry something.

Not necessarily fry - the 7805 will current limit and thermal shut down if it persists. Not a good idea however, and shorting the capacitor will reduce the working lifetime of the pushbutton.

Hopefully innocent draughting blunder as with the LED - the button should have been connected to the reset pin and resistor further right.

Seems to have the "raw" supply connected to the I2C spills - should of course be the regulated 5V line.

As well as fixing the problems already mentioned, I suggest you add a standard 6-pin ICSP header so that you can reprogram the microcontroller in-situ.

Thank you guys.

Lary, there is 10uF capacitor, should I replace it?

I edited my sketch, so I hope, everything is OK... Added ISP pins and add power suppply for fans for cooling leds, but I dont know if it is connected right... New sketch is in first post

You now have C3, C4 and pin 22 of the mcu connected to +5V instead of to ground. The reset pins of the MCU and ICSP header should go to the junction of the 10K resistor and the reset switch, not to +5V.

You don't need to connect Aref to +5V, you can do that inside the chip - and it's better to do it that way, in case you accidentally connect Aref to the 1.1V internal reference in the code.

dc42: As well as fixing the problems already mentioned, I suggest you add a standard 6-pin ICSP header so that you can reprogram the microcontroller in-situ.

this! ^^

recently had to deal with pre-existing pcb's that didnt have any ICSP headers/breakouts..

(FYI.. I used this cable from HobbyKing.com since my chips were Atmega328P-AU/SMD versions of the chip) http://www.hobbyking.com/hobbyking/store/__27195__Atmel_Atmega_Socket_Firmware_Flashing_Tool.html

(worked a treat too!)

OK, 3rd version, I hope now it is without errors :0... Can you explain me please, what to do capacitors around 7805 regulator? Should I place it by the 7812 too?

  1. You should add a 0.1uF ceramic capacitor between the atmega Vcc and Gnd pins, and another between Avcc and Agnd. Place these capacitors as close to the atmega as reasonably possible.

  2. Regarding capacitors at the input and output of the regulator, check the regulator datasheet for the recommendations for the particular regulators you will be using. Generally, you always need an input capacitor (which must be placed close to the regulator), but the output capacitor is optional for many regulators. So you do need to add an input capacitor on the 7812. The input capacitor of the 7805 can double up as the output capacitor of the 7812.

pytel_zajicu: Can you explain me please, what to do capacitors around 7805 regulator? Should I place it by the 7812 too?

The capacitors have two roles.

The first is to filter noise from the supply lines which could interfere with circuitry (especially microcontrollers). Simply put, capacitors act like a short circuit to AC signals, effectively removing them from the power rails.

The second in respect to regulators is to prevent them oscillating. These regulators rely on a closed loop feedback control, whereby it aims to make the output voltage constant even if output current or input voltage changes. In some cases this feedback loop can overcompensate and go out of control resulting in high frequency waveforms being added to the supply line. The capacitors help slow any change in output/input voltages to help reduce the chance of oscillation, and remove the noise.

Thank you Tom, thank you dc42 :)... Is it correct now?

I can’t see any obvious errors now. I presume the input at J1 will be more than 12V?

I suggest you make provision for an output capacitor on the 12V regulator, just in case you find you need one - even if you don’t plan to fit one initially. My previous comment “The input capacitor of the 7805 can double up as the output capacitor of the 7812.” was wrong; I thought the 7812 was powering the 7805, but I see now that they are both powered from J1. C1 can serve as the input capacitor for both regulators, as long as they are fairly close together.

This was enlightening! I know nothing about electronics but now it doesn't seem totally impossibly to design your own board! Just a thought, why not have the ADC and other pins on the top next to 5V and GND like 5V-A0-GND-A1-5V-A1-GND-A2-5V, or GND-A0-5V GND-A1-5V GND-A2-5V

Have them on a 2.54mm pitch and maybe add some Screw Terminal Block later...

Don't you use TX and RX to program a Atmel382?

Thanks again dc42 for your patience with me, I am glad about people like you. Here is modified sketch.

I placed own capacitor on 12V regulator (in and also out), add RXD, TXD pinout and add some gnd holes. Hope, it is finish version :))...

Samba: this is only sketch, when Ill design board, probably it will be placed together (GND-IO-VCC).

I have question about ICSP uploading sketches. I never used RX/TX pins or SPI pins to communication. I only use i2c, but if I understand well, SPI and RX-TX is using for communication with other devices too. But I cant find how works ICSP uploading sketches explained for dummies. Is it uploads via SPI or RX/TX or both?

You have your ISP connections so you can use an AVR programmer to download programs. This is the primary method they were designed to be programmed with.

An alternative method involves having a portion of the flash devoted to a small piece of software (bootloader) which allows you to program via a serial port (RX TX).

As you would need the ISP pins to download the bootloader in the first place, you might as well just stick to using ISP to download your program and skip the bootloader.

Thank you Tom. Just for my assurance - standard way to upload program is via SPI (MISO/MOSI pins), that can be also used to serial communication with another devices. I can use RX/TX pins too, but there must be bootloader in AVR. So, If I have AVR with bootloader, I dont need SPI pins anymore, because I can upload sketches via rx/tx. Am I right?

Correct, although you would need the SPI pins there to be able to program the bootloader on in the first place.

is not only to indicate which wire connects to which, this is a necessary but not sufficient condition. If you are using a system which directly translates the schematic to a routing pattern, it may work, though even then there are certain "rules" that need to be followed.

A schematic diagram should also serve to explain the function of the circuit. In order to do this, it is necessary to follow certain general conventions. I believe you need to re-draft at least the left-hand side of your schematic in order not only for us to understand it and check for errors, but so that you can do so effectively as well, because this has obviously been the source of design problems.

A first convention is that the vertical axis suggests voltage. Wherever possible, all the grounds should be at the bottom of the diagram, preferably entering components from below. Similarly, supply feeds should be toward the top and enter from above (with the exception of the regulators where a feed from left to right makes sense). You have initially observed the convention of the power feed from the left-hand side, but things have become confused after then.

Power feeds - regulators and such - should run in sequence (from left to right) indicating flow. If as here, you have two alternate feeds (and you have correctly sourced both from the primary voltage rather than in cascade, to best utilise drop-out voltages), then make two parallel sections one above the other with the split to these on the left-hand side. Avoid round-about loops.

Wherever possible, buttons and their associated pull-ups should appear in the same vertical line from one power rail to the other, and similarly for (power) indicators.

The crystal loading capacitors (as with all bypass capacitors) should preferably be shown vertically, down to the ground. You need to organise the confusion of ground joins - almost all should go down to one rail along the bottom.

If you note the Arduino schematics, they frequently split parts of the I/O busses into completely separate sections of the overall diagram, simply to manage so many connections.

Ok, Paul, thanks for remarks. Its right my schematic was quite messy, so Ill takes your advices and tried modify schematic… Hope, it is more clear now… Please check it, and if there is no more errors, Ill start project PCB design…