Wednesday, June 3, 2015

1W Cool and Warm White LEDs

The 1W cool white (6000-6500K) and warm white (3000-3500K) LEDs are driven by 350mA.  The LEDs are mounted on 20mm Aluminum base heat sink plate. The forward voltages after the temperature stabilizes, which is quite warm are 3.18V and 3.04V respectively.  The difference could be due to that the two types are from different vendors.  The plates are hot, probably over 70C (cannot touch for more than 1-2 seconds).  The LEDs seem fairly tolerant of over current; it survives 1A current with the forward voltage at 4.2V.  That's why some of the cheap LED flashlight can get away with direct battery power with any electronics.


The image is taken with 1/2000s exposure with f/8.0; the center of LEDs are saturated.  If we take the measurements at the rims, the cool white LED has RGB composition of .60, .56, .77 and the warm LED .80, .56, .47 .

Here eight 1W cool white LEDs are mounted to a desklamp replacing a 12W fluorescent tube.  A 350mA constant current power supply module drives the 8 LEDs in series.



After some time, I had two LEDs in the lamp failed.  The faulty LED would started blinking; it shut itself off probably due to overheating then recovered after it cooled off.  The forward voltage of the faulty LED becomes much higher: starts off around 3.8V and would increase rather than decrease as it heats up until shutoff; it is still operable at lower current.  To increase the reliability of lamp, I made them into two parallel strings, so they operate at much lower current at the expense of lower brightness (but still plenty of light).

Thursday, May 28, 2015

BeagleBone Black Display

BeagleBone Black is a nice little board, but mine came with no HDMI display: the monitor could not detect a HDMI signal.  I tried different monitors and cables with same result.  I researched online and tried different versions of software distribution, but no luck.  Although it is not essential to have the HDMI display, it is a little upsetting to miss this feature.  As my frustration grew, I read someone wrote that his problem was with the micro HDMI connector.  With naked eye, there did not seem anything wrong.  When I looked under a microscope, I noticed that one pin might not solder correctly.  I quickly verified the broken continuity.  After slight touchup with a fine solder tip under a microscope, the HDMI display miraculous started to work.  It turned out that Pin 19 (+5V) was loose.  Now it works nicely on an HDTV with 1920x1080 resolution (24Hz).  The connector certainly did not come to my mind as the possible problem; people have mentioned about bad cables, but not the connector.  In my experience, the interconnect contributes to the most hardware problems and should be the first thing to check.  But in this case, the potential software issue seemed to loom large.


On a related one, when using a monitor, the software synergy is very useful for sharing keyboard and mouse.

Wednesday, April 15, 2015

Reading AoE3


I read the 2nd edition from cover to cover in about 10 years.  And I just read the 3rd edition in about one week.  I used to say everything I knew about electronics I could find in AoE.  Now I probably do know a few things that are not covered in the book.

The book cover has been upgraded from silver to flashier gold color.  I don't fault them for considering it as the gold standard in books on electronics.

This book deserves a 5 star rating.  The true value of the book is that it is not an academic text book.  It contains a wealth of practical information, in charts, tables, and graphs, no other books come close. The jewel of the crown is the chapter on precision circuits.  The chapter on noise is equally rich.

However, I did not like the elimination of the circuit ideas section and replacing it with a chapter review.  Omitting the circuit construction is also a loss because prototyping and making the circuit board are an essential art that separates practitioners from theorists.  I also lament the elimination of the chapter on RF.  This book constantly refers the reader to the so-far unavailable "The x-Chapters" book; it is somewhat irritating to me that I'll have to get another book.

I wish it had fewer annoying trivial errors (how could you not catch a flipped diode on Fig 1.78?) ; 25 years ought to be enough to get it perfect.

So if you are a newcomer, you could still choose the 2nd edition because you can probably find a bargain now.  But I won't let go my 2nd edition.

The new edition is 0.7" wider, 67 pages more with smaller font and narrower margin.


Tuesday, January 20, 2015

80486 PC: Power Supply

Power Supply

