Critique my PCB/Schematic!

Started by snorp, March 31, 2016, 07:37:20 PM

snorp

This will be my first PCB, so please let me know if you see anything really hosed. The zip contains an EAGLE schematic and board.

The Moteino will be used to drive a 28BYJ-48-5V stepper motor via the ULN2003APG which is commonly included with these. The motor is connected to the tilt shaft of 2" wood window blinds, allowing the Moteino to position the blinds remotely. It will be powered by 4xAA, and spend most of its time in low-power listen mode. Other software is connected to a USB Moteino which will send commands at scheduled times or on-demand to change the position of the blinds.

TomWS

Sure, no problem.  I'll take a look at it tomorrow when I'm back in my office.  Welcome to the fray!  Where are you going to get the boards fab'd?

Tom

snorp

Quote from: TomWS on March 31, 2016, 08:48:13 PM
Sure, no problem.  I'll take a look at it tomorrow when I'm back in my office.  Welcome to the fray!  Where are you going to get the boards fab'd?

Thanks! Probably SeeedStudio.

TomWS

Ok, back at ya.  It was a good layout and I only made cosmetic/personal preference changes.

1. I beefed up the power and current carrying traces.  10mil was really too small for these.
2. I beefed up the signal lines because you have gobs of room for healthier lines.  I don't like using 10mil lines unless I need to.
3. I did some minor tweaking of routing to provide better clearance on corners around other pins (allowing me to go to beefier signal traces) and removing some unnecessary layer transitions.

Finally, I'll point out that there is an eagle library for the Moteino modules (it's posted on this forum) which, IMO, provides better documentation at the schematic level and easier placement on the board level.  What you have is fine, however.

You don't need mounting holes?

Tom

snorp

Quote from: TomWS on April 01, 2016, 08:51:20 AM
Ok, back at ya.  It was a good layout and I only made cosmetic/personal preference changes.

1. I beefed up the power and current carrying traces.  10mil was really too small for these.
2. I beefed up the signal lines because you have gobs of room for healthier lines.  I don't like using 10mil lines unless I need to.
3. I did some minor tweaking of routing to provide better clearance on corners around other pins (allowing me to go to beefier signal traces) and removing some unnecessary layer transitions.

Thanks! I wondered about the trace widths. In an earlier revision, when I was using the servo, I did have .16 width for the power since the stall current was like 1A. You changed mine here to .24, so it sounds like they were still too narrow for 1A. Is there a good rule of thumb here? Basically make them as wide as you can get away with? I'm sure capacitance comes in to play for signal wires, but maybe not at these short lengths...

Quote
Finally, I'll point out that there is an eagle library for the Moteino modules (it's posted on this forum) which, IMO, provides better documentation at the schematic level and easier placement on the board level.  What you have is fine, however.

Ah, I'll look for that. I found the eagle files for the Moteinos themselves, but wasn't sure if there was something for the 'shield' usage I have here.

Quote
You don't need mounting holes?

I looked around for a long time to try to find an enclosure that would fit, but just gave up. I'm planning to put some wide heat shrink around the whole thing. Hopefully that doesn't introduce some kind of thermal issue, but it's drawing so little current I would think not. I have about 2" width x 2.5" length x 2" height in the blind rail, and there didn't seem to be any enclosures that would fit in the width/height while also giving me enough height to fit the Moteino on headers (which AFAICT will make the total board height about .8"). Polycase has a potting box with no PCB mounting that would work, but I am certainly not potting this thing and I don't really see the point if I can't secure the board easily.

Do you think the capacitor values I've chosen are reasonable? What about the battery monitor circuit? I figured the 100uF capacitor with the 2M resistors would be enough to give me a fairly accurate reading, but I really have no idea. It seems to work here with 1M resistors (I don't have any 2M), but that's too much current (~10 uA) just to monitor the battery. Thanks a lot for your help!

TomWS

