LEDs for daughter's 1/72 model aeroplanes - 1st open source & low power project - Page 1
Forum section: electronics / beginners

author: gildasd
author_rank: Frequent Contributor
timestamp: April 06, 2017, 08:33:10 pm
content: My 5 year old girl wants some aeroplanes to hang from her ceiling lamp - ok - lets do this, but learn something.Objective:A) When the room light is switched off, three leds blink, one constant, for 30 seconds.B) Make little girl happy.C) Learn something about low power circuits.D) Publish this Open Source for other parents who want to make something cool for their kid.Constraints (1/72th model aircraft):1) Run off a single 2032 Li cell battery for as long as possible.2) 4 SMD leds 0603, underpowered to be just visible3) Little to no standby current (see 1).4) Very thing gauge wire, between 0.2 and 0.1mm to fit in a tiny scapel cut out to the wing tips.Nd) Ditch the battery and run it on multiple BPW34 solar cells that dump their charge in a cap...Concept:Idea of the size - that's a 2032 in the middle of the wing:Ideas on "how to":1) Analogue AUse a 555, but I don't think that the standby current can be pulled down far enough with a transistor/photocell.2) Analogue BCharge a cap with the battery, photocell going up in resistance (dark) discharges this into a simple astable multivibrator circuit.Photocell going up permits the circuit to charge the power cap back up.3) Arduino micro (with pins cut off) - or other small IC.A tiny buck converter powers an microcontroler that executes a program when the photocell goes down, then goes into sleep mode until the photocell goes back down again.I'm not sure if this is even possible, I have no idea, scouring the web right now for ideas.4) Dedicated LED driver IC.Such as CAT3661 by ON Semi.Even if the rated Vin MIN is 2V, There is a pretty good chance that it will run on 1.5V.It needs a circuit before it to activate the on/off pin and a circuit after to split the output into stable and astable... Not sure I can fit this on 4cm2!No idea if this even a good idea!As usual, I'm not looking for somebody to do this for me, but if anybody has any source material, prior art or general pointers ("don't do that fool, do this"), I would really appreciate it.PS: The planes she chose because "pretty" (Focke Wulf TA152H, Nieuport N.28 C-1, Spitfire Mk.IIa and Supermarine Walrus Mk.I, funny she does not like jets) will be all painted in Hello Kitty scheme: white, pink and Hello Kitty decals - I know, blasphemy, but she is a little girl.Edit, did a mistake on the 2032 voltage, should read what is written on it before measuring a dead one...

author: Nusa
author_rank: Super Contributor
timestamp: April 06, 2017, 08:48:39 pm
content: If you go with any kind of microprocessor, the LED part is trivial. So is the light sensor. The fun part is the low-power aspect in between light shows. This might give you some ideas:http://www.home-automation-community.com/arduino-low-power-how-to-run-atmega328p-for-a-year-on-coin-cell-battery/

author: gildasd
author_rank: Frequent Contributor
timestamp: April 06, 2017, 08:54:04 pm
content: Quote from: Nusa on April 06, 2017, 08:48:39 pmThe idea is to have 7 weeks of a single event per day... I'm at sea 6 weeks, so I would like to avoid the cell to go dead when daddy is not there.

author: grifftech
author_rank: Frequent Contributor
timestamp: April 06, 2017, 09:06:48 pm
content: Quote from: gildasd on April 06, 2017, 08:33:10 pmuse a usb phone phone charger and some NiCd batteries (wtth charger) in the light and and hang the planes with 26awg wire

author: gildasd
author_rank: Frequent Contributor
timestamp: April 06, 2017, 09:12:48 pm
content: Quote from: grifftech on April 06, 2017, 09:06:48 pmThat would solve the issue for me (it was my original idea - except I would use a capacitor), but I would learn nothing about low power and it would be a bit selfish as in many countries (Australia, UK), the powers that be frown on anything more than changing a lightbulb...