This particular PC power supply is rated 230W: 5V@23A, 12V@9A, -5V@0.5A and -12V@0.5A.  There is no 3.3V output.


It takes 120V AC (with a switch for 220VAC).  The AC color code is usually black for line, white for neutral and green for ground.  The earth ground is tied to the chassis and is tied to the circuit ground.  In this power supply, the line and the neutral are brought to a switch at the front panel.  The switch connects them to a connector on the board (brown and blue wires) and to an AC socket to optionally power a monitor, a feature that disappeared later.  It does not have a way to turn the power off electronically by software. The line is fused (5A/250V), but the fuse is soldered to the board, so not easily replaceable.  A thermistor is used to limit the inrush current; it starts at 5 Ohms and drops to 0.2 Ohm at the full load of 3A. The AC input is filtered by capacitors and a common-mode choke.  Then it is rectified by a diode bridge and filtered by two large capacitors (330uF 200V).   These two capacitors are connected in series; depending on the 120/220V switch, they are either charged in series with the full wave rectifier or individually charged by half wave rectifier (a voltage doubler).  This is how both 120V and 220V are accommodated.   The maximum voltage is 2*120*sqrt(2)=340V.  If the switch is closed (intended for 120V) but 220V is applied, the voltage would exceed the capacitors' rating.  I wonder if any power supply is destroyed this way.


Now we have a high voltage DC to work with.  The switching regulator is in the half-bridge configuration.  Two power NPN 2SC3040 transistors (400V/8A) mounted on a heat sink drive a transformer primary.   The secondary is diode rectified and filtered; the diodes are mounted on a heat sink.  (For some reason, the heat sink is tied to the cathode of the 12V rectifier diode.)  The circuit board is one-side; all components are on one side and all are through-hole.  The only IC DBL494 is the pulse width modulation controller and is resided on the secondary.  The base drive comes through a transformer.  The frequency is about 32KHz.  DBL494 has a 5V reference.  The feedback is on 5V; the other voltages are not regulated and do vary with the load on 5V.   When the 5V is unloaded, the 12V is only 10V.  When 5A is drawn from the 5V, the 12V is 12V.  DBL494 is powered from the 12V.  An interesting question is, how does the secondary bootstrap itself?

The fan is often the source of irritating noise.  The size of the fan is 3" x 3".  The fan (12V/0.14A) is powered from the 12V.  The fan is brushless and an outrunner (the magnet is out side); a Hall switch inside the fan does the communication.

The motherboard power connector is as follows, (note the color code)
Pin Signal Description

P8.1 Power Good

P8.2 +5 V

P8.3 +12 V

P8.4 −12 V

P8.5 Ground

P8.6 Ground


P9.1 Ground

P9.2 Ground

P9.3 −5 V

P9.4 +5 V

P9.5 +5 V

P9.6 +5 V

There are other power connectors for floppy drive and hard drive.

[I accidentally shorted something and the fuse was blown.  The two power BJT were destroyed.  Not sure how it happened.   I might have touched the heat sink to the chassis ground.  The fuse is not there to protect the components.]

Monday, January 19, 2015

Soda Can Wifi Antennas

Some clever folks posted the parabolic antennas made from beer cans.  It is quick and easy to do.  I made one for my router.  Although the gain is not dramatic, I do see some improvement in SNR.  The signal quality indicator goes up a few percent.


Monday, January 12, 2015

A 4-W White LED Driver Circuit

Here is a white LED driver circuit for four 1W white LEDs powered by one Li-ion battery cell.  It is a boost converters with current limit to about 400mA.  The converter frequency is about 35KHz with 80% duty cycle.  The current draw from the supply is 1.4A average with 0.5A ripple.  The current delivered to the LEDs are 0.3A.  The prototype achieves about 72% efficiency, matching the simulation very well.





Tuesday, January 6, 2015

IoT with ESP8266

