PDA

View Full Version : Circuit Boards



daniel
05-25-2012, 01:09 AM
Here is the latest circuit board I've made on the bot. I've made a few, I keep getting better, but the board still has a glitch I haven't been able to figure out...... Check out my youtube video.

http://www.youtube.com/watch?v=t5KFHaN3r4A

ssflyer
05-25-2012, 02:45 AM
Pretty cool! I remember the old days, drafting the circuit by hand - using a photo-resist mask, and using my printer buddy's carbon arc setup to burn 'em :rolleyes: then the etching bath...

dana_swift
05-25-2012, 08:54 AM
Daniel- You have fabulous looking boards there. I'm jealous!

To find glitches like you show in the video, I use "DigiView" by "TechTools". Its a USB logic analyzer, I forget all the specs, but it stores transition times in the on-board memory, so it can capture for a long time before it fills the memory. That allows me to have it monitor the CPU under test so when the glitch occurs I can hit "stop" acquisition manually and be sure the glitch data has not been dumped already.

http://www.tech-tools.com/dv_dv3100.htm

If your CPU has JTAG you may be able to find the problem using a JTAG debugger, but the

With my circuits these things almost always are due to interrupt collisions not being handled correctly. It could be electrical noise, but not very likely, my money is on firmware.

How are you making your boards on the bot? Cutting away the copper, or marking the board(s) with etch resist? Also how are you registering top to bottom?

I did some PCB's using a V bit to cut away copper between traces, and adding a dimple where the through holes belong so I could use it as a center punch for manual drilling on a drill press. With most of my PCB's I have found it easier to just send them to Advanced Circuits and take advantage of their prototype offer. At $33 each with plated through holes and 0.006 minimum spacing, its been tough to beat even when I own the shopbot. I use the bot to make "onesey" pcb's usually if they are single sided only and mostly SMT. Their $66/prototype for a 4 layer board has allowed me to put power and ground planes in the designs which provides excellent power distribution on the boards. Then they put a bag of popcorn in with the boards when they ship! (Solder components on first, eat popcorn second..)

http://www.4pcb.com/

(Look at the bottom of the page for their prototype offers)

Then every once in a while I would like to be able to build a single board with a 144 pin LQFP CPU with 0.0045 between leads. Only a V bit can cut that fine of trace. If you have figured out a reliable way to do that, I am very interested! If you can plate holes, I would LOVE to know how!

I wrote a little program that takes Gerber files and outputs DXF polyarc descriptions of each of the PCB circuit elements. What I have been doing is taking that DXF and importing it in Aspire, then welding all the electrical traces together.. then V carving the area between the traces with an area clear end mill bit for the bigger areas. The end mill has usually been a 1/16, I tried using 0.020 bits, but the FR4 material snaps them like toothpicks.

At $33 per board with solder mask and silkscreen its hard to justify risking bits, so I have just been experimenting for the sake of knowing how. Another discouraging thing is the popcorn they throw in with the prototype boards.. somehow the shopbot still doesn't include popcorn!

PCB musings..

D

paul_z
05-25-2012, 11:01 AM
Here's another usb logic analyzer https://www.pctestinstruments.com/order.htm. The usb analyzers are great for bench and field work. Most of them also serve as protocol analizers for SPI, I2C, CAN, RS-232 and more.

When I watched your video, I noticed there was a glitch and four seconds later another one. Then some period of time passed before another glitch followed four seconds later with another glitch.

I'd monitor your voltage to the microcontroller with an O scope. I'd also try to tack on a larger bypass cap and see if that changes the glitch rate. If neither of those work, my next suggestion would be as Dana suggested - use a logic analyzer.

Paul Z

daniel
05-25-2012, 01:05 PM
Hey Guys, thanks for the suggestions and compliments.

I do have a logic analyzer, I would have never made it this far without it, here is what I've done for testing.

(1) Analyzed Logic comming from the microcontroller, tested on LED driver side. All Logic looks good, timming and bits going out on SPI and clock signals all look as expected.

(2) I have eliminated any copper from the board other than (a) Traces, and pads, and (b) The outter copper edge which is grounded.

(3) I have placed an LED on the board and written the firmware to use LED to let me know if the microchip is resetting for some reason. The chip is not resetting.


Dana, I did this exactly as you described. I used an area clear strategy with a 10 degree V-bit. I then used the bot to drill all the through holes. I would love to know how to plate a through hole as well. I registered both sides by flipping the board in a pocketed piece of MDF.

Now here are some observations of the board and why I think it's poor design on the board as opposed to poor design in the firmware, although I conceed, it could be both.

(1) The glitch in the Video was happining on a fairly tight schedule of 4 seconds. How nice of the board to tighten up for it's first video, however, it will glitch in all kinds of different ways sometimes. Sometimes I get a cool light show that I did not program. It also depends on where the board is.....It works well at my desk, but awful at the kitchen table.