author: Ian.M
author_rank: Super Contributor
timestamp: April 06, 2017, 10:18:42 pm
content: You can get the sleep current of an ATtiny MCU down below 1uA, 100nA is possible on an 14 pin ATtiny84. A CR2032 coin cell is good for about 200mAH to 2.6V (pulsed LED load), so that gives you years of standby time - its only the led on state current you have to worry about. Assuming you can keep the total average LED current down to about 5mA, it should be good for about a day of continuous LED operation, so as long as you aren't away for over 9 months you are 'golden' assuming you run the LEDs for ten minutes after lights-out slowly dimming to off.The photo-sensor should be powered from an I/O pin so the ATtiny sleeps for 8 seconds, waking up briefly to turn sensor power on, poll the sensor and turn it back off if the room light is on - this can be done very quickly so the average current remains down below one uAUse the ATtiny84 'bare' dead-bugged to the back of the coin cell holder, with a 0.1uF cap across its power and ground pins. The SOIC package is the smallest I'd be happy hand soldering wires to, but if you are a klutz, use the DIP part, which you want anyway to breadboard it for development and testing. With the SOIC part you should be able to build it in the same area as the coin cell holder and only 3mm more thickness. Use magnet wire to hook everything up, including an AVR ISP header, and either tuck it in somewhere or clip the programming wires off after you have finished development.Apart from the white LED, which needs two I/O pins, one to drive a charge pump to boost the voltage (a Schottky diode and a cap - the LED acts as its own rectifier), and the other to power it, run the rest of the LEDs direct from the MCU pins. PWM them to control the average current by using the internal Vref and the ADC to measure the battery voiltage and adjust the duty cycle in inverse proortion to the excess over their nominal Vf. Yes its bad practice, it abuses the ATtiny's output pin drivers, but between the battery internal resistance and the short pulse duration it will work OK and it saves you four resistors that would probably push it over the edge into being too fiddly to dead-bug, so would need a PCB. The photo-sensor should be a CDS cell connected between an ADC input and ground with an I/O pin powering its pullup.There's a 'board' support package for coding for selected ATtiny MCUs under the Arduino IDE:https://code.google.com/archive/p/arduino-tiny, and you can use an Arduino running the ArduinoISP sketch as a programmer for them.Should be a fun project and very portable to work on - once you've done the hardware build, assuming you have a laptop at sea, the parts to test with the hardware while developing the software (apart from measuring the sleep current) will fit in a small cigarette packet - an Arduino Nano rigged as a programmer and to monitor voltages and signals, the assembled coin cell, Attiny and 4 LEDs stuck down on a business card, a few micro-hook grabber leads for hooking up the Nano to signals you want to test, and a couple of LEDs with pre-soldered series resistors for extra test lights.

author: mariush
author_rank: Super Contributor
timestamp: April 06, 2017, 10:42:16 pm
content: a 8-10 pin soic or something similar microcontroller (for example a microchippic12lf1571- run it from internal oscillator at 31khz or more if you feel it's needed, runs from 1.8v to 3.6v , uses nanoamps at such low frequenciesif you feel like you need to limit the current for lower brightness to the leds, you can use either 3 0603 or 0805 resistors or maybe go with a resistor network that packages 4-7 resistors (typically) in the space you'd normally use fora couple of 0805 resistors. resistor networks would also allow you to easily play with connecting resistors in parallel or in series to get different value resistors for each led in a single package that takes little space on the pcbI'd add a button one of those metal dome things or some kind of microslide switch / tactile switch ... or just have two copper pads on pcb or two pins and use a screwdriver to short the pins for a few seconds when you need to change the operation mode.Keep the micro running 24/7 from battery. keep button pushed / on the closed position for 3-5 seconds to switch between operation modes (standby , don't blink leds, or "on" where the micro blinks the leds)micro has 6 i/o pins so no problem using 3 separate pins for the three leds (3 outputs) , 1 input for the button, one input for the photo sensor (chip has a 10bit adc and internal voltage reference of 1.024v .. super easy to measure some voltage on the input)so overall cheap (well, the programmer would cost money)If you're gonna use a flat lithium poly rechargeable battery instead of a cr2032 or something similar, you'd go with a non LF version, which would support up to 5 ..5.5v input voltage so 3.7-4.2v from battery would be fine.

author: Ian.M
author_rank: Super Contributor
timestamp: April 06, 2017, 11:12:05 pm
content: @Mariush,You need a boost circuit for the white LED + to be able to turn it off so that's 2 output pins. The light sensor needs to be turned off to save current so that's another output pin as you don't really want to pulse any of the LEDs when you are pulsing the sensor power. Three LEDs left and only 2 output pins is going to be an interesting problem . . .It *CAN* be done with an 8 pin MCU but will be a royal PITA. A 14 pin PIC or ATtiny is a much better choice as you dont have to multiplex the LEDs and you can leave the programming pins hooked up during development.

author: Zero999
author_rank: Super Contributor
timestamp: April 07, 2017, 09:10:51 am
content: Quote from: Ian.M on April 06, 2017, 11:12:05 pmWhat about using a diode+capacitor as a voltage doubler. All that's needed is one pin to switch it on and off.

