Sunday, December 10, 2017

Flashlight using AA and 14500 batteries

I've built a number of LED lights myself.  But you can purchase a 1000LM Cree Q5 LED flashlight for less than $2.  What I found intriguing is that the flashlight is capable of running on both a regular alkaline AA battery or 14500 lithium ion battery. The AA battery voltage range is 0.9 to 1.5V, and the Li+ battery is 2.5 to 4.2V.  And the white LED forward voltage is about around 3.3 to 3.7V.  So the regulator has to be capable of both stepping up and down.  While there are circuits that can do that, I'm curious how it is done on an inexpensive flashlight.

I was able to find pictures of retail circuit boards for LED, like this one
A search for the driver IC turns up Nanjing Micro One Electronic ME2106.  The packaging is SOT-89-5 with an extended pad for VOUT, which enhances the thermal performance.  The typical application circuit looks like this,
However, ME2106 is a step-up converter with constant current output.  The IC is capable of starting at 0.8V.    The current is set by an external resistor with 200mV feedback voltage.  So the current sensing resistor appears to be 0.27 Ohm, which sets the current to 740mA.  The CREE Q5 LED is spec'ed with 3.3V@350mA, 3.5V@700mA, and 3.7V@1000mA.  The Q5 is cool white with min flux of 107 lm, increasing to 180 lm @700mA and 240 lm @1000mA.  So the advertised 1000 lm is probably bogus.  Since ME2106 is not capably of stepping down.  When the battery voltage exceeding 3.5V, the battery voltage applies to the inductor, the diode, the LED and the resistor in series.  The drop across the diode is over 0.4V and may be another 0.2V across the resistor and inductor; there is enough drop to bring the voltage across the LED down to 3.6V from the 4.2V peak battery voltage.  The efficiency is still over 80%.

Saturday, December 2, 2017

OrangePi Prime Armbian

When I installed Armbian on the OPiP half a year ago, the builtin wifi was not supported.  I tried again with the later build, Armbian_5.34.171121_Orangepiprime_Ubuntu_xenial_next_4.13.14_desktop,  Release: Ubuntu 16.04.3 LTS, Kernel: "Linux orangepiprime 4.13.14-sunxi64 #246 SMP Mon Nov 20 01:58:09 CET 2017 aarch64 aarch64 aarch64 GNU/Linux".  The builtin WiFi works out of box.  The WiFi support has been added.
[ 7.303430] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
[ 7.312103] RTL8723BS: module init start
[ 7.312112] RTL8723BS: rtl8723bs v4.3.5.5_12290.20140916_BTCOEX20140507-4E40
[ 7.312114] RTL8723BS: rtl8723bs BT-Coex version = BTCOEX20140507-4E40
[ 7.381290] RTL8723BS: rtw_ndev_init(wlan0)
[ 7.382437] RTL8723BS: module init ret =0
While the WiFi works fine, but the builtin Bluetooth is not working.  A USB Bluetooth adapter works and can be used to attach Bluetooth keyboard/mouse.

The HDMI display works OK, but does not always configure correctly.

With the addition of the WiFi, the OPiP is very usable, as I can type this blog on it.  I think Armbian is the better distribution than what the vendor provides.  Armbian support for H5 is still experimental.

armbian-config is a useful tool to configure the system, in particular the peripherals, I2C, SPI, etc.

I built KiCad from the source on OPiP like I did on OPi PC.  It took about 8 hours, still a long time, but an improvement over OPi PC.  It was with the max CPU frequency set to 1.37GHz.  Again it is not platform for developing large software.

While OPi Prime is more capable than OPi PC, it is not fast enough to a desktop replacement but likely an overkill for most embedded applications.  I would certainly prefer two OPi PC over one OPi Prime at the same cost.

Saturday, November 25, 2017

Product Failure

I'll detail some of the failures of electrical products that I encountered.

Bluetooth Earphone

