Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: ErikY on December 21, 2012, 12:49:04 PM

Title: Circuit and board review?
Post by: ErikY on December 21, 2012, 12:49:04 PM
Hey everyone, I am wondering if anyone would be so helpful as to review my circuit and board for a bot that I am making.

Long story short, I have made a few bots, but all boards have been based on others designs that I just copied.

I wanted to learn to make my own for more complicated projects, this was my first time using eagle where I made my own circuit and then the board from the circuit, where in the past I would just make the board based on someone else's board, like the $50 bot.

Specs:

Line following bot
Pins a0-a4 will be for a IR sensor board which I already made and tested
bot will be driven by 2 modified servo's
All LED's will be attached to bot frame, so they need to be extended, and will have 330ohm resistors on each.

The board itself is not meant to do anything else but serve as the board for this bot, I don't plan to take it out and use it for other bots, which is the reason I only am using the pins I absolutely need, and hence the configuration.

Other thing I should mention is I plan on running both arduino code on this, as well as webbot lib.


I think the rest is self explanatory from the circuit

If anyone would be so kind to review this and give me any feedback, I would greatly appreciate it.
Title: Re: Circuit and board review?
Post by: Soeren on December 21, 2012, 08:15:16 PM
Hi,

Not bad at all, if it's your first go :)

PCB
I have attached the PCB with some markings.