(2) The Case of Clashing Interrupts, as Dana mentioned. I don't think this is the case. There is only two interrupts in the firmware. One is a timer interrupt, and the other is an interrupt on recieve for the USART module. Well, The interrupt on Recieve only happens when the chip recieves a communication from the phone. So as long as I'm not using the slider bars on the phone, the interrupt on the USART module will not occur, so the majority of the time there is just one timer interrupt occuring, and when that happens, all looks good according to the Logic Analyzer.

(3) What would happen if two pins are just dangling. Between the two LED driver chips (TLC5940) there are 32 pwm pins. Well I only use 30 (3 colors x 10 LED's) the two pins leftover are just hanging out, they have pads, but no traces to anywhere.........I beginning to think this might be a problem.

I eventually will just buy boards, but for now I will continue with the one's I make on the bot for reasons (1) It's a nice capability to have, and (2) I'm not good enough at pcb design yet, I would end up sending off bad pcb designs and getting bad $33 dollar pcb's back.

I do not have or know how to use a O scope yet. Hopefully soon in the future! For now it's just me, my fluke meter, and a logic analyzer.

daniel
05-25-2012, 01:13 PM
By the way Dana, Thank you once again! I don't know if you remeber, but a few years ago when I was first getting started programming, you helped me with some code, it's been awhile so I can't quite recall 100%, but, I think at the time I was trying to seperate and retrieve all the digits of a multi digit number. Thanks once again!

paul_z
05-25-2012, 01:43 PM
Daniel,

I’d still add more capacitance between +5 and ground right at the microcontroller. Just tack it on the traces with solder. You might be browning out. You can probably use your logic analyzer to check this by setting the 1/0 threshold to the brown out voltage and putting an analyzer lead on the supply voltage pin. (Don’t forget to set the threshold back to normal when you are done. I forgot once and thought I had a bad analyzer when it didn’t work on normal signal levels.)

The open pins should not be a problem unless you have enabled an interrupt on input (if this chip supports it). I’d program all unused pins to be outputs and make one +5 and another ground. They would then be good places to test for brownout as well.

Is it possible that you are exceeding output current? There are limits for each pin and sometimes limits per bank and for the entire microcontroller.

There is another possible ”got ya” with the timer. If you load the timer with a value too close to zero (or overflow if your timer counts up), it can create another interrupt before you leave the interrupt handler. If this happens and the last thing you do in the interrupt handler is to reset the interrupt, the timer will do a complete count down (or count up) before another interrupt occurs. I often use unused pins as flags for the logic analyzer. You might want to pulse an output pin in the timer interrupt routine.

Paul Z

dana_swift
05-25-2012, 06:14 PM
Daniel- glad I could help, and delighted to see you are still at it and doing cool things!

The logic analyzer Paul uses looks like a nice unit. I recollect buying what DigiKey had at the time I needed one. Probably that is a better unit than what I use.

As to an OScope, its just a voltmeter that plots the voltage with time. Nothing to be afraid of, find a used Tek and get yourself one.

Pauls advice on the extra decoupling capacitors on the power supplies is right on. When a CPU circuit switches from 1 to 0, for a very brief moment the power supply experiences a very high current. The regulator cant handle it, so the capacitor is needed to supply that brief surge. Having a big capacitor 100uF and above doesn't help as the big capacitors dont respond quickly, you need an additional one like Paul advises. Its normal to see a big one and a little one in the same circuit.

Another thing you mention is unconnected inputs. With CMOS devices, its critical not to leave them floating. Tie them high or low, or even better use a resistor to pull them to an inactive state. Then they cant cause troubles. If one of the inputs is one of the IRQ lines to the CPU, your troubles just got magnified. From your description of the kitchen table effect, sound like you should have a simple solution.

Good luck, and keep at it!

D

ssflyer
05-25-2012, 07:20 PM
Daniel,

I have an old and slow (10MHz) dual channel Sony/Tektronix portable scope, in good shape, if you're interested..

ssflyer
05-25-2012, 07:55 PM
By the way, Texas Instruments has a pretty good paper out on PCB design guidelines. It be read HERE (http://www.google.com/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=2&ved=0CGYQFjAB&url=http%3A%2F%2Fwww.ti.com%2Flit%2Fan%2Fszza009%2 Fszza009.pdf&ei=rhrAT4GEOYGe8gSp-8WpAQ&usg=AFQjCNHoFN0-Vw388Y15lmBjEH54kVXYxQ&sig2=qrkd_qu2VJedwmtrVw1waA)

daniel
05-26-2012, 06:18 PM
Hey, Guys, thanks for the tips, I will update you soon as to the progress.

Ron, That Texas Instrument paper is AWESOME! Thankyou for directing my attention towards it! I will let you guys know in a day or so whats up with the pcb.

On a side note, I went to the Orlando Maker Faire today! It was awesome! Very cool stuff to see! I think I need a tesla coil to complete my transition to the Darkside! Lot's of R2D2's running around.

daniel
05-30-2012, 12:21 AM
Ok guys, I've progressed a little further. I believe I have eliminted most of the noise issues on the board. I did this by doing a few things...

(1) Added 1uf and 4.7uf caps to the exsisting .1uf caps on the PIC 18f4321 and the two TLC5940's(LED drivers).

(2) Added two resistors to the two unused PWM output pins on the LED driver chips.

(3) Found a unused floating pin on the Microcontroller that was outputing the system clock. Disabled it in the firmware.

(4) Added more ground paths.

Now, most of the weirdness and the "Kitchen Table effect" are gone, All of the randomness is gone. The only bug that remains is the glitch seen in the phase change routine. Now that the board does not seem to be glitching out from noise, I can focus on the firmware as the source of the problem.

Here is a little background on whats going on in the design.

(1) Every 4096 clock pulses the Microcontroller sends an array of valus over the SPI module to the LED drivers. The LED drivers take this array and set the values on the PWM pins accordingly.

(2) This array is sent over no matter if it has been updated from the previous transmission or not. For example, if you slide the red slider bar on the phone and the LED's go to red, and then you do nothing else, the values in the array are still repeatedly transmitted to the board every 4096 clock pulses and the LED's remain red.

(3) The glitch never happens when the LED's are set to one color, only when the phase change routine is occuring.

Between number (2) and (3) this makes be think that the bug is not in the transmission of the array, but in the way the array gets its values set for the phase change routine.

Anyway this is where I'm at now..... Thanks for the help guys!

daniel
05-30-2012, 01:24 AM
I also want to implement some copper pours that are connected to ground, I figured out how to do it with eagle, but the DXF it exports is made up of too many overlapping polygons to be able to do anything with. Does anyone know how to get a better dxf export?

khalid
05-30-2012, 09:01 AM
Nice board and programming :)..i wonder why you chose to machine the PCB and why not etch it?
I do etch the boards and manually drill, initially i was slow but now as for as drilling is concerned i am faster than any CNC;)

