Series vs. Parallel Circuit...?

Around three weeks ago I wanted to make a simple light turned on by a motion detector and in researching how to do this I came across the Arduino and I now I'm fascinated (if not obsessed) with electrical circuits and how they work.

After reading many threads this will probably sound extremely easy to most members but I have only a few weeks exposure to electronics so any help is truly appreciated. I do have an amateur knowledge of some code languages (HTML, ASP, SQL, etc) so that side is easier for me.

What I am trying to accomplish?

Run 6 very small 12v 65mA lights that kick on for around 20-30sec by a motion detector (PIR). On the same circuit I need to run two small 12v .47A fans (recycled from an old computer) and the fans are kicked on by the TMP36 temperature sensor.

My design is?

I have a 12v 1,500mA AC adapter providing power to a breadboard wired like an Arduino with an Atmega328P chip and I accomplished this from following this awesome tutorial (I will post the link in the next message I send)

I wrote a simple code to the Atmega328P chip to run the PIR and the TMP36 sensors. I can post the code if needed.

I am using a LM7805 to drop the voltage to the 5vdc needed for many of the components on one rail and the other rail is 12vdc directly from the AC converter.

The lights and the fans are switched on via 2 individual 12v 1A relays powered from the 12vdc rail with a NPN transistor, a resistor, and a diode on each.

I finally have a working project, which I am thrilled and amazed about, but I have hit a wall with my understanding of exactly "why" it works and would like to have a better understanding of the “why”. I also want to make sure I don't have any safety concerns so I won't burn my house down.

The thing I am having the most trouble understanding is if the correct current at the correct voltage is going through the circuit and to the components. I think I need 940mA at 12v to run the fans and 390mA at 12v to run the lights. It works and seems to be running at the right brightness and fans at correct speeds but is it right? The motion detector is a little sluggish but I think it's an issue with my code and a question for another thread.

The different calculations for a series vs. parallel circuits are throwing me off because I think my circuit is a mix of both. The diodes, resistors and capacitors are also a little confusing when trying to determine which one, at what ohm, and where they need to be.

It would help me feel a lot better if someone could take a look at my design to see if I have anything out of place or if I have something that could be potentially dangerous.

If anyone sees something that could be changed to work more efficiently that would be great too.

This is my first post so I was not able to post my images or any links but I will place another post as soon as I can with images of both.

Thanks so much to anyone who can help.

Here is a link to a schematic of my current design (sorry if not drawn correctly). I couldn't figure out how to get the image to post on here so a tip on that would also be cool (I think I need more sleep).

Here is a link to a pic of the breadboard wired like an Arduino.

Here is the link to the breadboard I accomplished from following this tutorial

Thank you again for any replies and any comments or suggestions anyone has would be great.

As I mentioned earlier I have a very limited knowledge of electricity and it is pretty scary stuff so the bottom line is that I want to make sure what I am doing is safe and learn as much as I can (as fast as I can).

You need a 10K pull up resistor on pin 1 (that's a 10K resistor between pin 1 and 5V) This is the reset pin. Pin 22 and 8 need to be connected to the ground and pin 7 & 20 to +5V. Finally pin 21 needs to be connected to ground through a 0.1uF cap. Otherwise it looks ok.

Thanks for the reply and that all sounds easy enough... I couldn't figure out the low pass filter so you put that to rest... Thanks...!!!

I have a question about the diodes.. If they are there to keep a power spike (?) from going back into ATmega can't the power go around the diode by means of the coil in the relay? If so do I need to move the diode?

can't the power go around the diode by means of the coil in the relay?

No the power spike is generated in the coil, the diode shorts it out because it is in the opposite direction to the power supply.