Tiny binary clock - Page 1
Forum section: electronics / projects

author: Jaunedeau
author_rank: Regular Contributor
timestamp: January 20, 2015, 07:58:14 am
content: Hi,I am working on a project with a very tiny pcb, and I don't have room/budget* for pic24 (that have an RTC and a feature to use an alternative backup) nor an external RTC.I wonder if I make the Vbat thing with software and a few diodes (see atached schematic).I hope to use the ADC to poll the voltage before the diode (the schematic is missing a pull down resistor). As soon as it starts to get low, I would switch off all the leds (there are 22 of them, running at about 10mA), switch to a slower clock.Should this work or should I change the design before I order parts to test it ?Thank you,John.* Some people consider that for hobby project you don't care payer your mcu $2 or $4. Making projects with lower cost and part count is part of the fun for me.

author: JJalling
author_rank: Unknown
timestamp: January 20, 2015, 08:55:29 am
content: You might want to limit the current to/from the cap!And why use the ADC? Use a logic input to detect if the usb is connected or not.BR Jonas

author: Jaunedeau
author_rank: Regular Contributor
timestamp: January 20, 2015, 09:17:21 am
content: >You might want to limit the current to/from the cap!That is the purpose of R1, but maybe it is not the proper solution ? (I'ma software developper and knows very few about electronics)>And why use the ADC? Use a logic input to detect if the usb is connected or not.ADC or comparator with internal voltage reference should let me detect when usb power goes lower than 4V, when logic low is only guaranteed to be detected under 0.3V. If the wall adapter is not disconnected but unplugged from wall outlet, I fear that the 100-200mA in leds would have completely discharged the supercap before I can detect the lower voltage on usb connector. Btw, this is just a random guess, I started re-reading beginner electronics courses to try to make some calculationJohn.

author: JJalling
author_rank: Unknown
timestamp: January 20, 2015, 09:38:04 am
content: Quote from: Jaunedeau on January 20, 2015, 09:17:21 amDoh, sorry! But when you place it on the capacitor leads, you are wasting energy when running of the capacitor. Wouldn't it be better to place it after the diode?Quote from: Jaunedeau on January 20, 2015, 09:17:21 amWell, I see your point, but just remember to disable the ADC when running off the CAP - you don't want to waste power on running the ADC.I know you don't want to buy another PIC, but maybe you can find a cheaper one than the 16lf722 you are using, that has an analog comparator embedded./Jonas

author: JJalling
author_rank: Unknown
timestamp: January 20, 2015, 09:41:37 am
content: Quote from: Jaunedeau on January 20, 2015, 07:58:14 amAnd I totally agree on this point. Personally I think it's great to keep the cost down, just for the challenge/fun of it./Jonas

author: Jaunedeau
author_rank: Regular Contributor
timestamp: January 20, 2015, 10:28:37 am
content: Quote from: JJalling on January 20, 2015, 09:38:04 amLet say I want to draw max 100mA (to stay safe when people plug the clock to usb port) when the capacitor is fully discharged, then voltage drop across the resistor would need to be 5V (capacitor fully discharged = 0V and USB PSU = 5V)But then, when I want to lite all the leds (drawing 100mA), the voltage drop across the resistor means I get nearly all my power from the capacitor which quickly discharges ?Btw, if I use one of the new PIC, they internally run at 3V or so, and use an internal LDO, so the power loss across the resistor will only matter when the supercap is 2.1V to 3V, does'nt it ?Quote from: JJalling on January 20, 2015, 09:38:04 amActually I have not bought (nor choose) the mcu yet. I just read the datasheet about comparator yesterday and it seems to be possible to detect 4V with it and that may be a good solution.The problem with choosing the mcu is that I have very few space available (I really wish the PCB could be 8mm wide). That mean I either will need to solder QFN (I think I could go with this, but I also hope to make a kit just for fun, and some people will be afraid of QFNs), or to find a 200mil SSOP package.I will need :-22 pins for the leds (6 for hours, 6 minutes, 6 seconds, and 2 x 2 dots, maybe I can reduce by using leds in serie or parallal for dots, reducing pin count by 1 or 2, and not implement the 6th bit for hours, so minimum is 19 pins with some constraints),-2 pins for crystal-3 pins for PSU (Vdd + 2xVss on most pics)-2 pins to se clock (or 1 pin on analog pin and resistors)-3 pins for ICSPThe total is max 32 pin and I did not find that on a >0.5mm pitch PIC that has a less than 8mm wide footprint.If I use only 20 pins for leds, reuse the ICSP pins as input to set time, some 200mil 28 pins pics may fit, but I still have to study this.Of course there are other possibilities :-Use µQFN of BGA mcu-Multiplex leds (but then I will need to add transistors or to accept max 2mA current in leds)-Use a 16 pins pic to keep track of time, make cap sense, and detect PSU failing. This pic would communicate with a second pic or a led driver.So, yes, comparator will be used if it is on the pic I find, but I dont want to add an extra constraint for nowjohn.

author: Jaunedeau
author_rank: Regular Contributor
timestamp: January 23, 2015, 10:41:04 am
content: Hi,I could not find a lot of information about tracks and vias sizes.DirtyPcb can manufacture tracks down to 5 mil width and space, so I guess 0.25mm (10 mil) is safe. Leds will be fed with 5mA each if I want to stay below a 100mA total (to stay safe when the clock is plugged on a computer USB port). If it is too dim, I may feed them with up to 20mA.What is the minimum tracks width for 5mA current ? 20mA ? And for 100 and 500 (for the Vss/Vcc/leds gnd track ?) for 1oz pcb ? (thissimulator tells me that if I can accept 0.1V drop, 0.2mm track si widely enough for 20mA.thisdoc says that if you accept a +10°C temperature rise, 1oz copper and 0.25mm width can take 1amp. Is there any issue related to tracks width in addition to current intensity for a clock (no high frequency anywhere, instead on the crystal ?)What would be the minimal size for vias ?-According to the documentation I linked earlyer, a 10mil via diameter should be ok for 1A current-DirtyPCB says "Min diameter of finished hole 12mil". That is more than 0.3mm. Is it safe to specify 0.4mm vias ? (It will be very hard for me to fit 0.4 holes : eagle default to 0.7mm copper diameter, and I use a 0.65mm pitch mcu which is rotated 45°). What is the smallest safe size I should use ?Thanks you,John.