I have a Bluetooth earphone that I have not used for a long time.  I could not turn on; it obviously needed charging.  I plugged the USB cable, but it just would not charge.  I opened up and the tiny Li-Ion battery pack had a very small voltage.  It turned out the battery pack has protection circuitry, when the battery voltage drops too low, the switch would not turn on and could not be charged.  It was possible to bypass the circuitry and tap into the battery terminals directly.  I charged the battery directly for a while.  Then it was possible to charge regularly again.

Coffee Maker

In the middle of making coffee, it stopped.  While the light was still on, but the water was not dripping into the filter.  The heating element apparently is broken after perhaps ten years.  The heating element (probably filament inside ceramic)  is placed next to the water pipe and in contact of the top plate.  The water is heated up and forced out to the top and drips down to the filter.  The pressure is enough for the water to go up 1 foot to the top.


AC Adapter Wall Transformer

A short at the output of the 12V 500mA AC adapter caused it to fail.  It is a simple transformer followed by bridge diode rectifier.  The primary side of the transformer is protected by a thermal fuse, which opened when the output was shorted.


Compact Fluorescent Lamp

After about 5 years, the Philips Marathon 13W CFL failed; it flicked for a few minutes then was completely out.   One of the filaments apparently was burnt out, otherwise everything looked fine.  So it seems that the life time is still limited by the filament like the regular incandescent bulbs.

Digital Timer

The LCD started to lose segments.  It uses a plastic heat seal connector, which does not make a durable connection.  After one or two years, the connector loses adhesion.  This is typical of many cheap electronic gadgets with small LCDs and the connectors are the first ones to fail and render the devices useless.



Sony MDR-RF925RK 900 MHz Analog RF Wireless Headphone

This is really a design flaw because it does not work right from the start.  This product retails for $49.99 at Amazon, so it is not an el-cheapo.  It makes a popping and clicking noise constantly; it is loud enough to be unbearable.

Desktop Electric Fan

I have a desktop electric fan, three-speed and swinging head.  It is built with metal casing and solid construction.  I had it for 7-8 years.  It occasionally makes noise when it swings.  Recently, it failed to start or start and stop at the lowest speed.  Then it tripped the circuit breaker.  At a close inspection, the wires from the base to the motor head were nicked and evidently shorted.  The bundle of wires consists of earth ground, which is connected to the case, return, and three other wires for the three speeds.  Apparently, the wire bundle has been rubbing against the case as it swings, eventually cutting the insulation and shorting out the wires inside.


Upon disassembling the fan, I find the single phase induction motor, 3uF starting capacitor and it appears that the speed is controlled by activating the number of stator coils.  I soldered the wires and insulated them; it works again.

Notebook Computer Power Adapter

I'm sure the designers thought it was a good idea to build smarts into a lowly notebook AC adapter. My HP notebook AC adapter comes with a 3-pin power plug. As an electrical engineer, I had guessed that the center pin was a sensing pin to compensate for the IR drop of the wires. I measured the voltages: the inner ring is 20.0V and the center pin is 15.4V. I did not think too much of it why HP thought was necessary to have a center pin until a few months ago. My computer ran slow and took a long time to boot. Of course, I suspected software problems, maybe virus. I reinstalled the OS and the problem seemed to go away, but only reappeared later. It was very frustrating. One day I noticed that the computer would run fine when I unplugged the power adapter. It was very repeatable; I could see the CPU loading changing as I plugged and unplugged the AC adapter. I could not believe that the running on AC adapter could cause the computer to slow down. A quick search on the web showed other people had the similar problems. HP called the power adapter smart AC adapter. Apparently information is communicated between the AC adapter and the notebook PC and the PC throttles the CPU accordingly. When there is a connection problem on this center pin, the notebook gets stuck in the slow mode. I could juggle the wire to make the problem go away. The technical support at HP seemed unaware of this particular problem. (In general, HP tech support just isn't very good.)
Power supply failures seem very common on the computers. Now the smart AC adapter adds a new way for the power to fail.

Electric Shaver

Technically it did not fail.  It is a fine product, still usable after many years, but the batteries failed.  It has two NiCd cells, which can no longer t be charged.  I opened up and replaced the batteries with two NiMH cells.  The charger still work.  Its usable life has been extended.

