Binary watch design questions - Page 1
Forum section: electronics / projects

author: programagor
author_rank: Newbie
timestamp: August 14, 2017, 12:38:30 am
content: Greetings fellow lifeforms of the internet.I'm fairly new to electronics design, so I wanted to make sure that I'm not doing anything stupid in my project. It's not intended for large-scale production, there will be no more than 10 of these. I will hand-assemble everything and manually upload the firmware.The thing I'm making is a battery powered watch which displays time and date in BCD format. This is done by an Atmel microcontroller, which drives a multiplexed grid of LEDs through MOSFETs, like so:The power supply is a buck converter, and also includes a charging chip for the battery. It is shown here:This is the whole board layout:(top layer)(bottom layer)(everything together)The schematics and board files (Eagle 8 format) are attached.Here are some issues/improprieties I've identified, but decided to not fix them because of space constraints (I'm already very near the limits of my fab house, and don't want to make the board larger or multi-layered):The MOSFETs have no switching current limiting resistors at the gate. I'm relying on the uC current limiting, and the MOSFETs I'm using have small gate capacitance anyway (58 pF for the P-channels, and 13 pF for the N-channels).The MOSFETs don't have pull resistors. I'm hoping that the uC will boot up fast enough to set all its pins to outputs so that the time the gates will spend floating will be very small.There are no current limiting resistors in series with the LEDs. This is solved by a combination of relatively low voltage (3.2 V), relatively high Rds(on) of the N-channels (2.7 Ohm), and small duty cycle (1/6 at most). This is within the absolute maximums of the LEDs.The circuit is powered by the charger when battery is charging. This can be solved by adding a P-channel MOSFET between the stages so that when the USB is plugged in, it powers the circuit directly, but I couldn't fit it on the board. However, when the diodes are not on (that is, if a button is not pressed), the current consumed by the buck converter and the uC is well below the cut-off threshold of the charger.No protection and pull resistors on the ISP interface. Here I'm relying on the fact that I will personally program the thing without even soldering a header in place, and then keep the pins in the input state while the program is running.There is no external pull-up and stabilising capacitor on the reset pin. I'm relying on the internal reset pull-up, and I have a suitably long start-up delay set.Are there some issues I've overlooked? Are some of the issues that I noticed actually worth fixing?ThanksBe good

author: edavid
author_rank: Super Contributor
timestamp: August 14, 2017, 01:07:38 am
content: 1. The schematic is unreadable2. You don't need external FETs to drive small LEDs3. Current limiting resistors are strongly recommended though4. What kind of battery are you using? Can't you run the MCU from it directly?

author: programagor
author_rank: Newbie
timestamp: August 14, 2017, 01:50:08 am
content: Thanks for the feedback, here are my responses.Quote from: edavid on August 14, 2017, 01:07:38 amThe images link to the full versions which should have large enough resolution to be read. But I'll try to split and clean it up anyway.Quote from: edavid on August 14, 2017, 01:07:38 amEach block has 8 LEDs, each LED running at ~100 mA peak, which is beyond the rating of that uC. The datasheet lists maximum current per I/O pin as 40 mA. Therefore, to run the LEDs at full power, I think I do need some switching device.Quote from: edavid on August 14, 2017, 01:07:38 amI calculated the required resistors to achieve the 100 mA current at 3.2V, and it was around the 2.7 Ohm that my FETs have anyway. I thought that if it's too much for the LEDs, I could just reduce the duty cycle. Is there any reason to add discrete resistors, even if they would have sub 1 Ohm values?Quote from: edavid on August 14, 2017, 01:07:38 amIt's a 3.7V (4.2V peak) Li-ion battery. Sure, the uC could run on up to 6 V, but I wanted to keep the operating voltage low to reduce losses. I also wanted the brightness of the LEDs to be consistent regardless of the charge level (unless the charge drops below the 3.2 V). But I suppose I could trade the whole buck converter area for current limiting resistors, that would make it cheaper to make, but wouldn't last nearly as long on a single charge.

author: Rerouter
author_rank: Super Contributor
timestamp: August 14, 2017, 02:19:33 am
content: Use the enable pin of your voltage regulator as a low voltage cutoff around 3.7V, the datasheet will likely show how to do this with 1 or 2 resistors.Its a simple change that prevents your battery from over discharging.

author: edavid
author_rank: Super Contributor
timestamp: August 14, 2017, 02:32:10 am
content: Quote from: programagor on August 14, 2017, 01:50:08 amIt's not working for me.QuoteYou don't need 100mA peak current through your LEDs. Even 40mA is excessive.QuoteYou could sense the battery voltage and use it to control LED PWM. Probably makes more sense to have ambient brightness sensing though.

