SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By SXRguyinMA
#116815
Hi all. I used an Arduino for my project. Wanting to use my Arduino further, I designed and had a PCB made with the ATmega, crystal, caps, etc needed to run the Arduino, as well as everything else for my project. It worked 100% in the breadboard, but now that it's assembled on the PCB I'm having issues.

Basically when the computer is turned on, 12v and 5v goes into the board. The arduino uses the 5v as a sense to know when the computer is on. The 12v then runs into a 5v regulator, and out to a pair of 5v 10F caps in series. The Arduino takes a reading from a temp sensor, and runs a servo accordingly. When the computer is shut off, the 10F caps provide power to set the servo to its closed position (the Arduino does the when the 5v is taken away from the sense pin = computer off).

The problem I'm having is that on first startup when the caps are drained, it doesn't do anything. You can freely move the servo by hand. Now if I unplug and plug it back in a couple times it'll work fine. It works as long as there's a small charge in the caps. If I let them drain completely, it won't work again. Now this worked 100% in the breadboard setup, but for some reason doesn't want to work now lol. Any ideas? Am I missing something? I designed the PCB directly from the breadboard setup.

Link to original design thread:
http://www.thebestcasescenario.com/foru ... 932&page=3

Link to project this is used in:
http://www.thebestcasescenario.com/foru ... post289709

the Eagle layout:
Image

The boards:
Image

Image

Image

Assembled:
Image

Image
By esklar81
#116836
SXRguyinMA,

I didn't see a schematic and I'm not sufficiently motivated to draw one from your board layout, but if you post one, it might help.

In the meantime, how long have you waited before declaring failure? The time constant of 5 farads and 15 ohms is 75 seconds.

The initial current is I = (Vsource-Vcap)/R = (5-0) V/15 ohm = 333 mA. I looked, but couldn't identify your voltage regulator. How happy is it at 333 mA? If you were to overload it substantially, it might well shut down to cool off, then switch itself back on. That would further delay charging.

Here are a few questions/suggestions for investigating this:
  1. If you monitor the voltage at the capacitors during cold startup, what, roughly, is the shape of the voltage vs. time curve?
  2. If you monitor the voltage at the regulator output during cold startup, what, roughly, is the shape of the voltage vs. time curve?
  3. If you monitor the voltage at the servo power pin (both with and without a servo attached) during cold startup, what, roughly, is the shape of the voltage vs. time curve?
  4. If you monitor the voltage at the ATmega power pin (both with and without a servo attached) during cold startup, what, roughly, is the shape of the voltage vs. time curve?
  5. Check to make sure the diode is facing the right way.
  6. Check to make sure the capacitors are facing the right way.
  7. What, if any, components are not exact matches between the breadboard that worked and the PCB that doesn't?
  8. Check your soldering. Look for cold or loose joints, solder bridges, and thermal damage to the board.
  9. Have you changed what is wired to the servo's 5V pin? It appears from a brief look at the two generations of boards that you have.
  10. Without referring to previous schematics, sketches, or notes, draw a schematic of your circuit by analyzing the PCB. Go do something else for, at least, a couple of hours. Then draw (without referring to any documentation or memory) a schematic by analyzing your breadboard. Post both schematics so we can compare them. (Unlike yours, the eyeballs on this forum aren't conditioned to see the circuit a certain way.


Out of curiosity, why did you decide to store 5 V, rather than 12 V? That is, why put the capacitance after the regulator rather than before it?

Happy Hunting,
Eric
By SXRguyinMA
#116838
Well I put the caps after the power as they're 2.5V 10F caps, so in series I get 5F @ 5v, which is what the arduino and servo need to run. From a cold start it takes approx 4 mins for the caps to fully charge (4.98v according to my meter). When the 5v and 12v is takena way, the caps are used to move the servo, then they just drain out, which takes about 10 mins to fully discharge.

I'm at work right now, but I'll get the schematic(s) and cold stat-up voltages for you this evening. Thanks so far for your help!

Also, nothing is different from the breadboard setup. The components in thes PCB are the exact components I used in the breadboard. I know the 5v reg is this one from Radio Shack. It does get fairly warm at first (until the caps are charged), which is why I have the heatsink on it. I used it for quite some time in the breadboard without the heatsink with no problems though.

The diode and capacitors are facing the right way.

I've gone through and triple-checked the sodlering, all is good. I noticed a trace I forgot to put on the board, so I soldered a jumper, but it didn't change anything. I've also tried several different ATMega chips that I have, all with the same results.

The servo's 5v pin hasn't changed at all. It shares the 5v input that goes to the temp sensor. And once it starts working, it works 100%. Another strange thing I found is that when it's first powered up and not working properly, the reset button seems to have no effect at all. Once it's working properly, the button works as intended. I've left it plugged in for over an hour (in it's non-working state) with no change.
By SXRguyinMA
#116918
ok so the results:

#1: Measured + and - of caps in series
start at 13.9mV
2V in 39s
2.5V in 55s
3.5V in 1:48
4V in 2:36
4.5V in 4:05
4.65V in 5:00

I could hit the reset button and get it to function @ 1min, so roughly 2.5V

#2: 140mV at start, went to 4.98V in <1s

#3: (w/o servo)
.523V at start
4.66V <1s
4.7V 10s
4.75v 2:15

#3 (with servo)
.935V start
4.9V <1s

#4 I couldn't measure because I couldn't get a good test grip on the ATMega's 5v pin.

It would seem from test #1 that the ATMega simply isnt getting enough voltage. But the 5v out from the regulator goes into the caps, the ATMega, and then on to the temp sensor and servo. maybe the traces need to be bigger?
By SXRguyinMA
#116943
I think I might have found it. For giggles I decided to see what zener was in there. Turns out is a 12v zener (4742) instead of a 5v zener (4733). Think this might be it? I'll unsolder the 12v and put in a 5v later on and see if this fixes it
By esklar81
#116985
Previously, I suggested that you:
"Without referring to previous schematics, sketches, or notes, draw a schematic of your circuit by analyzing the PCB. Go do something else for, at least, a couple of hours. Then draw (without referring to any documentation or memory) a schematic by analyzing your breadboard. Post both schematics so we can compare them. (Unlike yours, the eyeballs on this forum aren't conditioned to see the circuit a certain way."

You have posted one schematic, but didn't identify the source. Furthermore, the schematic presents some difficulty. Not only are the voltage regulator leads confused, it's not clear whether the zener diode is in parallel with the 15 ohm resistor between the voltage regulator output and the capacitors or whether the zener diode is the only path between the voltage regulator output and the capacitors and the 15 ohm resistor is between the positive side of the capacitors and (JP1-2, JP2-2, and IC2-7). The former appears consistent with the reported behavior, but the latter is consistent with the schematic.

What is the intended function of the zener diode?

Which connection do you believe was missing from the board. How did you replace it by wire?

Eric
By SXRguyinMA
#117007
the schematic is from the Eagle layout, and I did mention that they've got the pins on the vreg wrong in the schemtic. I layed it out, then looked at the board and nothing was right, so I had to figure out what was what and rewire it that way. "Out" on the schematic is "GND" on the actual part, "GND" on the schematic is actually "IN" and "IN" on the schematic is actually "OUT". Don't know why it's that way but it is.

I haven't done a redraw of the schematic from the breadboard because my breadboard is currently in use testing an unrelated project.

The 15 Ohm resistor and the diode are in series between the vreg output and the positive side of the caps. The purpose of the diode I have no idea. A guy on another forum (the one I linked to with the project) had told me to set it up that way. Here is the original thread for this setup. You'll need this site for the circuit simulator app so make sense of the code. If you go to file->import (in the java applet) it'll load the code and you can see where this setup originated from.

The missing connection was one of the VCC pins to the ATMega. The schematic and board view show it there, but the boards didnt come from Batch PCB with them. The board's trace went into the AREF pin, but not the VCC pin next to it.
By esklar81
#117019
SXRguyinMA wrote:the schematic is from the Eagle layout, and I did mention that they've
Who is "they"?
SXRguyinMA wrote:got the pins on the vreg wrong in the schemtic. I layed it out, then looked at the board and nothing was right, so I had to figure out what was what and rewire it that way. "Out" on the schematic is "GND" on the actual part, "GND" on the schematic is actually "IN" and "IN" on the schematic is actually "OUT". Don't know why it's that way but it is.
Do the part number of the Eagle component and the physical component match (both the silicon and the package)? If not, why would you expect the lead arrangement to match?
SXRguyinMA wrote:I haven't done a redraw of the schematic from the breadboard because my breadboard is currently in use testing an unrelated project.
You also, as far as I can tell, have not redrawn the schematic from the assembled PCB. Given the discrepancies among your description of the PCB, the photographs of the PCB, the schematic you posted, and your description of the behavior, I'm not inclined to spend time figuring out why something that isn't the circuit you've assembled would behave the way the circuit you have assembled behaves. If you can reconstruct a working breadboard of this and provide schematics that are drawn from the PCB which doesn't work and from the breadboard which does, we can try to find the critical difference.
SXRguyinMA wrote:The 15 Ohm resistor and the diode are in series between the vreg output and the positive side of the caps. The purpose of the diode I have no idea. A guy on another forum (the one I linked to with the project) had told me to set it up that way.
If you are referring to the schematic on this page, it shows the 100 ohm resistor and zener diode in parallel. It appears that the intention was that the capacitor charge through the resistor (to protect the regulator from trying to provide "near-infinite" current at startup), but discharge through the zener diode (to provide a path from the capacitor to the board that has a fixed voltage drop, rather than relying on a path that has a voltage drop that increases with current). However, the schematic you posted shows the resistor and diode connected to each other at only one end. The lines on the other ends cross, but that crossing is not drawn as being an electrical junction.
SXRguyinMA wrote:The missing connection was one of the VCC pins to the ATMega. The schematic and board view show it there, but the boards didnt come from Batch PCB with them. The board's trace went into the AREF pin, but not the VCC pin next to it.
How did you generate the board drawing you sent to BatchPCB? Specifically, did you draw the board manually or have Eagle generate it from the schematic?