Red dots where you have acid traps (inward corners <90° have a tendency to pocket some etchant that will react to moisture and degrade the PCB over time.

Yellow dot where you have a flaw because you used the wrong component for IC1 - use the upright one instead.

Connect the outer black pour to ground (in the schematic, rename your ground line to GND and when you have drawn the outline of the pour, rename that to GND too (and when it asks, select GND for the "total" name as well, for good measure).

Purple... Remove any non-grounded pour, it will act as noise antennas.
If you go down to a proper clearance, like 20 mil, there's a good chance that most will be grounded and anything above 32 mil of clearance should be for kindergarten kids anyway  :P

I'd enlargen the pads a bit, plenty of room and it makes it easier to make a good strong solder connection (the coppe foil of a narrow "ring" will lift very easy, if a component can be moved the tiniest bit down)

If you are going to drill the board yourself, run the User Language Program (ULP, they're scripts really) called "Drill-aid" and when it asks for the drill size, set it to 0.5mm and you will get a fine "dot" that helps centering the drill. Don't set it smller, or some won't etch and too big, you loose the drill centering somewhat.

C2 could be a 1206 or 0805 ceramic SMD mounted directly at the pins of the µcontroller on the solder side - then you could avoid the µwave resonant circuit that you have as is and get rid of a lurking potential problem, while getting the effect where it matters the most.


Schematic
If you're using a plain old 7805, C3 is around 1000 times to large (make it 220n to 330n) and C1 is 10 times too large.
These two caps should be mounted closer to the regulator, as close as possible, although C1 shouldn't be too near the heat from IC1 either, so around 5mm or so away.
If you just used the drawing of the 7805 for a switcher, study the datasheet in this regard.

You have a junction where none is needed (nor wanted) right above C2.

When your circuit isn't larger than a single sheet, don't break it up with strange placements like on the left side of your schematic - if it's one circuit, show that it is, it will make it much easier for you to read 6 months from now. The power part can be a separate entity though.

Move the line running through the pin numbers of J1 a couple of notches left.

Don't take the power for the motors from the PCB, take it directly from the battery, to avoid influencing the logics.

I'm not sure I follow the idea with separate connectors for each white and blue LED. Making a single connector and wire both (white or blue) LEDs to that will save you a connector pair - and the less you mount, the less can go wrong.


In general (PCB overlay and schematic alike), "smash all" (ULP) the components and rearrange names and values to same orientation to make it easier to read.


The above may sound as harsh critique, but if this is really your first Eagle attempt, it's very good!
Never the less, there's always room for improvement and heeding the above advice will take you a good few steps further.
Title: Re: Circuit and board review?
Post by: ErikY on December 21, 2012, 08:53:45 PM
Hi,

Not bad at all, if it's your first go :)

PCB
I have attached the PCB with some markings.

Red dots where you have acid traps (inward corners <90° have a tendency to pocket some etchant that will react to moisture and degrade the PCB over time.

Yellow dot where you have a flaw because you used the wrong component for IC1 - use the upright one instead.

Connect the outer black pour to ground (in the schematic, rename your ground line to GND and when you have drawn the outline of the pour, rename that to GND too (and when it asks, select GND for the "total" name as well, for good measure).

Purple... Remove any non-grounded pour, it will act as noise antennas.
If you go down to a proper clearance, like 20 mil, there's a good chance that most will be grounded and anything above 32 mil of clearance should be for kindergarten kids anyway  :P

I'd enlargen the pads a bit, plenty of room and it makes it easier to make a good strong solder connection (the coppe foil of a narrow "ring" will lift very easy, if a component can be moved the tiniest bit down)

If you are going to drill the board yourself, run the User Language Program (ULP, they're scripts really) called "Drill-aid" and when it asks for the drill size, set it to 0.5mm and you will get a fine "dot" that helps centering the drill. Don't set it smller, or some won't etch and too big, you loose the drill centering somewhat.

C2 could be a 1206 or 0805 ceramic SMD mounted directly at the pins of the µcontroller on the solder side - then you could avoid the µwave resonant circuit that you have as is and get rid of a lurking potential problem, while getting the effect where it matters the most.


Schematic
If you're using a plain old 7805, C3 is around 1000 times to large (make it 220n to 330n) and C1 is 10 times too large.
These two caps should be mounted closer to the regulator, as close as possible, although C1 shouldn't be too near the heat from IC1 either, so around 5mm or so away.
If you just used the drawing of the 7805 for a switcher, study the datasheet in this regard.

You have a junction where none is needed (nor wanted) right above C2.

When your circuit isn't larger than a single sheet, don't break it up with strange placements like on the left side of your schematic - if it's one circuit, show that it is, it will make it much easier for you to read 6 months from now. The power part can be a separate entity though.

Move the line running through the pin numbers of J1 a couple of notches left.

Don't take the power for the motors from the PCB, take it directly from the battery, to avoid influencing the logics.

I'm not sure I follow the idea with separate connectors for each white and blue LED. Making a single connector and wire both (white or blue) LEDs to that will save you a connector pair - and the less you mount, the less can go wrong.


In general (PCB overlay and schematic alike), "smash all" (ULP) the components and rearrange names and values to same orientation to make it easier to read.


The above may sound as harsh critique, but if this is really your first Eagle attempt, it's very good!
Never the less, there's always room for improvement and heeding the above advice will take you a good few steps further.

Soeren, thanks very much!

This is extremely helpful, and does not sound harsh at all, this is exactly what I was looking for.

I used Eagle once before for the $50 robot, but I did not do the schematic, only the board, and I was never able to figure out the ground plane before, this was the first time I used the schematic and built the board using F/B Annotation.

I am going to see if I can fix everything up based on your suggestions, again, thanks a lot!
Title: Re: Circuit and board review?
Post by: Soeren on December 21, 2012, 09:16:43 PM
Hi,

If it acts up, just post the Eagle files (.sch and .brd) and I'll give them a bash.
It's bedtime here (actually less than 4 hours until the alarm clock starts) and tomorrow is family-time until late evening, but I should be able to look at it in less than 24 hours.

P.S. Please only quote the specifics that you comment on. The purpose of quoting is to make it easier to see what is answered/commented and eg. in this case, there was no real reason to quote anything at all, as it was right above in verbatim, in case I forgot what I wrote :)
Title: Re: Circuit and board review?
Post by: ErikY on December 22, 2012, 07:17:34 AM
Soeren, gotcha on the quote, good point, I will be more careful.

I do have two questions that I cannot quite figure out based on your suggestions.

How do you remove the non grounder pour, the purple area?

I cannot figure that out.

Also, how do I enlarge the pads, I cannot figure that out either.

Thanks!
Title: Re: Circuit and board review?
Post by: ErikY on December 22, 2012, 11:51:18 AM
OK, so I worked on the schematic file, I want to make sure I get this right before I re-do the board, as that takes me forever to get right.

How does this look? I tried including the actual sch file, but it was above the max size.

I am going to leave in both forward LED's, so that I can make one light when left servo is running, and the other LED for the Right servo.

I modified power to only use 1, modified everything else you suggested, that I can figure out.

I am still not understanding a few things:

I don't quite get what the smash does, or how to use it, I hit the smash tool and then clicked on components, but they did not seem to do anything.

I also am not sure if I got my 5V going correctly to my 328P, I removed the junctions above the cap, but not sure I did this correctly.

I also don't quite know what you mean about not pulling from the PCB, do you mean I should run a battery off my board, directly to those pins, both positive and negative?

Thanks again!
Title: Re: Circuit and board review?
Post by: jwatte on December 22, 2012, 08:37:45 PM
Quote
I don't quite get what the smash does, or how to use it

It separates the name and component value from the component outline, so that you can move/rotate the name/value texts to be more readable. Good placement of readable text is one sign of a carefully crafted PCB.
(Another is placing all polarized components facing the same direction, to ease assembly and debugging.)

Quote
I also don't quite know what you mean about not pulling from the PCB

I think he means physically de-laminating. The copper doesn't stick to the fiberglass through magic; apply too much heat to too little area and it will come loose. This sometimes means you need to apply super ugly kludges to complete the circuit, and other times means you have to start over with a new PCB.

To avoid this, make each pad and hole that you will mount a component in somewhat bigger. In Eagle, the size of the copper on the pads often comes from the library that defines the part, which may mean you have to copy the part into your own library, open up the outline, and enlarge the pads to get what you want. Or re-draw the component in your own library. I sometimes end up doing this for various reasons; pad copper size is one such reason.

When you go to make your PCB, I would *highly* recommend using a board fabricator of some sort. Here are two recommendations assuming you live in the US:

http://imall.iteadstudio.com/open-pcb/pcb-prototyping.html (http://imall.iteadstudio.com/open-pcb/pcb-prototyping.html) based in China makes 10 boards of size 50x50mm in less than a week for $10, plus shipping. Shipping takes three weeks for air mail, but three days for DHL ($28) so the total cost for 10 copies of your board is $38. Larger boards are also available -- 100x100mm for $25, for example. (The free version of Eagle can only make boards of max size 100x80mm.) The minimum clearance is 8 mil and I'd suggest 10 mil to be safe. Also, there is a limited set of drills, and you can't have interior slots on the board. They also have 4-layer board options if you need it.

Another option is http://www.oshpark.com/ (http://www.oshpark.com/) which is based in the US. The boards are a LOT nicer -- purple solder mask, gold plating (ENIG,) and 6 mil clearance allowed, as well as a fair amount of drill and route options. $5 per square inch for three copies of your board. Takes about two weeks start to end. Again, there's a 4-layer option as well, but it usually takes longer.

If you live in the EU, I have heard that Olimex has given reasonable turn-around times on boards, but I've also heard some bad stories -- probably similar in quality to the Chinese options...
Title: Re: Circuit and board review?
Post by: ErikY on December 23, 2012, 06:41:41 AM
jwatte, thanks for your suggestions.

I will play around more with the smash, I see the value of it, that makes sense.

Regarding the power pulling, I am thinking maybe Soeren means to solder 22-28 gauge wires from the battery to the servo pins, rather than having the wires on the actual PCB itself, but I am not exactly sure.

I am going to look into having the boards fabricated, that is not as expensive as I would have thought.

I do kind of like the idea of doing it myself, but I can definitely see the advantages.

Thanks for your suggestions.
Title: Re: Circuit and board review?
Post by: jwatte on December 23, 2012, 10:46:41 AM
Quote
Regarding the power pulling

Unfortunately, I don't see Soren using "pull" anywhere in his comments. When you said "pull" first I thought you meant the part where he recommends against thin rings because the copper foil may pull off.

Perhaps you mean this part?

Quote
Don't take the power for the motors from the PCB,

If so, yes, you don't want power to the motors to go through this PCB at all. You want short, thick, wires from battery to motor controller to motor. Everything needs to be tied to the same GND in the end, but that GND point should typically be the negative terminal of the battery.

Also: PCB traces when plating 1 oz of copper (typical) for high-amperage circuits need to be ludicrously wide -- 100 mil (2.5 mm) for an outside trace for 10 A, to avoid overheating the trace. And this is allowing the temperature to rise to 85 degrees, which is top of the commercial component temperature range!

Title: Re: Circuit and board review?
Post by: ErikY on December 23, 2012, 11:23:39 AM
Yeah, I used the word pull, probably a poor choice of words, sorry for the confusion.

This makes a lot of sense, I will wire directly to the battery for my servos, thanks!
Title: Re: Circuit and board review?
Post by: ErikY on December 23, 2012, 11:59:58 AM
Another question I just thought of if anyone could help me out, if I do draw directly from the battery, should I use a capacitor as well?

I know that Admin used a 220uF capacitor for his servos in the $50 robot for this purpose.

Thanks.
Title: Re: Circuit and board review?
Post by: Soeren on December 23, 2012, 03:30:15 PM
Hi,

Just starting from the bottom and it may take a while before I get to through, as my head feels like exploding (flu or whatever annoying nastyness it is that I have caught in the big room).

Another question I just thought of if anyone could help me out, if I do draw directly from the battery, should I use a capacitor as well?
Yes, a cap will act as a buffer and dampen noise - place it as close to the servo as possible though, as noise of any kind is best dealt with as close to the source, or the wires will carry the noise and radiate some of it into nearby parallel wires.

To avoid a clumsy wiring, either terminate one set of wires from the battery as close to the servo connectors (to keep the 3 terminal servo connector intact), or make separate wide(-ish) traces from the power connector to the servo connectors and tin them for better current handling, if you dislike a second set of wires to the battery - remember a suitable fuse in any wires from the battery, preferably as close to the battery positive terminal as possible (inline fuse holders are the bast way to make it safe and isolated.
For a single pair of servos I don't think you'll have all that much issues with motor noise on the supply line though, so the traces for servo power may be OK.
Title: Re: Circuit and board review?
Post by: ErikY on December 23, 2012, 06:25:08 PM
Soren,

Thanks, that is helpful.

I hope you feel better.
Title: Re: Circuit and board review?
Post by: Soeren on December 23, 2012, 07:08:50 PM
Hi,

How do you remove the non grounder pour, the purple area?

The best solution is to make them all connect to the ground plane (which is then connected to ground of course).
If you have an area that you just can't ground for some reason (on rera occasions, I use jumpers to connect a floating plane), you can remove it by drawing the shape you want to remove on layer 42 (bRestrict, where the initial "b" means bottom layer). This will restrict a pour, but not any traces going through the area.


Also, how do I enlarge the pads, I cannot figure that out either.
First make a safety copy of the librariy you want to edit (just in case...).
Then:
Library -> Open   select the library in question.
Click Edit package (the symbol resembling an IC).
Select the package you want to edit
Then Change -> Drill, select the size you want and click the centers of the pads. You can use Change -> Shape as well if you want another shape for any pads.

When done, use File -> Save
Back in the PCB editor, make sure to...
Library -> Use and then the library you changed.

You can try if the Restring command (a tab on the DRC/Design Rule Check "pop up") will give you what you need, but personally, I prefer to change the libraries, even if I run two sets of libraries, one for PCB fabbing and one for home produced PCBs.



How does this look? I tried including the actual sch file, but it was above the max size.
Is the limit that low?? Plenty of people have posted both .sch and .pcb files in the past.

Perhaps zip both files into one zip archive and if that don't work, I can PM you an email addy where you can send them.


I am going to leave in both forward LED's, so that I can make one light when left servo is running, and the other LED for the Right servo.
I wasn't trying to get you to limit the amount of LEDs, just the amount of connectors, as the electric signls was the same at each pair.


I modified power to only use 1, modified everything else you suggested, that I can figure out.
OK


I don't quite get what the smash does, or how to use it, I hit the smash tool and then clicked on components, but they did not seem to do anything.
The Smash button only smashes the components you click on after selecting it. You can see the effect as little crosses appears at the component Name and Value, which can then be moved and/or rotated to any place without changing the position/orientation of the resistor.
If you use the "Smash All" ULP instead of the button. I don't know which version of Eagle you use, but you probably need to download the Smash All ULP from their site, as there's only the "smash-all-sch" as standard in most (all?) versions and it's good for the schematics part only.


I also am not sure if I got my 5V going correctly to my 328P, I removed the junctions above the cap, but not sure I did this correctly.
Looks allright to me, but I can't guarantee anything without seeing the .sch and .brd files.
You can see if they're connected when you go to the PCB part though.


I also don't quite know what you mean about not pulling from the PCB, do you mean I should run a battery off my board, directly to those pins, both positive and negative?
Yes, but let me see the two files, then I'll kick them around a bit to show you an example of my way of doing it.
Title: Re: Circuit and board review?
Post by: Soeren on December 23, 2012, 07:15:37 PM
Hi,

I hope you feel better.
Thanks :)
I think it'll be a couple of days more at least, but smoking hot cocoa with a generous shot of whisky every now and then does make it easier to talk and (at least feels like it) helps lowering the fever ;D
Title: Re: Circuit and board review?
Post by: ErikY on December 23, 2012, 07:51:43 PM
OK, I zipped up the .sch and the .brd files, only thing I can think of is I use a Mac, maybe that makes larger files than windows versions. Either way, the zip file is only 70kb.

The .sch file is more complete than the board, I kind of stopped that until I get the sch right first.

I think I understand how to use the cap close to the servos, but not exactly sure how to do it in the schematic.

I will try what you mention on the pads, makes sense.

Sounds like you have something bad, I live on the east coast of the states, and there are quite a few bad bugs going around like that here. I may have to try the hot cocoa and whiskey trick if get it. Hope you feel better soon!

Thanks again for your help on this. I am pretty new to all of this stuff, and have learned pretty quickly that before I can get too deep into this hobby, I really need to nail down the basics.

Title: Re: Circuit and board review?
Post by: Soeren on December 24, 2012, 10:17:53 AM
Hi,

The .sch file is more complete than the board, I kind of stopped that until I get the sch right first.
I remade the PCB from start (by renaming the .sch file)

Your schematic had some wires that wasn't connected (eg. where they had 90° angles), so I think you're using the wire button(?) Use the net button instead, then the junctions is placed automatically and you have better control over your nets (net = anything that connects through a wire or via symbols like +5V and such).

Whenever possible, place inputs left of the controller and outputs to the right. That makes it much easier to read a schematic.

Avoid overdoing the number of power symbols when it's possible to make "clean" wiring - less symbols = less clutter.

Use consistent symbols. An arrow saying 6V with a "+5V circle" doesn't rhime. I've changed it to +UB circles, as I think you just plug the battery in there(?).
Remember that a 6V battery discharges to 3.6V over it's full discharge life.
I changed the lettering to "linear regulator". If you are using a switcher, the caps will likely have to change accordingly - a buck/boost or similar switcher will help getting the batteries discharged properly.

The 7805 needs an input voltage of around 8V to stay in regulation. Worst case, a too low voltage may even make the regulator oscillate, giving a much higher (than 5V) output, destroying the logics it feeds.

There's a text field saying "Reset button", but no button?

I added a resistor for "LED 1 white". You have two LED 1's (white and blue).
I also added ground and supply "bars" for the non committed A/D-C lines. They're easy to remove if you don't need them.

Changed C3 to a 1206, to mount on the solder side, right next to the pins it has to buffer.
C5 (can be a higher value) mounts near the servo pins and buffers both servos.

Consider this an example and nothing more. I made some assumptions about how you are going to use it and your needs may be different.

I ran the Drill-aid ULP, but it had very different results in ver 6.1.0, which is the most reason version I have installed, from how it handles in ver 4.16 which I normally use (they lowered the contrast substantially starting at ver 5).

Why not break out at least some of the 9 remaining I/O pins? There's ample room on the PCB


I think I understand how to use the cap close to the servos, but not exactly sure how to do it in the schematic.
See the attached for one example, but there's always more than one way to shave a goat.


I will try what you mention on the pads, makes sense.
Yes and more important, it will teach you a little of how it all goes together - soon you'll be making your own symbols :)


I may have to try the hot cocoa and whiskey trick if get it. Hope you feel better soon!
Thanks and do try - works wonders even if you're not ill ;)


I am pretty new to all of this stuff, and have learned pretty quickly that before I can get too deep into this hobby, I really need to nail down the basics.
You sure have "grown" since you started here, but you're right, too many people forget that a sound foundation is necessary.
Title: Re: Circuit and board review?
Post by: ErikY on December 24, 2012, 10:47:16 AM
Soren, thanks so much for this, I really appreciate it. I probably won't have time to loo at the schematic until tonight or tomorrow, as i am traveling today,but I am very appreciative of you taking the time to help me out. As soon as I get through this, I will reply, just wanted to say thanks much right away!
Title: Re: Circuit and board review?
Post by: Soeren on December 24, 2012, 11:27:14 AM
Hi,

You're welcome. Happy trails and Merry X-mas (we do the gift swapping tonight here in DK :))
Title: Re: Circuit and board review?
Post by: ErikY on December 24, 2012, 11:57:12 AM
Hi,

You're welcome. Happy trails and Merry X-mas (we do the gift swapping tonight here in DK :))

Thanks! Same to you. I may need the whiskey tonight too, not for the flu, but traveling with my 3 young kids requires lots of alcohol!

Merry x-mas!
Title: Re: Circuit and board review?
Post by: ErikY on December 24, 2012, 12:14:18 PM
Soren,

Not sure if I am missing it, but I am not seeing the attachment. Did you attach the file? Thanks!
Title: Re: Circuit and board review?
Post by: jwatte on December 24, 2012, 12:58:55 PM
Quote
f you use the "Smash All" ULP

What is the benefit of this over just doing it in the GUI?

1) frame select everything
2) click smash tool
3) ctrl-right-click any one object in the selection

Now, everything's smashed, and it took 3 seconds.
Title: Re: Circuit and board review?
Post by: Soeren on December 24, 2012, 04:51:29 PM
Hi,

Not sure if I am missing it, but I am not seeing the attachment. Did you attach the file? Thanks!
Sorry about that. Dozed off a couple of times when writing the post and missed to attach the file.
Should be attached to this post.
Title: Re: Circuit and board review?
Post by: ErikY on December 24, 2012, 09:52:09 PM
Soren, No prob, thanks, got it! I am going to play around with this tomorrow and will post back, thanks again!
Title: Re: Circuit and board review?
Post by: ErikY on December 25, 2012, 02:26:56 PM
Soren,

Wow, I went through this last night and today.

Really incredibly helpful! I cannot tell you how much I appreciate this!

The schematic makes a lot of sense, and the board layout is very elegant.

I plan on completely re-doing the sch and the brd myself, not because this isn't awesome, it is, but because I feel like I need to do it myself before fabricating it, I will use yours as a guide.

Responses to some questions above, and some comments/questions as well.

I originally was planning on a reset button, I had it in the schematic, but I had a very hard time getting it on the board because of wiring, so I removed it, thinking for this bot it was not critical, I would like to include it if I can fit it on the board without any crazy jumpers, I am going to play around more.

I did not have a resistor on my power LED's because I was going to solder a 330ohm resistor to each LED, but this makes much more sense.

I don't see any resistors on the forward LED's, so I am going to include one for each, like you did for the power LED, rather than soldering directly to the LED, I will attempt to arrange it so that I can use the same 330ohm resistor for all 3 LED mounts.

I originally did not include the negative and positive bus to the analog ports (other than for the potentiometer) because my IR board has a power source already connected to it, but I like this idea, gives flexibility if needed, but I don't have to use it if not.

It looks like you are including a surface mount cap for c3 under the ATMega 328P, I never would have thought of this, very interesting and very helpful for creating the board, just have to learn to solder surface mount components now! If I am not so courageous as to solder mount, I am assuming I can just mount this cap outside the chip, and run my +5V around k3, k5 and k11 to get there, this would clearly not be as elegant, but I would think it would work.

I am trying to calculate how big of a capacitor I really need for c5. I am using 2 HS-311's, and they say at no load operating, they drain 180mA each. From what I have read, a standard hobby servo can draw up about 1 amp at startup, so for two that would be 2amps. So, 22uF would be the bottom of the range Admin recommends in his Electronics tutorial, of 1-10uF for every Amp. I am assuming there is some science/art in selecting between 22 and 220uF in this case.

In the schematic, it looks like the +5V that runs through r1 and c4 is connected to Pin 1 (PC6) but on the board it looks like they are almost but not quite touching on the pad of c4 and the pad for r1, was this an oversight or intentional? I think I need to run a wire between the two pads.

With K5, I am curious to why you chose to place the pins the way you did, I would have assumed  that A5 would go in the middle of k5, and ground, and +5V on the outer pins for the potentiometer.This will work just fine, I am just curious as I would have done it a bit different.

For the non-grounder pour, I did not see you restrict anything on your board. I am playing round with layer 42, and I see how it works, it's very cool. My question on this is, what is the rule of thumb for removing? Do I remove as much area where the ground is not needed, as possible? The noise factor makes complete sense, so to me I would think I would want to make sure ground has paths to get wherever it needs to go, but no more than that.

I see on your board you do have a .07 width wire going from the cap to the servo for +UB. Is this how you would recommend it, or should I take this wire off the board, and actually use say 24 gauge wire from the +cap to each servo pin?

I am sorry for so many questions, I am just really trying to understand these things so I can do them myself in the future, and not ask for so much help.

Again, this is incredibly helpful, and I really appreciate your help!

Title: Re: Circuit and board review?
Post by: Soeren on December 25, 2012, 03:39:06 PM
Quote
f you use the "Smash All" ULP

What is the benefit of this over just doing it in the GUI?

1) frame select everything
2) click smash tool
3) ctrl-right-click any one object in the selection