The recent release of ESP8266 has opened new possibilities for the age of IoT.  Its low-cost, versatility and simplicity make it instantly popular.  I fetched a module for less than $4.
ESP-01 Module
The Chinese made ESP8266EX is a complete WiFi chip, including RF and a Tensilica processor.  The programming of the processor is supported by the GNU toolchain.  On the module, it includes a 4Mb SPI flash PROM for mass storage, a crystal, a few discretes and a printed antenna.  There are one red LED for power and one blue LED to UART TX.  The 8-pin connector has the following connection,

Pin
Name
Description
1 GND Ground
2 U0TXD UART0 Transmit, GPIO1, (blue LED)
3 GPIO2 U1TXD, I2C_SDA, has internal pull-up
4 CHIP_EN Chip Enable, active high
5 GPIO0 Has internal pull-up, (for Flash programming mode)
6 EXT_RSTB External reset signal, active low, pull-up resistor
7 U0RXD UART0 Receive, GPIO3, has internal pull-up
8 VDD +3.3V power input

Pull GPIO0 low at power up to enter the Flash programming mode.

The ESP-03 has more I/O pins.  The board is 17.4mm x 12.2mm with 2mm pin spacing.
ESP-03 Module
The additional pins are

GPIO12MTDI, HSPI_MISO, PWM0

GPIO13MTCK, HSPI_MOSI, UART0_CTS

GPIO14MTMS, HSPI_CLK, I2C_SCL, PWM2

GPIO15MTDO, HSPI_CS, UART0_RTS, PWM1

GPIO16Deep-Sleep Wakeup

Module Schematic
For normal operation, CHIP_EN should be high and GPIO15 low.  In standby, the power draw is about 1mA; in the receive mode, the power draw is about 70mA.  The transmit power draw is over 100mA, maybe as high as 200mA.  So make sure the voltage supply can provide this peak current.

For this version of the firmware, the baudrate is 9600.  It had to be determined by looking at the scope of the TX signal.  (Note that some documentation says 115200, but that may be for an earlier version.)

The ESP module starts as an access point, which can be connected from a PC WiFi adapter.  Open a server TCP port on the PC, using nc.   We can start the communication,
AT+CWMODE=2 # set mode AP
AT+CWSAP? # returns AP: ssid, password, channel, encryption
AT+CIFSR # returns the IP address
AT+CIPSTART="TCP","192.168.4.100",6789 # open a TCP connection
AT+CIPSEND=4 # send 4 bytes, type in the 
The message shows at the PC terminal running nc, and anything you type in nc is displayed at the serial terminal.

To create a TCP server
AT+CIPMUX=1 # must be 1 for server
AT+CIPSERVER=1,6789  # create server port 6789
At this point, we can connect to the server from the PC and whatever we send is displayed.
To send data back,
AT+CIPSEND=0,5 # send 5 bytes, must specify id

Another way to try is to set up an access point (AP) on a PC and have the module connect to it.  The command sequence is as follows,
AT+CWMODE=3 # set mode to station and AP
AT+CWLAP    # list the available APs
AT+CWJAP="AP","Password"  # to join an AP
AT+CIPSTART="TCP","192.168.12.1",1234 # open a TCP connection
AT+CIPSEND=4 # send 4 bytes, type in the 

Next we check the compiler toolchain and the SDK.

The toolchain is xtensa-lx106-elf.  The latest SDK is esp_iot_sdk_v0.9.4.  The default app IoT_Demo is built by running make and gen_misc.sh in the app directory.   To upload through serial port, set GPIO0 low and GPIO2 high and run in the bin directory,
~/esptool-py/esptool.py --port /dev/ttyUSB0 write_flash 0x00000 eagle.app.v6.flash.bin 0x40000 eagle.app.v6.irom0text.bin
Connecting...
Erasing flash...
Writing at 0x00008c00... (100 %)
Erasing flash...
Writing at 0x00067000... (100 %)

Leaving...
esptool.py is a python program to communicate with the ROM bootloader.  The baud rate is non-standard 74880.

The at_v0.20 only works with esp_iot_sdk_v0.9.3 .  It can be built and uploaded to the module like above.  The default baud rate is 115,200.  After spewing some garbage, it is ready to accept AT commands.