Eric
By SXRguyinMA
#117021
esklar81 wrote:Who is "they"?
Whoever designed that part for eagle.
esklar81 wrote:Do the part number of the Eagle component and the physical component match (both the silicon and the package)? If not, why would you expect the lead arrangement to match?
I used a standard 5v regulator from the sparkfun library that they provide, thinking it would be the same as the part that they sell.
esklar81 wrote:You also, as far as I can tell, have not redrawn the schematic from the assembled PCB. Given the discrepancies among your description of the PCB, the photographs of the PCB, the schematic you posted, and your description of the behavior, I'm not inclined to spend time figuring out why something that isn't the circuit you've assembled would behave the way the circuit you have assembled behaves. If you can reconstruct a working breadboard of this and provide schematics that are drawn from the PCB which doesn't work and from the breadboard which does, we can try to find the critical difference.
The schematic of the assembled PCB is the same as the schematic I posted. The photographs I posted are the same as the schematic, which are the same as the Eagle board layout. I will breadboard this back up tonight and post with the results.
esklar81 wrote:If you are referring to the schematic on this page, it shows the 100 ohm resistor and zener diode in parallel. It appears that the intention was that the capacitor charge through the resistor (to protect the regulator from trying to provide "near-infinite" current at startup), but discharge through the zener diode (to provide a path from the capacitor to the board that has a fixed voltage drop, rather than relying on a path that has a voltage drop that increases with current). However, the schematic you posted shows the resistor and diode connected to each other at only one end. The lines on the other ends cross, but that crossing is not drawn as being an electrical junction.
The schematic I posted shows the resistor and diode in parallel, and the board is the same. I typed that wrong, I apologize. They are in parallel. The output from the regulator goes to one end of the resistor and one end of the diode, and from the other end of the resistor and diode it goes out to the capacitors.
esklar81 wrote:How did you generate the board drawing you sent to BatchPCB? Specifically, did you draw the board manually or have Eagle generate it from the schematic?
I used the autoroute in Eagle, and I triple-checked the routing because I didn't want to waste money on board that were wrong, which is how I found the improper pin arrangement for the 5v regulator.

I also got the voltage measurement at the ATMega's VCC pin, and as soon as you plug it in it shoots right to 4.96v. So the IC is getting voltage, the temp sensor is getting voltage, the servo is getting voltage, but nothing happens until the caps charge to 2.5v, at which point it automatically starts working. The caps are just there to provide power when the computer is shut off for the servo to close. The charge state of the caps should be unrelated to the functionality of the system.
By esklar81
#117022
SXRguyinMA wrote:
esklar81 wrote:Do the part number of the Eagle component and the physical component match (both the silicon and the package)? If not, why would you expect the lead arrangement to match?
I used a standard 5v regulator from the sparkfun library that they provide, thinking it would be the same as the part that they sell.
According to their datasheets, the 7805 (the regulator you said you used, IIRC) and the 1117 (the low dropout regulator shown on your schematic) have different pin assignments: In-Gnd-Out and Gnd-Out-In, respectively, both in TO-220 packages.

In your schematic, you show In-Gnd-Out as the labels, but appear to have it wired as if it were Out-In-Gnd.

Eric
By SXRguyinMA
#117029
esklar81 wrote:According to their datasheets, the 7805 (the regulator you said you used, IIRC) and the 1117 (the low dropout regulator shown on your schematic) have different pin assignments: In-Gnd-Out and Gnd-Out-In, respectively, both in TO-220 packages.

In your schematic, you show In-Gnd-Out as the labels, but appear to have it wired as if it were Out-In-Gnd.

Eric
But the fact remains that it's hooked up correctly in the PCB. I've got 12v going into it's input pin, ground to its ground pin, and 5v coming out of it's output pin. I'm working on breadboarding this up now.
By SXRguyinMA
#117035
ok so I breadboarded it up and things changed. It works at the start, meaning it doesn't take until the caps hit 2.5v for it to work. But on the other hand, when power is removed, the servo doesn't smoothly move to it's "off" position. It's whines and chirps and eventually gets there, but that's it. I'll draw up the schematic exactly how I have it in the breadboard and post it.