Quote from: snorp on April 01, 2016, 10:28:17 AM
Thanks! I wondered about the trace widths. In an earlier revision, when I was using the servo, I did have .16 width for the power since the stall current was like 1A. You changed mine here to .24, so it sounds like they were still too narrow for 1A. Is there a good rule of thumb here? Basically make them as wide as you can get away with? I'm sure capacitance comes in to play for signal wires, but maybe not at these short lengths...
Yes, there are industry accepted guidelines.  In this case it's purely a swag on what I find comfortable if I don't have a challenging layout.
Quote
You don't need mounting holes?
I looked around for a long time to try to find an enclosure that would fit, but just gave up. I'm planning to put some wide heat shrink around the whole thing. Hopefully that doesn't introduce some kind of thermal issue, but it's drawing so little current I would think not. I have about 2" width x 2.5" length x 2" height in the blind rail, and there didn't seem to be any enclosures that would fit in the width/height while also giving me enough height to fit the Moteino on headers (which AFAICT will make the total board height about .8"). Polycase has a potting box with no PCB mounting that would work, but I am certainly not potting this thing and I don't really see the point if I can't secure the board easily.
Heatshrink around the whole unit won't be a problem and should protect it well enough in your channel.

Quote
Do you think the capacitor values I've chosen are reasonable? What about the battery monitor circuit? I figured the 100uF capacitor with the 2M resistors would be enough to give me a fairly accurate reading, but I really have no idea. It seems to work here with 1M resistors (I don't have any 2M), but that's too much current (~10 uA) just to monitor the battery. Thanks a lot for your help!
I did not look at your values.  I figured you used the WIHOH1 design practices.  The large capacitor is good for stabilizing the power supply while switching the motor.  Your comment reminded me that you do need a 0.1uF cap at the analog input pin if the divider resistances are >20K or so.

Also, I did not realize that you were running this from a battery.  I suppose I should have from the previous postings but I saw '5V' on the barrel jack and figured that you were using a wall wart.   You're throwing away 1.2uA with your divider circuit, but you're also throwing away AvgMotePWR * 5/3.3 by not having a split supply.  Not tragic, but from where I come from...

Tom
Note 1: WIHOH := "What I Have On Hand"...

perky

Could you post a pdf of the schematic?
Mark.

snorp

Quote from: perky on April 01, 2016, 02:20:22 PM
Could you post a pdf of the schematic?

Certainly! I included the 0.1µF cap that Tom suggested.

snorp

#8
Quote from: TomWS on April 01, 2016, 01:31:33 PM
I did not look at your values.  I figured you used the WIHOH1 design practices.  The large capacitor is good for stabilizing the power supply while switching the motor.  Your comment reminded me that you do need a 0.1uF cap at the analog input pin if the divider resistances are >20K or so.

I guess I thought the 100µF cap would make that unnecessary, but there is a 2M resistor between the input and the cap so that does make some sense to me.

Quote
Also, I did not realize that you were running this from a battery.  I suppose I should have from the previous postings but I saw '5V' on the barrel jack and figured that you were using a wall wart.   You're throwing away 1.2uA with your divider circuit, but you're also throwing away AvgMotePWR * 5/3.3 by not having a split supply.  Not tragic, but from where I come from...

I really appreciate your attention to detail! For my purposes, though, I expect this design to be more than adequate (barring any more fundamental misunderstandings by yours truly). If I go with the split power supply, I can't have a single battery holder and jack, which I think is a nice simplification. Also, I would presumably want to monitor both supplies, which requires more components, etc.

The leading commercial solution for this (by Somfy) costs upwards of $150 per blind, uses a proprietary RF protocol (for which you need a $300 bridge to interface), uses 8xAA batteries, and has an advertised battery life of 2 years. This design costs about $35 per blind, and with an average power consumption of 70µF is projected to last almost 5 years on 4xAA (EDIT: Lithium!). 8)

Even if I only get half of the estimated battery life I'd consider it a big success for my first Arduino project!

perky

Thanks! One thing, the ULN2003AN is somewhat leaky, there's up to 100uA leakage current per output when off (Icex), so no point in making your battery monitor resistors as high as 2M.  If this is for a battery system I'd look hard at the UL2003AN data sheet specs for leakage, it looks like it will sap a lot of current - you're better off with a high side load switch for the motor and ULN2003AN.
Mark.

snorp

#10
Quote from: perky on April 01, 2016, 03:02:04 PM
Thanks! One thing, the ULN2003AN is somewhat leaky, there's up to 100uA leakage current per output when off (Icex), so no point in making your battery monitor resistors as high as 2M.  If this is for a battery system I'd look hard at the UL2003AN data sheet specs for leakage, it looks like it will sap a lot of current - you're better off with a high side load switch for the motor and ULN2003AN.