LiFePO4 Charger

This was a case of misuse.  The charger was connected to the battery with the wrong polarity.  There was a popping sound and the charger was dead.  Designing a charger without reverse polarity protection, I think is a mistake, especially when the possibility of wrong connection exists.  The consequence is that an aluminum electrolytic capacitor blew up, spewing its guts and a jumper wire melted.  The jumper wire is 22 AWG, so it would take 40A to melt.  And a 50-milliOhm current sense resistor changed its resistance because of overcurrent, thus altering the maximum current output.



 

Thursday, May 4, 2017

OrangePi Prime

As I was pleased with the OrangePi PC module, I purchased another OrangePi product, OrangePi Prime for $35, about doubling the price of OrangePi PC.  The extra cost got me AllWinner H5 quad-core A53, 2GB DDR3, and onboard WiFi and Bluetooth module (based on RTL8723BS).  The board is a little larger and the hole patterns are not the same.


I downloaded the Ubuntu desktop image from orangepi.org and wrote to a uSD card.  The image took about 4GB disk space.  I connected the HDMI to an HDTV, but there was no display; the screen said the mode not supported.  I connected to the 3-pin UART at 115200 baud and power cycled.  I saw the boot message and login prompt.   And I logged in with the default password (root/orangepi).  Everything seemed running fine; the X server was running.  So I should try a different monitor.  It worked on a newer model HDTV.  But it needed a keyboard to login.  I was able to use my USB keyboard/mouse emulator.  The desktop environment is Xcfe; the default display resolution is 1280x720.  I connected to the WiFi to my router.  But the default browser did not work.  I went to Ubuntu Software Center and installed Chromium Web Browser.  I was able to get on the web.  The Linux partition ran out of space.  I had to resize the partition.

I also gave Armbian a try.  Armbian had a nicer setup.  It created a single partition and expanded to the full capacity on the first boot.  The display defaulted to 1920x1080 resolution.  The desktop is also Xcfe.  However, it did not appear to have the driver for the onboard WiFi.  I  had to connect to the internet with an ethernet cable.

During the startup, the board draws 2A peak for a brief period of time.  The current does not exceed 1.2A during normal use.  It idles around 0.35A.   After shutdown, it still draws 0.18A.  During heavy load with average current ~1A, the CPU temperature can exceed 75C even with a heatsink.  With a fan, the temperature can stay below 40C.

See an update here.

Tuesday, January 3, 2017

DT9205A - another cheap multimeter

I talked about the Cen-Tech multimeter, which was a little better than expected.  Another cheap multimeter is DT9205A.  There are actually several versions which have slightly different looks.  The one here costs $9 (including shipping); it has no discernible manufacturer brand information and comes with a rather generic users manual, but at least it has accuracy specifications.

The DC voltage accuracy is +/-(0.8% + 3), so measuring 5V, it could be off by as much as 70mV.  It turns out the measurements are much better than specified.  At 1V, the measurement is within 1mV and at 10V, the measurement is within 10mV.  However at 5V, the measurement is off by 30mV.

While the DC voltage measurement seems OK, other measurements do not fare as well.  A 1.6K Ohms resistor should be within +/-(0.8%+2), or +/-15 Ohms; it is actually off by about -30 Ohms, twice the limit; and 31.6KOhms off by -1K Ohms, again twice the spec.

The meter has superficial resemblance to the Fluke multimeter, which costs around $400.  The venerable Fluke 87 has the DC voltage accuracy specification of +/-(0.1% + 1) over all the ranges and the resistance accuracy of +/-(0.2% + 1).  So the accuracy specification is about an order of magnitude better on paper.

The Cen-Tech multimeter actually has much better accuracy for less than half the price.  Although this meter has additional desirable features: the auto power off, continuity beep, capacitance measurement, wider resistance measurement range, 10MOhm input resistance for voltage measurement (for 20V and upper range),  the poor accuracy is enough of a disappointment to not recommend it for purchase.


Sunday, November 27, 2016

OrangePi PC