Now, everything's smashed, and it took 3 seconds.
Around 1.5 to 2.0s apparently.
Click ULP button -> double click on ULP
Title: Re: Circuit and board review?
Post by: Soeren on December 25, 2012, 06:30:46 PM
Hi,

I plan on completely re-doing the sch and the brd myself, not because this isn't awesome, it is, but because I feel like I need to do it myself before fabricating it, I will use yours as a guide.
No sweat, doing it yourself gives you a better understanding and I only meant it as an example, nothing more :)


I originally was planning on a reset button, I had it in the schematic, but I had a very hard time getting it on the board because of wiring, so I removed it, thinking for this bot it was not critical, I would like to include it if I can fit it on the board without any crazy jumpers, I am going to play around more.
If you don't mind a 2 pin connector in a slightly odd place, it should be easy.
Personally, I'd rather include a few jumpers, than having to use double sided PCB on home etched boards, but while I won't recommend homemade double sided PCB for a beginner, with a little experience it's perfectly doable. If you get the PCB made in a PCB fab-house, on the other hand, it's best to go with double sided PCB, even if one side is more or less a ground plane.


I did not have a resistor on my power LED's because I was going to solder a 330ohm resistor to each LED, but this makes much more sense.
Ah OK.


I don't see any resistors on the forward LED's, so I am going to include one for each, like you did for the power LED, rather than soldering directly to the LED, I will attempt to arrange it so that I can use the same 330ohm resistor for all 3 LED mounts.
Yeah, always double check anything coming from a fever ridden brain ;D
I should have put resistors on all LEDs of course.