author: DaJMasta
author_rank: Super Contributor
timestamp: August 14, 2017, 04:18:51 am
content: You can see the full size schematic if you right click/view image and then zoom on the hosting page, but it's not directly linked.Agreed on the current through the LEDs, you've got to have some real beefy ones if they can take even 40mA max current (non-pulsed) in a small surface mount package and that will be very bright for a watch. You could probably get away with 5mA or less in lower light conditions, and 10-15mA in fairly bright conditions (though it does depend on color and efficiency), though the numbers will increase somewhat with multiplexing and pulse currents.I agree current limiting resistors should be used to keep them in that ballpark, and you may find it useful to buy a few values and switching them around to get the brightness level you're looking for. I don't think your low side mosfets are required - while the high side ones will have to be sourcing enough current to turn all 8 LEDs in a column on, each pin grounding the other side only will be grounding a single LED at a time, so you have only 1/8th of the current sink requirement per pin used than the source requirement. So my vote would be a mosfet on the high side with a low RDSon (keep the power lost in the device to a minimum), then a current limiting resistor in series with each LED, both to keep the brightness in check and to balance them - running several LEDs in parallel means that any differences between them (and there will be some) will cause some LEDs to draw much more current and the array will fail faster. Even a very small resistor to limit current will help balance any differences in the forward effective resistance and prevent damage with use.As a no mosfet alternative, maybe look up charlieplexing for driving your array.It's also worth mentioning that an LED display chews a fair chunk of power, even at relatively modest currents through each LED, so you may find your battery doesn't last as long as you'd like. Going with high efficiency LEDs and adding empty refresh cycles to the display could help limit the draw and extend the battery lifetime.

author: programagor
author_rank: Newbie
timestamp: August 14, 2017, 06:47:27 am
content: Thank you everyone for your contribution, it prompted me to do yet another revision. I will add the cut-off voltage (cells with protection circuits are a bit more expensive than without), will consider a photosensitive element to detect ambient light, and will try to fit in the current limiting resistors for balancing while picking a N-channel FETs with lower Rds(on). I'll still include the N-channels because the chip really doesn't have that good current rating. I guess I'll also have to step down from 0805 components to 0603, making soldering a bit more difficult, but oh well.I just wanted to clarify that while the peak current for the LEDs is indeed ~100 mA, the average current is only ~17 mA because of the refreshing method (there are 6 blocks, only one can be on at a time, so the duty cycle is 1/6 at most). Charlieplexing would require even higher currents to achieve the same brightness, because only one LED can be on at a time.I can always reduce the duty cycle (and therefore the average current and therefore brightness) in software, it's literally just setting the second timer capture register, and enabling an interrupt which will turn off the lights. Correct me if I'm wrong, but I think as long as the pulses are below the LED's absolute maximum rating, it should be fine.Also, I'm aware that the LEDs at full brightness will consume a lot of power, so I decided that they'll be off (and the chip in power-save mode, with only the RTC timer running) until the user presses a button. Then it will light up, and stay lit up for the next few seconds.But anyway, thanks again, and now I'll get back to work.

author: DaJMasta
author_rank: Super Contributor
timestamp: August 14, 2017, 07:40:15 am
content: Yes, it will function at absolute maximum ratings, but not necessarily for long. As with many things, if you're running it near max specs, expect a significantly lower lifespan out of the parts, even if the pulses are very small. Many data sheets will give you both absolute maximum and recommended specifications, sometimes even with pulse current ratings for a given time duration. A good ballpark for recommended specs if they don't list them is the test current rating - that or below should be suitable.17mA average through 48 LEDs is not only a huge demand on the battery (0.8 amps), but will be extremely bright to look at, even with fairly inefficient LEDs. Restricting it to something like 40mA (pulsed) should still get you a lot of maximum brightness, but would more than halve the maximum current consumption before software dimming. It's also worth mentioning that you probably want to cap it around the DC current recommended rating just because software glitches could leave them on for a bit before they're worked out, so if you're pushing them too hard, they will burn out in the event of a glitch that just leaves some on. Then there's the parallel current sharing thing - 100mA each through 8 LEDs will NOT be shared evenly, so I'd expect a very short time to failure for the first LED.0603s I find to be very managable for hand work and the smaller footprint is nice. Another thing to consider is resistor arrays - for something like this, buying an array of 4 resistors in a single package can cut down on assembly time a fair bit, and the number lines up nicely in the design. 48 individual resistors or 12 1206 parts made of 4 0603s joined together - I know which I'd prefer.

author: TomS_
author_rank: Frequent Contributor
timestamp: August 14, 2017, 01:34:44 pm
content: You could save quite a few LEDs in this design I imagine, assuming you are just going to output a register and have its binary value displayed via a series of LEDs?For example, the tens digit of hours only counts 0-1-2 (for 24 hour mode), and that can be done with 2 bits and hence 2 LEDs, so you'll save 6 for that digit alone. Units will need to count 0-9, and that can be done with 4 bits and hence 4 LEDs, so you save a further 4. Thats 10 fewer LEDs just for the hours.Add savings for minutes and seconds and youve reduced the part count a reasonable amount. Otherwise I suspect you'll just have a load of LEDs that never actually light up and dont really do anything.Unless I misunderstand exactly how youre going to display your digits.

author: mariush
author_rank: Super Contributor
timestamp: August 14, 2017, 02:19:16 pm
content: Seriously, just use 8 channel or 16 channel led driver ICs .. they allow you to configure the current for all channels through one resistor or by i2c/spi command , and can be as easy to use as a shift register.. you push the 8-16 bits to turn on or off the 8-16 channels and they can be daisy chained for ease of use.Here's some examples :STP08DP05MTR- 8 channels 3V-5.5V in, 30MHz switch, up to 20V/ 5mA to 100mA out, NSOIC-16 (easy to solder)STP16CP05XTTR- less than 1$ each, 16 channels, current configurable between 20mA and 100mA , 3v to 5.5v in, up to 20v voltage on led channelsLED2472GBTR- 24 channels, can be configured as 8 groups of 3 leds for use with RGB leds , max current configurable through resistor and 6bit brightness control through commands , 4mA to 72mA per channel ..