Hmm, interesting, thanks for pointing that out. Both TomWS and I couldn't measure any leakage with all of the outputs to the motor turned off (EDIT: err, inputs, that is). The datasheet does indeed list maximum output leakage as 100µA for 50V and ambient temperature of 85C, and 50µA for 25C. My environment will be ~6V and 22C, so presumably much less leakage? I don't see anything else in the datasheet to allow us to estimate this. Very strange that we were not able to detect anything at all, though. I should probably take another final look before printing boards. The datasheet does not list a typical leakage current, so maybe no leakage could be typical?

TomWS

Quote from: snorp on April 01, 2016, 02:50:34 PM
I really appreciate your attention to detail! For my purposes, though, I expect this design to be more than adequate (barring any more fundamental misunderstandings by yours truly). If I go with the split power supply, I can't have a single battery holder and jack, which I think is a nice simplification. Also, I would presumably want to monitor both supplies, which requires more components, etc.
I'm sure this horse is pretty close to dead but thought that I should point out that you wouldn't have two supplies.  You would have one with a center tap.  The distinction here is that monitoring the bottom half would account for any drain on the upper half plus your Moteino load so that is the worst case and you can extrapolate the upper half.
Quote
Even if I only get half of the estimated battery life I'd consider it a big success for my first Arduino project!
LOL, I'm glad you have the right expectations!

Enjoy,
Tom

snorp

Quote from: TomWS on April 01, 2016, 03:25:52 PM
I'm sure this horse is pretty close to dead but thought that I should point out that you wouldn't have two supplies.  You would have one with a center tap.  The distinction here is that monitoring the bottom half would account for any drain on the upper half plus your Moteino load so that is the worst case and you can extrapolate the upper half.

Ah, of course. I'm planning to use this1 battery holder, so I would just need to add another wire to the near side to get the 3V. Should be easy, I suppose. Apparently 3 conductor barrel jacks/plugs are a thing, so I don't have to lose that either. Is it difficult to remove the VR on the Moteino? I don't have a hot air station (or even a great iron, I should probably get a better one). I'm going to make 6 (!) of these to start.

Quote
LOL, I'm glad you have the right expectations!

Hah, getting it working well at all was a blast for a software guy like me with zero hardware experience. Thanks to you and others on this board, it might also be efficient!

(1) http://www.digikey.com/product-detail/en/BH14AAW/BH14AAW-ND/66735

perky

#13
Well generally speaking the leakage current is due to minority carriers for transistors which are thermally generated so highly dependent on temperature, roughly doubling every 10 degrees. It's also highly dependent on the physical parameters of the transistor itself. Look at the spec of this for example:
https://web.jfet.org/nixie-1/2001.pdf
The Icex is quotes at <1uA typical at 25 deg, but has a maximum of 50uA! That's a huge variation for the same conditions.

Personally I wouldn't take the risk that another batch has different characteristics, you may well have just measured a typical device.
Mark.

BTW if you turn off the outputs be sure to ground the input to the ULN2003AN. Don't tri-state the output, any base leakage current will get amplified by the gain of the darlington pair to form the collector current.

snorp

Quote from: perky on April 01, 2016, 03:57:27 PM
Well generally speaking the leakage current is due to minority carriers for transistors which are thermally generated so highly dependent on temperature, roughly doubling every 10 degrees. It's also highly dependent on the physical parameters of the transistor itself. Look at the spec of this for example:
https://web.jfet.org/nixie-1/2001.pdf
The Icex is quotes at <1uA typical at 25 deg, but has a maximum of 50uA! That's a huge variation for the same conditions.

Personally I wouldn't take the risk that another batch has different characteristics, you may well have just measured a typical device.
Mark.

BTW if you turn off the outputs be sure to ground the input to the ULN2003AN. Don't tri-state the output, any base leakage current will get amplified by the gain of the darlington pair to form the collector current.

Wow, that's quite a range. 50µA would be devastating, so load switch it is. Ugh, I thought I was getting close :). I assume I don't need to bother with the input pull-downs if I have the switch. I do have the inputs I'm not using grounded, though.