Not sure whether you mean "use the same resistor" or "use the same value"?
If you have a parallel combination of LEDs, the value should be halved,but it's better to get each a resistor, or any initial unbalance between them will usually widen - in severe cases to an extent where one of them hog all, or most of, the current.

2 pin wire mounted female "headers" are a perfect fit for conventional LEDs btw.


It looks like you are including a surface mount cap for c3 under the ATMega 328P, I never would have thought of this, very interesting and very helpful for creating the board, just have to learn to solder surface mount components now!
The 1206 size is huge and it is very easy to solder

To solder them, tin one of the pads.
Using tweezers, tin one end of the cap lightly.
Position the cap over the pads (tinned end on tinned pad).
Pres down lightly on the middle of it, while you reheat the solder.
Then solder other end adding a very light amount of (rosin core) solder.
Finally redo the first, adding aeither the smallest amount of solder or, even better, some fluss.

Here's a photo of a remote I made for my DSLR, none of the SMD's are as large as a 1206, as I build it into a cigarette lighter that had a white LED originally, so space was a commodity. It ain't exactly pretty and I even pinched off a corner of the microcontroller, but it's hidden inside the lighter anyway and it works aces - covers the same distance as the original remote (which has got no lighter) costing around $30-$40. Cost me the ~$0.35 microcontroller, the rest was recycled from junk :)
(http://That.Homepage.dk/Img/LighterRemote.jpg)


If I am not so courageous as to solder mount, I am assuming I can just mount this cap outside the chip, and run my +5V around k3, k5 and k11 to get there, this would clearly not be as elegant, but I would think it would work.
Not sure why you want to change the +5V trace?
If you keep it as is, just mount a regular cap right where the lettering on the PCB says "100n" now, with one hole directly next to pin 22 (gnd) and one next to pin 20 (assuming a 2 unit pin distance).


I am trying to calculate how big of a capacitor I really need for c5. I am using 2 HS-311's, and they say at no load operating, they drain 180mA each. From what I have read, a standard hobby servo can draw up about 1 amp at startup, so for two that would be 2amps. So, 22uF would be the bottom of the range Admin recommends in his Electronics tutorial, of 1-10uF for every Amp. I am assuming there is some science/art in selecting between 22 and 220uF in this case.
Admittedly, I just copied C2 (in the schematic part) to get C5 and left it with its original value.

The science behind selecting a value for the servo buffer-cap is more a matter of experience, coupled with knowing the specifics of a given project, as it depends on things like: Battery used, wiring gauge/trace width and how much voltage sag you'll accept.
A rule of thumb is only as good as the thumbs (or factors) involved. I usually don't skimp on buffer capacitance, but initially select what my gut tells me for a given application and then measure the sag under the most adverse conditions to see if more is needed.

The lower the impedance of battery, wiring and traces, the less capacitance is needed.
Without knowing what's outside the board, I'd go up to 470µF or even 1000µF if space allows.


In the schematic, it looks like the +5V that runs through r1 and c4 is connected to Pin 1 (PC6) but on the board it looks like they are almost but not quite touching on the pad of c4 and the pad for r1, was this an oversight or intentional? I think I need to run a wire between the two pads.
Another oops.
It's hard to see, but if you turn off some of the layers, the "air wire" will be clearly visible. It should have been a 0.5 width trace of course.


With K5, I am curious to why you chose to place the pins the way you did, I would have assumed  that A5 would go in the middle of k5, and ground, and +5V on the outer pins for the potentiometer.This will work just fine, I am just curious as I would have done it a bit different.
That is what gives the best wiring - ground at the outside, +5V in the middle and the I/O at the pin nearest the controller. When wired to the pot via a connector, it doesn't matter which is which, but it's sometimes make or break for a clean PCB layout.
I'll blame it on the fever that I didn't swapped the positions of  K10 and K11 as well, as is, it's inconsistent and with the swap, the +5V would have had a straight trace, rather than the angled one.


For the non-grounder pour, I did not see you restrict anything on your board. I am playing round with layer 42, and I see how it works, it's very cool. My question on this is, what is the rule of thumb for removing? Do I remove as much area where the ground is not needed, as possible? The noise factor makes complete sense, so to me I would think I would want to make sure ground has paths to get wherever it needs to go, but no more than that.
I didn't have to restrict anything, as all of the pour is connected. If you name the pour the same as the net you want it to be (GND here), it will tell you something like "Polygons may be broken", if it cannot connect all of the pour.


I see on your board you do have a .07 width wire going from the cap to the servo for +UB. Is this how you would recommend it, or should I take this wire off the board, and actually use say 24 gauge wire from the +cap to each servo pin?
Either way will work. Traces that carries a certain amount of current should always be tinned and with high currents a copper wire or -braid (eg. the shield braid in antenna cable, or similar) should be soldered onto the trace (watch for shorts) - fluss is a good thing with braid.


I am sorry for so many questions, [...]
Don't be :)
Title: Re: Circuit and board review?
Post by: ErikY on December 26, 2012, 06:04:43 AM

If you don't mind a 2 pin connector in a slightly odd place, it should be easy.
Personally, I'd rather include a few jumpers, than having to use double sided PCB on home etched boards, but while I won't recommend homemade double sided PCB for a beginner, with a little experience it's perfectly doable. If you get the PCB made in a PCB fab-house, on the other hand, it's best to go with double sided PCB, even if one side is more or less a ground plane.

Got it, I will give it a whirl again.

Quote
Yeah, always double check anything coming from a fever ridden brain ;D
I should have put resistors on all LEDs of course.

I got it, will do, I am amazed at how well this came out given a high fever, I would love to be able to do this feeling good, let alone feeling like complete hell.

Quote
Not sure whether you mean "use the same resistor" or "use the same value"?
If you have a parallel combination of LEDs, the value should be halved,but it's better to get each a resistor, or any initial unbalance between them will usually widen - in severe cases to an extent where one of them hog all, or most of, the current.

Yeah, I need to put the same resistor value for each.

Quote
2 pin wire mounted female "headers" are a perfect fit for conventional LEDs btw.

Great to know!

Quote
The 1206 size is huge and it is very easy to solder

To solder them, tin one of the pads.
Using tweezers, tin one end of the cap lightly.
Position the cap over the pads (tinned end on tinned pad).
Pres down lightly on the middle of it, while you reheat the solder.
Then solder other end adding a very light amount of (rosin core) solder.
Finally redo the first, adding aeither the smallest amount of solder or, even better, some fluss.

I am definitely going to give it a shot, I will probably buy a few of them, so I can practice on a different board first.

Quote
Here's a photo of a remote I made for my DSLR, none of the SMD's are as large as a 1206, as I build it into a cigarette lighter that had a white LED originally, so space was a commodity. It ain't exactly pretty and I even pinched off a corner of the microcontroller, but it's hidden inside the lighter anyway and it works aces - covers the same distance as the original remote (which has got no lighter) costing around $30-$40. Cost me the ~$0.35 microcontroller, the rest was recycled from junk :)
(http://That.Homepage.dk/Img/LighterRemote.jpg)


That is cool!


Quote
Not sure why you want to change the +5V trace?
If you keep it as is, just mount a regular cap right where the lettering on the PCB says "100n" now, with one hole directly next to pin 22 (gnd) and one next to pin 20 (assuming a 2 unit pin distance).

OK, I see what you are saying. This is where my understanding of electron flow screws me up. I understand they flow from GND to +, so I assumed that they had to have gone through the entire cap and out prior to flowing into pin 20 and pin 21, but my understanding of how this actually works is not good, and this is something I really need to get a handle on, but I am struggling with it. I am having a hard time finding any resources that can explain this well.


Quote
Admittedly, I just copied C2 (in the schematic part) to get C5 and left it with its original value.

The science behind selecting a value for the servo buffer-cap is more a matter of experience, coupled with knowing the specifics of a given project, as it depends on things like: Battery used, wiring gauge/trace width and how much voltage sag you'll accept.
A rule of thumb is only as good as the thumbs (or factors) involved. I usually don't skimp on buffer capacitance, but initially select what my gut tells me for a given application and then measure the sag under the most adverse conditions to see if more is needed.

The lower the impedance of battery, wiring and traces, the less capacitance is needed.
Without knowing what's outside the board, I'd go up to 470µF or even 1000µF if space allows.

Got it, I will play around with this.


Quote
That is what gives the best wiring - ground at the outside, +5V in the middle and the I/O at the pin nearest the controller. When wired to the pot via a connector, it doesn't matter which is which, but it's sometimes make or break for a clean PCB layout.
I'll blame it on the fever that I didn't swapped the positions of  K10 and K11 as well, as is, it's inconsistent and with the swap, the +5V would have had a straight trace, rather than the angled one.

Got it.

Quote
I didn't have to restrict anything, as all of the pour is connected. If you name the pour the same as the net you want it to be (GND here), it will tell you something like "Polygons may be broken", if it cannot connect all of the pour.

OK, makes sense.

Quote
Either way will work. Traces that carries a certain amount of current should always be tinned and with high currents a copper wire or -braid (eg. the shield braid in antenna cable, or similar) should be soldered onto the trace (watch for shorts) - fluss is a good thing with braid.

OK, makes sense, I will do this.

Quote
Don't be :)

Thanks again I cannot even tell you how helpful this has been, and I truly appreciate it!
Title: Re: Circuit and board review?
Post by: jwatte on December 26, 2012, 07:03:40 PM
Quote
I will attempt to arrange it so that I can use the same 330ohm resistor for all 3 LED mounts.

One small detail, depending on how you meant this sentence:

The same kind of 330 ohm resistor will work fine.

The *same* 330 ohm resistor will not work fine, if more than one LED is on at the same time (such as the power and forward, say.) The reason is that the voltage drop across the resistor equals resistance times current. When two LEDs are lit and both currents go through the resistor, it will give you a different voltage drop, and thus, the two LEDs will be dimmer than a single LED would be when using the same resistor.

The reason I say "different" and not "double" is that the voltage/current function of the LEDs is non-linear.

If you want a single component, biasing any number of LEDs appropriately, use a Zener with the appropriate voltage drop, assuming the LEDs all need the same voltage.
Title: Re: Circuit and board review?
Post by: ErikY on December 26, 2012, 07:38:08 PM
Quote
I will attempt to arrange it so that I can use the same 330ohm resistor for all 3 LED mounts.

One small detail, depending on how you meant this sentence:

The same kind of 330 ohm resistor will work fine.

The *same* 330 ohm resistor will not work fine, if more than one LED is on at the same time (such as the power and forward, say.) The reason is that the voltage drop across the resistor equals resistance times current. When two LEDs are lit and both currents go through the resistor, it will give you a different voltage drop, and thus, the two LEDs will be dimmer than a single LED would be when using the same resistor.

The reason I say "different" and not "double" is that the voltage/current function of the LEDs is non-linear.

If you want a single component, biasing any number of LEDs appropriately, use a Zener with the appropriate voltage drop, assuming the LEDs all need the same voltage.

Yeah, sorry for the confusion.

I meant the same value resistor, I will use one for each LED.

Thanks!
Title: Re: Circuit and board review?
Post by: Soeren on December 26, 2012, 08:24:20 PM
Hi,

OK, I see what you are saying. This is where my understanding of electron flow screws me up. I understand they flow from GND to +,
They do, but you shouldn't care unless you have really small tweezers ;)

It's a huge misunderstanding to discuss electron flow in introductory/beginners texts I think, but sadly, most authors just mimick those before them and it really doesn't matter a bit for a good many years into electronics, so just forget electron flow and go with current flow, which is something you need from the get go and which by definition flows from positive to negative!


[...] so I assumed that they had to have gone through the entire cap and out prior to flowing into pin 20 and pin 21, but my understanding of how this actually works is not good, and this is something I really need to get a handle on, but I am struggling with it. I am having a hard time finding any resources that can explain this well.
As long as the cap is close to the terminals it will work, as it only needs to filter out fluctuations on the A/D reference.

If you look at C3, current(!) should pass the cap on it's way to the rest of the circuit. If the regulator output was lead directly on and the capacitor connected to that trace by a "side" trace, it would have less effect, as there's a current draw and digital shifts draws current in short peaks.


Capacitors are used for several things. Eg. buffering, which usually takes larger caps, while filtering is usually made with smaller caps.
A common thing for most applications is, that they should have low impedance connections, so long narrow tracks should be avoided.

As a side note, don't run analog and digital lines closely in parallel, as the digital noise would break over to the analog lines. In critical circuits, you make digital and analog ground planes and connect them in a single place only.


A fairly OK set of tutorials can be found at All About Circuits (http://www.allaboutcircuits.com/) , but skip the part with electron flow ;D
Title: Re: Circuit and board review?
Post by: ErikY on December 27, 2012, 05:51:23 AM
Soren,

Thanks, as usual, very helpful.

I actually have read All about circuits, and I agree that for the most part, it is fantastic.

Unfortunately, I did also read the electron flow vs. conventional flow, and that was the one that really screwed me up.

My brain has a problem with knowing something is actually one way, and pretending it is another way. I am working on that!

I like the idea of current flow, I have never heard of that before, but it is helpful. This is also very helpful for the capacitors, thanks!

Title: Re: Circuit and board review?
Post by: ErikY on December 27, 2012, 12:27:56 PM
OK, so I finally finished re-doing the schematic and the board, with a ton of help from Soren!

I tried really hard to apply everything that was recommended.

I learned a ton doing this, and I am truly appreciative of all the help!

I now have the reset button as well, which I THINK is wired correctly on the board, but I am not 100% sure. If I am interpreting the datasheet correctly for the 328P, all I need to do is send a different voltage, between -.5V and 13V, and by connecting the ground to the capacitor, I think the button is acting as a pulldown voltage to the reset pin, causing a reset, but I don't have 100% confidence I am reading it correctly, or that I am executing this properly

For some reason, which I just cannot figure out, I still have a GND net going from Pin 8 (GND) to Pin 21 (AREF).

From what I see, my ground plane is touching both pins clearly, so I am not sure why that is still there.

I know I am asking a lot here, with all you have already helped, but if you could give me a last set of eyes for a review on this before I fabricate this, I would really appreciate it!

Thanks again for all of your help!
Title: Re: Circuit and board review?
Post by: waltr on December 27, 2012, 01:19:21 PM
Looking pretty good. I can answer some of your questions.

The Reset button looks correct. The 10k resistor holds the Reset (pin 1) at +5V (logic high) and the switch, when pressed, takes the pin to ground (0V or logic low).

I see a net connection between pins 8 and 22 that are not connected with copper. Also there are two isolated ground pours.

Also, the trace from pin 12 to JP9 does not need to go around the end of the atmega. Just route this direct.

I see that your have a number of Atmega pins unused. I recommend adding some pads for connectors and routing these pins to the connectors. This way if you want to add some thing (sensor input or a control output you have a connect pad into which to solder a wire.

Title: Re: Circuit and board review?
Post by: ErikY on December 27, 2012, 02:00:23 PM
Looking pretty good. I can answer some of your questions.

The Reset button looks correct. The 10k resistor holds the Reset (pin 1) at +5V (logic high) and the switch, when pressed, takes the pin to ground (0V or logic low).

Great, thanks!

Quote
I see a net connection between pins 8 and 22 that are not connected with copper. Also there are two isolated ground pours.

I am embarrassed that I did not see the two separate pours! I should have seen that! I am assuming that is the reason for that trace between those two pins, I could not figure that out!

Quote
Also, the trace from pin 12 to JP9 does not need to go around the end of the atmega. Just route this direct.

I know what you mean, I tried to do this originally, but I had to make the wire so thin to get it direct, that I just figured I had the space to go around, so I just did it around rather than thin.

I guess this brings up a question, what is better, shorter thinner trace, or wider longer trace?

Quote
I see that your have a number of Atmega pins unused. I recommend adding some pads for connectors and routing these pins to the connectors. This way if you want to add some thing (sensor input or a control output you have a connect pad into which to solder a wire.

I agree with you, but for this particular board, I only plan on using it on this one line following bot. I plan on giving this to my daughter, and letting her have it and never removing the board, so I just figured less holes to drill since I will never put anything else on it. Any other board, I would have definitely done that.

Thanks for your help! I appreciate it!
Title: Re: Circuit and board review?
Post by: waltr on December 27, 2012, 03:58:11 PM
Quote
    Also, the trace from pin 12 to JP9 does not need to go around the end of the atmega. Just route this direct.


I know what you mean, I tried to do this originally, but I had to make the wire so thin to get it direct, that I just figured I had the space to go around, so I just did it around rather than thin.

I guess this brings up a question, what is better, shorter thinner trace, or wider longer trace?

It depends but I prefer shorter traces to longer traces in almost all cases.
If the current through the trace is low then a narrow trace doesn't hurt. Another 'trick' is to make the trace narrower only where the it needs to be. In this case make the traces to pins 11 & 12 about half their width while near the Atmega (so there is enough clearance between them) then the width you used to the connector.

I believe these traces are the control signals to the servos. These would not carry much current so could be narrower.

The recommendation was mainly so that you can route traces from the 'spare' pins to connector pads. If you do not connect to the 'spare' pins then your routing to pin 12 is perfectly fine.
Title: Re: Circuit and board review?
Post by: ErikY on December 27, 2012, 04:11:55 PM
Quote
    Also, the trace from pin 12 to JP9 does not need to go around the end of the atmega. Just route this direct.


I know what you mean, I tried to do this originally, but I had to make the wire so thin to get it direct, that I just figured I had the space to go around, so I just did it around rather than thin.

I guess this brings up a question, what is better, shorter thinner trace, or wider longer trace?

It depends but I prefer shorter traces to longer traces in almost all cases.
If the current through the trace is low then a narrow trace doesn't hurt. Another 'trick' is to make the trace narrower only where the it needs to be. In this case make the traces to pins 11 & 12 about half their width while near the Atmega (so there is enough clearance between them) then the width you used to the connector.

I believe these traces are the control signals to the servos. These would not carry much current so could be narrower.

The recommendation was mainly so that you can route traces from the 'spare' pins to connector pads. If you do not connect to the 'spare' pins then your routing to pin 12 is perfectly fine.

Gotcha, that makes sense, thanks for your help!
Title: Re: Circuit and board review?
Post by: ErikY on December 27, 2012, 04:17:11 PM
I took another stab at the board, thank God I discovered rip up, I cannot even tell you what I used to do when I needed to modify my board before I discovered rip up, and the F/B annotation would not let me remove wires!

I moved some resistors and re-routed the +5V the way Soren did it, except my cap is not surface mount since I ordered them and it will take a week or so to get them, I will use what I have on hand.

I also moved my wiring from pin 12 based on Waltr's recommendation, I like it better this way.

I now have one ground pour, and no remaining traces!

I probably spent waaaaay too much time on this board, considering it is a simple line following bot that won't do a whole lot, but I feel that I have learned an awful lot in doing so, that will be very helpful as I progress in robotics/electronics.

I had always been somewhat scared of schematics when I saw them, and found reading complicated ones to be greek, but forcing myself to build the schematic first, than the board leaves me feeling much more confident reading schematics.

Title: Re: Circuit and board review?
Post by: waltr on December 28, 2012, 10:31:06 AM
Looks good now.

Yea, drawing schematics and doing PCB layout can take some time. But it is sure easier to fix the PCB while on your computer screen than after it is made into copper.

The next PCB will not take as much time since you needed to learn how to use the CAD program.

I hope Soeren can take one last look before you etch the board in case the rest of us missed something.
Title: Re: Circuit and board review?
Post by: ErikY on December 28, 2012, 02:48:18 PM
Waltr,

Thanks for taking the time to help me out and look it over!