The OrangePi PC based on Allwinner H3 SOC, a quad core ARM Cortex-A7 processor, with 1GB DDR3 SDRAM, selling for $15 (plus $3.35 shipping) is possibly the lowest cost PC with the similar capabilities.  (Cheaper boards have less RAM which limits the usability.)


The board has the same form factor as the more famous Raspberry Pi (not the same mounting holes) and the same expansion 40-pin header; the OrangePi PC also features an OTG USB port, a microphone and an IR receiver. Indeed, H3 is an impressive chip -- the board only needs DRAM, voltage regulators and connectors; no need for ethernet phy chip, USB hub etc.  The OTG micro-USB port can be turned into a serial port, an ethernet port etc through USB gadget support.  Also see https://linux-sunxi.org/Orange_Pi_PC.

To power the board, we need a power plug and a 5V power adapter capable of 2A.  The best OS flash image is Debian Jessie Desktop from armbian.com.  Connect the HDMI port to a TV for display.  It is good to connect to 3-pin UART serial console to see the boot message.  Once it boots up; the display resolution can be changed with the command h3disp and it is capable of 1920x1080p60.   The desktop environment is Xfce.  At least a USB mouse is required; without a physical keyboard, a virtual keyboard can be used.  I use a Bluetooth keyboard/touchpad, with a Bluetooth dongle, which it supports nicely.

The performance is OK for most of applications; but youtube video playing is a little jerky.  The audio output can be the HDMI or the 3.5mm jack.  The H3 gets a little hot when playing video; still it is impressive not needing a heat sink.

To test it as for code development, I try to build the recent version of KiCad.  A number prerequisite packages have to be downloaded.  The entire build takes almost 10 hours.  The speed of the micro SD card is probably a factor here.  It is also close to running out of memory.  The build is successful, but this probably is not a platform for serious software development.

While it is not a replacement for a good laptop or desktop, it is certainly good enough for seriously embedded applications.  The 40-pin expansion port has 28 signals, 5V, 3.3V and ground.  The signals can be GPIOs or 2 I2Cs, 3 UARTs, 1 SPI and 1 PWM.

There is a port of WiringPi call WiringOP that supports the I/O functions of the expansion header.



There is also a port of python package pyA20. 

For a more capable 64-bit version, see OrangePi Prime.

Also see this post for adding a small LCD screen.

Monday, October 24, 2016

Bluetooth Headset Battery

I have a Bluetooth headset that is 7-8 years old.  I used it occasionally in the car.  It just quit completely and could not be charged.  I never threw out a piece of electronics without opening and studying it.  So I peeled the cover off and took a look inside.  It is designed around Philips BGB204 Bluetooth 1.2 system-in-a-package radio chip that includes the Bluetooth core and an ARM7 processor.


The first thing to check was the battery.  I was surprised to find the battery voltage was at dead zero.  I was expecting it had at least some voltage albeit low, but it should not be at exact zero volt.  I took the battery off the circuit board and powered the board with external supply at 3.7V.  Everything seemed to work fine: it connected to the PC and transmitted sound through Bluetooth.  So the culprit had to be the battery.

I carefully peeled the tapes off the package and exposed the battery contacts and the protection circuit.  I measured the voltage across the battery contacts and there was some voltage as I expected.  So it was the protection circuit that completely cut off the power.  Probably the voltage had dropped too low to even power the protection circuit.  Also the pouch that contained the battery cells looked a little puffy.  It appeared that the battery cells might have released gas.  I was tempted to pop the pouch to vent the gas, but I resisted, thinking that it could possibly cause fire because of lithium built up.  I started to charge the battery directly at 100mA to 4.2V; it took about one hour.  And at about the half way, I switched the charging through the protection circuit and it charged fine the rest of the time.  Then I tested the battery by connecting it back to the headset.  It worked and seemed to hold charge.

So it is curious what happened to the battery.  And since the battery pouch is a little puffy, it is also a little worrisome.  I have to be careful to continue using it.

After some research online, it seems that the battery puffing is caused by excess oxygen which is released from the organic solvents in the electrolyte likely because of overcharging.