author: Ian.M
author_rank: Super Contributor
timestamp: April 07, 2017, 09:15:24 am
content: Unfortunately that simple charge pump will leak current when 'off' with a 3V Vf white LED. It may not be enough to be noticeable in normal room lighting, but it will probably be enough to FUBAR your sleep mode battery life.

author: gildasd
author_rank: Frequent Contributor
timestamp: April 07, 2017, 11:28:55 am
content: Did some fitting of "PCB" into the model:Vertically:Horizontally:I think the horizontal version is much simpler, there is hardly any gain in going vertical.If a large electrolytic CAP is needed, then it will be stuffed in the tail.Resulting PCB size: 45x13 mmBattery storage:The shape of the wing root deceived me, the 2032 does not fit in. And it will be worse with the Spitfire!It will have to be replaced by 3 or 4 smaller ones. This will bump the voltage up to 4.5v or even 6v...I am sourcing the SMD leds, I need to test the actual power draw as used as I will be underpowering them. So there is a possibility that no pump circuit is needed.

author: mariush
author_rank: Super Contributor
timestamp: April 07, 2017, 11:46:01 am
content: I missed the requirement for a white led at first read.It's still not clear if you want one of the leds or just the WHITE led stay on for 30s.You can find some tube/circular rechargeable lithium batteries in electric cigarettes, those usually give you 3.7.4.2v at up to around 80mAh - if you could find one of those it would save you a great deal of pcb space by not having to put diodes and capacitors for voltage doublers or boost circuits.There are voltage doubler ICs otherwise which would only require a couple of ceramic capacitors and a diode to double the voltage of whatever battery you use and wouldn't take much space. See for exampleLM2665(sot23-6 package, 3mm by 1.6mm .. take a 3v lithium battery and double the voltage and you'll get up to around 5.8-6v ... maybe add an extra diode on the output to drop around 0.3-0.5v in order to make it safe for microcontroller to run directly from that 5.5v or thereabouts.Downside is the chip uses quite a bit of current, around 0.6 mA but if you don't need up to 40mA of output current you can go withLM2767M5which works at lower frequency and can output only up to 15mA and uses only around 50uA supply current to work.ps. strange shape .. would you perhaps have room for a 12v battery like these 23A style ones (29mm long and 10mm diameter) :http://uk.farnell.com/duracell/mn21/battery-mn21-33mah-12v-pk2/dp/1892795Maybe they would fit the shape of the plane better.

author: Nusa
author_rank: Super Contributor
timestamp: April 07, 2017, 02:55:25 pm
content: Quote from: mariush on April 07, 2017, 11:46:01 amThose A23 batteries are almost always made up of eight 932 button cells and the package can be broken. If a few 9mm x 3.2mm alkaline 1.5v cells fit the bill, that's one way to obtain them.Another option would be 3.7v nominal lithium-ion rechargables. The 10180, 10280, 10440 (10mm dia), and 75400 (7.5mm dia) are the ones that might fit.

author: Ian.M
author_rank: Super Contributor
timestamp: April 07, 2017, 03:08:39 pm
content: Quote from: gildasd on April 07, 2017, 11:28:55 amBummer!You cant even cram in a CR1632 which would give you half the capacity of the CR2032? I hadn't realised how much you were trying to miniaturise itI don't think you've got space for a MCU, a PCB and a good enough battery unless you go for a QFN-16 or smaller package MCU on a flex PCB - Your best bet would be to build it 'dead bug' direct on the SOIC packaged MCU, bending pins in as required and gluing 'fly-sh!t'*SMD parts directly to its underside.You could use anAAAA alkaline, (or maybe *just* cram in an AAA) but then you'd have to find space for a boost circuit, and find one that's low enough power not to kill your battery life. However its worth it - seethis comparisonAlkaline button cells ('watch batteries') may be ill suited this applicationEnergiser A76(LR44 - the largest commonly available size) is rated at the same discharge current as theirCR2032but has only 54% of the energy density and doesn't even have any pulsed current ratings! Why?Well any cynic would tell you that's because it probably sucks!You *might* just fit in four LR44 over the wing in two stacks of two - they are 11.6mm dia x 4.6mm thick, then use a ultra low quiescent current 5V LDO regulator to keep the PIC or ATtiny happy, and let the voltage drop as the battery ages to an end point of about 3.3V. That removes the need for a boost circuit, but you will need series resistors for the LEDs. You may also need to cram in a small supercap to stop the voltage dropping too far during the current pulses. 3xLR44 and no LDO is also an option, but you'll only get half the life out of them without a boost circuit as you need enough margin over 3V for the white LED. Maybe run it 'straight; till the voltage drops too low then start up the charge pump?As this is in a child's bedroom, I'm avoiding suggesting Lithium rechargables for safety reasons even though you could permanently fit them and have a concealed external charger connection.However, as the other models may have even less space it may be wise to 'bite the bullet' and use an external battery. That also means you will rarely need to access the model interior - only for programming new effects. Plug in a twisted pair of thin magnet wire at each end using a pair of 0.1" pitch SIL turned pin socket strips as plug and socket (you need three contacts - power in the middle and ground on both outer ones for the sockets. The ones soldered on the wires as plugs at each end only use two of the three, one outer and the middle. That guarantees the correct polarity) with the socket glued into a slot filed in the upper side of the body seam. Use a 9V PP3 at the suspension point, with a small PCB carrying several sockets for the magnet wire supply cables, and the PP3 battery snaps, and you should be able to run three or four planes from the same battery (as its 600mAH, about three times the CR2032 capacity), that any adult can easily replace. Again use the 5V LDO, but this time you don't have to worry about voltage drop - worst case, you'll still have about 4.7V when the PP3 has reached end of life. I would advise putting a 1A Schottky in series with the PP3 at the battery end before feeding the wire sockets, and an anti-parallel 30mA Schottky across the sockets at the battery end - it will prevent any disasters if the battery is momentarily reversed during attempted fitting.* SMD 'fly-sh!t' - anything so small that you need a magnifier, a really good pair of tweezers or a vacuum pick up tool and a week of no caffeine to even handle it, let alone place and hand solder it. Generally reckoned to be 0402 (US) packages downwards.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: April 07, 2017, 03:18:52 pm
content: Don't forget the "airplane" aspect. Even if you use a three wire harness to hang it the cg has to fall within the three support points. With your circuit board going up front you have the chance of it hanging nose down. Not cute. If you go for a more aesthetic single wire hanger the cg is becomes critical.

author: grifftech
author_rank: Frequent Contributor
timestamp: April 07, 2017, 03:28:15 pm
content: Quote from: gildasd on April 06, 2017, 09:12:48 pmin that case you could put some AA batteries in the light still do low power and change the batteries every year or two

author: Ian.M
author_rank: Super Contributor
timestamp: April 07, 2017, 03:38:19 pm
content: Another excellent reason to go external battery - it makes it *much easier* to trim the balance, and you can use the supply twisted pair wire as the suspension wire - just seize (with cotton thread and a drop of superglue) a small fish-hook (with the point cut off and blunted) to it at each end about an inch from the connector. Use an eye with about about an inch long stalk formed from a thin paperclip on the plane to make it less sensitive to balance - bottom end formed into a flat spiral normal to the stalk and melted into a bit of scrap kit sprue to coat it with easily glueable plastic.AA batteries are a nice idea, but, with a holder they'll be quite heavy and bulky. OTOH PP3 alkaline 9V batteries are reasonably cheap, you don't need a battery holder as it can be Velcroed direct to the lampshade (or stuck on with a supermagnet on the other side of the shade fabric) and should run one plane for about two years assuming the currents I guesstimated earlier. Yes, a linear LDO is going to waste half the energy in a PP3, but its already got a generous battery life and doesn't need the 5+ years an AA pack could give it. Possible exception - a single AA + a boost circuit at the battery holder - but I doubt the extra complexity is worth it.,

author: gildasd
author_rank: Frequent Contributor
timestamp: April 07, 2017, 05:02:24 pm
content: Quote from: grifftech on April 07, 2017, 03:28:15 pmIf I was going to do that, it would take an AA battery holder, an Arduino Mini, some components on a proto board, three wires, job done. No need to even start a thread.But I would learn nothing about anything I want learn aboutThat being said, if I get too short on time, I might do it as a temporary measure on one plane.

author: gildasd
author_rank: Frequent Contributor
timestamp: April 07, 2017, 05:44:03 pm
content: Quote from: CatalinaWOW on April 07, 2017, 03:18:52 pmGood point:The batteries and the magnet for the wings will be close to COG, and I'll fit a transparent anchor point to give it the right attitude.As an aside, if anyone wants to give it shot in parallel:I'm using Revell 1/72, these cost 5 to 12€ depending if the paint is included.http://www.revell.com/germany/aircraft/index.htmlBut any 1/72 kit will do.

author: gildasd
author_rank: Frequent Contributor
timestamp: April 07, 2017, 07:56:18 pm
content: Quote from: Ian.M on April 07, 2017, 03:08:39 pmI've been measuring the space more thoroughly:Two CR1632 can be stacked, but only 140mAh instead of 230mAh - but 6V so no need for up-converters!This could be in a battery holder soldered directly to the PCB.With a custom PCB:On top: a Nano with the ATtiny MCU next to it (need to check the size of both IC's - brainstorming for now). No pins.On bottom: Solder pads for the LED wires, any resistors/Caps, battery holder, a small header for programming.The only thing still missing is the "real life" setting of the leds. I think I can run them all on 3V and just use different frequencies (and maybe a cap to smooth each rail) programmed into the Atmel.Not sure this can be done with 2 layers, but I'll try!0603 is small, it's very much my limit and then some.The most obvious way to simplify this is to grind tweezers to exact fit and make them clamping (bend em')Still, I'll be crying when soldering them...

author: Ian.M
author_rank: Super Contributor
timestamp: April 07, 2017, 08:25:19 pm
content: The Arduino Nano is only to run the ArduinoISP programming sketch to program the ATtiny - it does *NOT* go in the finished item.Double sided shouldn't be a problem. No programming header - just make the board slightly longer, 1mm thick and with an end shaped to fit in a cut-down Micro-SD to SD card adapter (cut down to reduce the insertion depth to reduce the wasted board area). Take an ISP ribbon cable with its 2x3 pin IDC socket on one end, and solder the individual wires to the SD adapter pin pads, then reinforce with hot-glue.You should only need two caps - one for ATtiny Vcc decoupling and as the LDO output cap (hint: put it and the LDO as close as you can to ATtinv Vcc pin) and the other as the LDO input decoupling cap. Otherwise its just 5 resistors, one for each LED and the last one to form a potential divider with the photocell (or possibly a phototransistor - they are smaller and easier to hide under the canopy).

author: sleemanj
author_rank: Super Contributor
timestamp: April 07, 2017, 10:09:26 pm
content: I would use an attiny13, *5, or *4 with stacked Cr20xx.I think you could arrange the ldr such that when daylight/lights on the ldr holds the tiny in reset, when the lights go dark, the ldr would cause reset to release. On boot you do the light show for however long, then the tiny puts itself into permanant sleep, no wakeup, no nothing, turn off everything, make sure you turn off the adc as well. When it goes light again, reset will pull low again, and when it goes dark again the processor will reboot...

author: Ian.M
author_rank: Super Contributor
timestamp: April 07, 2017, 10:25:00 pm
content: Quote from: sleemanj on April 07, 2017, 10:09:26 pmWhat you win by not having to wake up to poll the LDR, you more than loose by the LDR potential divider having to be powered all the time. Also its less versatile as the behaviour is hard wired, so you cant do stuff like making a brief flash of room light when its active, choose the next operating mode.

author: sleemanj
author_rank: Super Contributor
timestamp: April 07, 2017, 11:10:30 pm
content: Quote from: Ian.M on April 07, 2017, 10:25:00 pmMaybe. But as well as the specifications of (and how you implement) the LDR reset, that is also going to depend on how frequently you would wake up and poll otherwise.Personally the maximum tolerable delay between turning lights out and having the show start would be on the order of 1 second.

author: BrianHG
author_rank: Super Contributor
timestamp: April 08, 2017, 02:38:32 am
content: How about approaching this a different way. You will still need to engineer the lowest power consumption possible though.How about a quick rechargeable 2 x 0.22f super caps for a total of 5v. Something like this:https://www.digikey.com/product-detail/en/eaton/B0510-2R5224-R/283-2775-ND/1026743Looks like you have space for a 2x1f super caps if you want quadruple the time.Were talking about a 1 minute charge, lasts for at least a night.The charger will just be and external 3xDCell battery holder with plug.With an 8 pin dip MCU which will work from 5v to 3v (or, the lowest voltage the LED would turn on), you can regulate the led brightness and software pulse/strobe as you like, dead bug style connection, no PCB needed. All you will need is a resistor for each led & software which draws as little power as possible.The 3xDcells should last you a few years as your charger & the super caps under this light load will last a few decades.Don't forget to add a zener diode across each super cap to ensure the charging is balanced.