dana_swift
05-30-2012, 09:16 AM
My DXF's from Gerbers look just like the one you posted. I import the DXF into partworks, select all, and "weld". So far I have not had it fail to do any level of complexity.

Care to post the DXF?

Congrats on getting the noise problem under control!

D

daniel
05-31-2012, 05:27 PM
Guy's, I am going nuts........ I cannot, get this thing to work smoothly, I am back to thinking it's electrical noise again....... Here's where I a at now,

(1) There was once major electrical noise all over the board causeing crazy problems, and the "kitchen table effect" as previously noted. These have been addressed with steps listed in a previous post and seem to be gone now. The only remaining glitch is in the phase change routine.

(2) I then turned to the firmware. First, I have turned off two of the colors in the phase change routine in order to observe just one. This is what I found (a) The LED's fade in and out nicely with the corresponding values in the array, until the LED's reach 0(Thes last 6 values in the array are 0's). (b) Sometimes, when they reach zero all is fine, and sometimes it glitches.

(3) I investegated the firmware further. I did these things,
(A) I checked the array and array index. 1024 elements in array, array index starts at 0 and goes to 1023. Rewrote them 3 different ways, all worked the same. Check!
(B) I took the function that turned on the LED's using the array values, and used the function manually with index's of the array(basically without the array index incrementing) and all worked fine. Check!
(C) I've basically did alot testing and or changes to the firmware and nothing changes. Same problem sometimes a glictch when LED'd go to zero.

Back to thinking it's noise, It's possible that when the chip gets to the end of that array, and starts to out put a some zeros(stay low) on that SPI out line, that it experinces some kind of spike. I will post a video soon.

I know this is a bit programmy for the forum, but since the board was made on th bot, I'll just go with it.

Khalid, I did it this way, because used tools I have and seemed easier to me then haveing to get extra stuff like toners, chemicals, and then learn how to transfer it all, and then after all that, I still want my bot to drill the holes, so I figured I would just engrave it as well.

dana_swift
05-31-2012, 09:35 PM
When I was teaching electronics troubleshooting, I taught my students to always check the power supply first. If its not right, nothing will be right.

When circuits are squirrely, power is a very reasonable suspect. You need to use an OScope to look at the power, and the transients on the power. You may find the power supply is oscillating, I have had that happen before. Local decoupling is critical also. Power is the foundation of the electrical design.

At the start put your OScope reference (ground clip) at the ground reference point for the power supply voltage regulator. Be sure the power is within spec. (are you using 3.3? 5.0? 1.8?) If you are using a switching regulator be sure it is stable and always within the tolerance (usually +/- 10%) for digital circuits. If its a linear regulator its usually easier to make correct when you are new to designing power supplies.

Using the regulator ground reference point, how big are the transients on the ground traces measured at the CPU? How about the Vcc or Vdd traces?

Once the power is meeting spec, check the clock. Is it solid? That is the next thing the CPU requires to be absolutely solid. If you are using a oscillator IC be sure it is well decoupled. Extra "clocks" make CPUs wierd.

Then check the reset circuit and the power monitor if you are using one. Is it possible the CPU is getting reset after the power is up?

A scope is your friend, and its easy to learn to use. Start each of these tests with the triggering set to auto, then go to manual and adjust the trigger to grab transients at what appears to be "solid" voltages. There are ALWAYS transients, but the limits for the transients are the same as the limits for the average values specified for steady power. So if the CPU is looking for a nominal 3.3v with a tolerance of 10% the power limits are 2.97v and 3.63v. At no time can the average power and the transients add up to exceed the limits.

The 10% figure is fairly typical of what a CPU requires, some CPUs are based on CMOS logic which can be more tolerant of power supply "softness".

When you boil all this down, Pauls advice about adding lots of decoupling is what you end up doing. That keeps the power which is solid at the regulator, as solid as it can be at the load.

Hope that helps-

D

daniel
05-31-2012, 10:09 PM
Thanks, Dana, I read, and reread your post as well as everyone else's. This is killing me, I've got 8 hours between yesterday and today alone and still no further. I would quit, but this is the stuff I want to be able to do. I made some changes on the board today, added some small caps and resistors to signal lines. No change, at this point I have no idea if it's firmware or hardware, it's gotta be firmware but I don't know.

I can power it two ways, but I get the same results both ways. One is with a wall wort, and the other is through usb via the pic kit 2. The usb probably has a clean supply. With that being the only glitch, I think it's firmware.

I am going to start a thread on sparkfun tonight, maybe someone there who has experince with this particular LED driver chip (TLC5940) will be willing to look at my code.

I thank you.

http://www.youtube.com/watch?v=oJJXiX5FIAM

ssflyer
06-01-2012, 09:41 AM
Neither the wall wart nor the USB port will be clean at all - Easy way to isolate the issue to see if it is power supply related, batteries! Cleanest power there is.

daniel
06-01-2012, 03:03 PM
Thanks for that tip Ron, I will implement that when I get home from work tonight so I can check the power supply off the list of potential culprits. I'm thinking it is in the firmware, Last night, I spent alot of time Adding Comments to my code. I am trying to make it read as easy and as quickly as possible before I ask anyone to look at the code. I have quite a bit more comment adding, before I comfortable asking someone to look at it, I don't want to waste anybodys time.

This is an important project for me, I want to pull all my skills together and use the bot to make a piece of interactive art work all the way down to the circuit boards. My goal is to control stepper motors and LEDs from my phone, tie it all together with a nice app, and make some instructables.

daniel
07-06-2012, 01:50 AM
Ok guys, I finally got this thing working. It was quite a undertaking for me, I spent alot of time but learned much in return. Basically In the previous attempts which are documented in the previous post, I had poor hardware design, and faulty firmware. It took me at least three atempts at designing a good circuitboard. After spending much time learning how to use the Eagle PCB software, and implementing the techniques of the texas instruments paper that Ron Sloan gave me a link to (once again thank you Ron) I finally got a board with no random weirdness. That eliminated alot of bugs. I was then able to focus on the firmware for the last bug, the glitch in the phase change routine, I will not bore with the details of the bad firmware other than to say it came down to one bad line of code that I finally isolated, found, changed, and all has been good.

Thanks again everyone. Here is a link to the youtube video.....

http://www.youtube.com/watch?v=YDyTwnHqRAY&feature=youtu.be

dana_swift
07-06-2012, 09:02 AM
Your circuit board came out looking great!

Well done-

D

ssflyer
07-08-2012, 12:02 PM
Congratulations, Daniel! Looks good!

genek
07-09-2012, 11:03 AM
Have checked for bridges of soldering paste... May be the problem.

daniel
07-16-2012, 03:15 AM
Here's a a couple of pictures showing how small a PRT48 can engrave.

daniel
07-16-2012, 03:24 AM
Here is the completed board....

bruce_taylor
07-16-2012, 09:01 AM
Daniel,
Great looking project! well done

dana_swift
07-16-2012, 11:08 AM
Daniel - looks really good! Did you use an end mill to carve between the traces? I have used a V bit with decent results, just curious!

Well done.. keep going, use what you learned to make the next PCB better!

D

daniel
07-16-2012, 02:47 PM
Dana, I used a V-bit as well, a 10 degree V-bit.