One of my cars has been used for very short trips lately. The question is whether the car battery can maintain full charge. The starter is rated 1.7KW, but that could be continuous running power. The start-up power could be higher. Let's assume 500A for 3 seconds, that's about 0.4Ah. The alternator rated output is 100A; but the actual charging current is much lower, no more than 1/4C, could be as low as 1/10C. The battery rated reserve capacity is 100min (25A) , so the capacity is about 42Ah; then the charging current could be only 4A. That means it should recover the loss energy in about 6min. So if the trip is more than 6min, the battery should maintain the full charge. This estimation is conservative.
Friday, August 9, 2019
Component Failures
Electronic components can fail in many ways. Here I try to document some failures that I've encountered.
Resistors usually fail open. I had a small gate resistor failed open, but I'm not sure if it failed because of a surge of current or a spike in voltage. I had an SMT 0805 resistor rated for 100V failed when 200V was applied to it. It failed slowly; I knew that because it was connected to an LED, and the LED faded and flicked a little before completely went out. A current surge on a resistor may just change its resistance. I had one current sense resistor increased its resistance by a factor 2 and another changed a few percent after current surge. Another 50-milliOhm axial current sensing resistance increased resistance to 250milliOhms.
An aluminum can capacitor blew itself apart completely after it was applied with reverse polarity voltage. A 1000uF 16V aluminum electrolytic capacitor at the output of 5V 2.5A AC adapter appeared overheated and failed with reduced capacitance. A ceramic capacitor fails short. It happened on a cPCI power backplane, which had a 10uF ceramic cap on 12V and became a 4-Ohm short.
A diode in a PC power supply failed short, tripped the fuse.
A white LED was overstressed with larger than normal current for a long time. It did not fail completely; but it flickered. It ran fine with reduced current.
Power MOSFETs can fail short. Usually a check for the resistances between terminals if the MOSFET is alive; all should be high impedance except that the source-drain body diode may give a little lower reading (depending on the meter used) if measured in the forward polarity of the diode. A check of the source-drain body diode voltage is also a good test; it should be about 0.5V (also depending on the meter used) in the forward direction and no voltage in the other direction. I had a power MOSFET in a push-pull converter failed with a source-drain hard short and gate-source short with 420 Ohms resistance. It was probably killed with a surge of current possibly due to transformer magnetic saturation. Another one died with the body diode still intact. But there was finite resistance between the gate and drain; when it was powered, it simply shorted the drain and source. An examination of its TO-220 casing showed blisters on the metal tab.
Opamps can fail when the output is shorted. Some opamps are more resistant to output short. The output stage is destroyed when the output is shorted and excessive current flows. I had a gate driver failed when the output was shorted to the ground. The damaged IC had the supply pins shorted as well as the output pin shorted to the supply pins.
Inductors and transformers are not easily destroyed, but they can wreak havoc on the components connected to them. Enormous voltages can be readily generated when they are switched.
Resistors usually fail open. I had a small gate resistor failed open, but I'm not sure if it failed because of a surge of current or a spike in voltage. I had an SMT 0805 resistor rated for 100V failed when 200V was applied to it. It failed slowly; I knew that because it was connected to an LED, and the LED faded and flicked a little before completely went out. A current surge on a resistor may just change its resistance. I had one current sense resistor increased its resistance by a factor 2 and another changed a few percent after current surge. Another 50-milliOhm axial current sensing resistance increased resistance to 250milliOhms.
An aluminum can capacitor blew itself apart completely after it was applied with reverse polarity voltage. A 1000uF 16V aluminum electrolytic capacitor at the output of 5V 2.5A AC adapter appeared overheated and failed with reduced capacitance. A ceramic capacitor fails short. It happened on a cPCI power backplane, which had a 10uF ceramic cap on 12V and became a 4-Ohm short.
A diode in a PC power supply failed short, tripped the fuse.
A white LED was overstressed with larger than normal current for a long time. It did not fail completely; but it flickered. It ran fine with reduced current.
Power MOSFETs can fail short. Usually a check for the resistances between terminals if the MOSFET is alive; all should be high impedance except that the source-drain body diode may give a little lower reading (depending on the meter used) if measured in the forward polarity of the diode. A check of the source-drain body diode voltage is also a good test; it should be about 0.5V (also depending on the meter used) in the forward direction and no voltage in the other direction. I had a power MOSFET in a push-pull converter failed with a source-drain hard short and gate-source short with 420 Ohms resistance. It was probably killed with a surge of current possibly due to transformer magnetic saturation. Another one died with the body diode still intact. But there was finite resistance between the gate and drain; when it was powered, it simply shorted the drain and source. An examination of its TO-220 casing showed blisters on the metal tab.
Opamps can fail when the output is shorted. Some opamps are more resistant to output short. The output stage is destroyed when the output is shorted and excessive current flows. I had a gate driver failed when the output was shorted to the ground. The damaged IC had the supply pins shorted as well as the output pin shorted to the supply pins.
Inductors and transformers are not easily destroyed, but they can wreak havoc on the components connected to them. Enormous voltages can be readily generated when they are switched.
Sunday, August 4, 2019
Install TinyCore Linux without CD
Even some of light weight Linux distribution, such as Lubuntu is too much for old computers, which I think still have usable life left. Recently I tried tinycore and was impressed by it. Here is how to install it on a computer with a version of Linux already installed. And we install it without using a CD drive.
TinyCore Linux is very flexible. We can take the iso image and simply unpack it to /tce directory. We add a Grub entry to load the TinyCore image,
TinyCore Linux is very flexible. We can take the iso image and simply unpack it to /tce directory. We add a Grub entry to load the TinyCore image,
linux /tce/boot/vmlinuzThis setup is by far the easiest and the most responsive Linux I've used. The file /tce/onboot.lst specifies the list of packages that are loaded on boot. We can edit it for customization. Most applications should probably be installed as ondemand for fast boot. I install chromium browser as ondemand. It takes a few extra seconds to load, but the browser is usable. The home directory is saved on exit and restored on boot. However, if it gets too large, it can have a persistent storage location on disk.
initrd /tce/boot/core.gz
Monday, July 8, 2019
Creative CT6840 Webcam on Tinker Board
The Creative CT6840 webcam is about 20 years old. Windows 10 does not recognize it; but Linux (4.4.0 x86_64 Ubuntu 16.04) does load the driver and runs it fine,
This webcam uses OV511 camera-to-USB bridge chip. OmniVision's OV511 is designed to work with the company's single-chip image sensors, the OV7610 Series and the OV7110 Series. OV7610 is 1/3 in VGA color image sensor, with 8.4 x 8.4 um^2 pixel size, capable of 30Hz progressive at 640x480. The quality of the image is not very good. We can appreciate the great advance in the imaging sensor technology during the last 20 years.
However, there is no driver for it on the TinkerOS distribution. The driver source code is in TinkerBoard debian_kernel source on Github. We will try to compile it ourselves. We downloaded the kernel source 4.4.103+ for TinkerOS Debian V2.0.7. The driver source code is drivers/media/usb/gspca/ov519.c . We like to compile the driver to a kernel module without having to build the entire OS. We copy the kernel config file from /lib/modules and Module.symvers from /usr/src/linux-headers to the source directory, then
Try Armbian kernel. It works; guvcview shows a frame rate of 7.5 fps.
[28163.448127] usb 1-2: new full-speed USB device number 3 using xhci_hcdSo does Armbian on OrangePi. This is the great advantage of using an open-source OS. VLC, cheese, or guvcview can be used to view the images.
[28163.765592] usb 1-2: New USB device found, idVendor=05a9, idProduct=0511
[28163.765595] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[28164.813944] media: Linux media interface: v0.10
[28164.821933] Linux video capture interface: v2.00
[28164.826858] gspca_main: v2.14.0 registered
[28164.831722] gspca_main: ov519-2.14.0 probing 05a9:0511
[28165.040996] input: ov519 as /devices/pci0000:00/0000:00:0c.0/usb1/1-2/input/input8
[28165.041553] usbcore: registered new interface driver ov519
This webcam uses OV511 camera-to-USB bridge chip. OmniVision's OV511 is designed to work with the company's single-chip image sensors, the OV7610 Series and the OV7110 Series. OV7610 is 1/3 in VGA color image sensor, with 8.4 x 8.4 um^2 pixel size, capable of 30Hz progressive at 640x480. The quality of the image is not very good. We can appreciate the great advance in the imaging sensor technology during the last 20 years.
However, there is no driver for it on the TinkerOS distribution. The driver source code is in TinkerBoard debian_kernel source on Github. We will try to compile it ourselves. We downloaded the kernel source 4.4.103+ for TinkerOS Debian V2.0.7. The driver source code is drivers/media/usb/gspca/ov519.c . We like to compile the driver to a kernel module without having to build the entire OS. We copy the kernel config file from /lib/modules and Module.symvers from /usr/src/linux-headers to the source directory, then
make kernelversionto confirm the version number.
make menuconfigto enable the ov51x module,
make ARCH=arm drivers/media/usb/gspca/ov519.ko,but that only makes ov519.o.
make ARCH=arm modules SUBDIRS=drivers/media/usb/gspca/makes ov519.ko.
make ARCH=arm modules_install SUBDIRS=drivers/media/usb/gspca/installs the kernel module in /lib/modules/4.4.103/extra/. Run
depmod
modprobe gspca_ov519.ko .
[ 31.583420] usb 1-1.2: new full-speed USB device number 7 using dwc2But the image does not come out right; it appears to be some kind of format error.
[ 31.684866] usb 1-1.2: New USB device found, idVendor=05a9, idProduct=0511
[ 31.684887] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 31.732956] gspca_main: v2.14.0 registered
[ 31.741516] gspca_main: ov519-2.14.0 probing 05a9:0511
[ 31.938123] input: ov519 as /devices/platform/ff540000.usb/usb1/1-1/1-1.2/input/input7
[ 31.939754] usbcore: registered new interface driver ov519
Try Armbian kernel. It works; guvcview shows a frame rate of 7.5 fps.
Linux tinkerboard 4.19.33-rockchip #5.77 SMP PREEMPT Wed Apr 3 17:06:29 CEST 2019 armv7l armv7l armv7l GNU/Linux
[ 84.650548] usb 1-1.2: new full-speed USB device number 7 using dwc2
[ 84.751749] usb 1-1.2: New USB device found, idVendor=05a9, idProduct=0511, bcdDevice= 1.00
[ 84.751762] usb 1-1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 84.805728] gspca_main: v2.14.0 registered
[ 84.809936] gspca_main: ov519-2.14.0 probing 05a9:0511
[ 85.040060] input: ov519 as /devices/platform/ff540000.usb/usb1/1-1/1-1.2/input/input7
[ 85.040954] usbcore: registered new interface driver ov519
Probing does not always succeed for some reason.
Friday, June 21, 2019
Garmin Lidar Lite V3 on OrangePi PC
Connect Garmin Lidar Lite V3 to the OrangePi PC 40-pin header, either on I2C-0,
or I2C-1,
Run i2c detection on bus 0: i2cdetect 0; and the device is detected on 0x62, the default address.
Start by trying a Python version that uses smbus (or smbus2). But all registers read 0.
Try Garmin's LIDARLite_RaspberryPi_Library. Note that the library hard coded the i2c bus to i2c-1. The code compiles and runs fine without modification. Add code to do a register dump,
Try to display the distance on the 1.8" LCD. The simplest way is just to redirect the fb console. Use con2fbmap to map a tty console to the fb. And to set to a large font,
3
|
twi0_sda
|
blue
|
4
|
+5V
|
red
|
|
5
|
twi0_sck
|
green
|
6
|
gnd
|
black
|
or I2C-1,
27
|
twi1_sda
|
blue
|
28
|
twi1_sck
|
green
|
Run i2c detection on bus 0: i2cdetect 0; and the device is detected on 0x62, the default address.
Start by trying a Python version that uses smbus (or smbus2). But all registers read 0.
Try Garmin's LIDARLite_RaspberryPi_Library. Note that the library hard coded the i2c bus to i2c-1. The code compiles and runs fine without modification. Add code to do a register dump,
Add 0.5 sec delay. It prints distance at about 1 Hz. The max update rate appears to be 300Hz , possibly limited by 100KHz I2C speed. Occasionally, there are errors and the kernel prints error message,
0x00 0x05 ACQ_COMMAND 0x01 0x26 STATUS 0x02 0x80 SIG_COUNT_VAL 0x04 0x08 ACQ_CONFIG_REG 0x09 0x67 VELOCITY 0x0c 0xe8 PEAK_CORR 0x0d 0x3d NOISE_PEAK 0x0e 0x9a SIGNAL_STRENGTH 0x0f 0x00 FULL_DELAY_HIGH 0x10 0x9e FULL_DELAY_LOW 0x11 0x01 OUTER_LOOP_COUNT 0x12 0x05 REF_COUNT_VAL 0x14 0x00 LAST_DELAY_HIGH 0x15 0x05 LAST_DELAY_LOW 0x16 0x34 UNIT_ID_HIGH 0x17 0x30 UNIT_ID_LOW 0x18 0x00 I2C_ID_HIGH 0x19 0x00 I2C_ID_LOW 0x1a 0x00 I2C_SEC_ADDR 0x1c 0x00 THRESHOLD_BYPASS 0x1e 0x00 I2C_CONFIG 0x40 0x00 COMMAND 0x45 0x14 MEASURE_DELAY 0x4c 0x43 PEAK_BCK 0x52 0x00 CORR_DATA 0x53 0x00 CORR_DATA_SIGN 0x5d 0x00 ACQ_SETTINGS 0x65 0x00 POWER_CONTROL
sunxi_i2c_do_xfer()985 - [i2c1] incomplete xfer (status: 0x48, dev addr: 0x62)This is using armbian 5.38 with linux image sun8i 3.4.113.
Try to display the distance on the 1.8" LCD. The simplest way is just to redirect the fb console. Use con2fbmap to map a tty console to the fb. And to set to a large font,
sudo setfont -C /dev/tty1 /usr/share/consolefonts/Lat15-TerminusBold14.psf.gzFor something fancier, need a graphics library. The SDL library can be used. Python Pygame can be set to use SDL to test it out. Pygame works fine on the LCD. It is very desirable to stay with Python. So SWIG is used to add python interface to the Garmin library. With that, the LCD displays the distance nicely. However, there are some unresolved issues with console/framebuffer management. The other option is just to write to the framebuffer directly as images. Note that the format is hardware dependent; for this particular LCD, the format is packed 16-bit RGB (5/6/5).
Wednesday, May 29, 2019
FreeDOS on AtomicPi
Atomic Pi can be a great platform to try other OSes, such as DOS, ReactOS, Minix. Here we start with the oldest PC OS, DOS. We will install FreeDOS to a microSD card. We will use an old 256MB microSD card.
It appears that the easiest way to get a DOS disk image is to use VirtualBox, QEMU or Bochs. We get the CDROM ISO file from freedos.org. We'll use QEMU. First, create a 200MB DOS disk,
We can mount the disk image in Linux,
After that, we can directly boot the SD card,
However, if we try chain-loading on Atomic Pi, we get the error message "invalid EFI file path". The Atomic Pi BIOS cannot load the legacy MBR; and it may not provide the BIOS that DOS is depended on. It does not seem to have the Compatibility Support Module to provide the legacy BIOS support.
Is it possible to have a BIOS compatibility layer?
It appears that the easiest way to get a DOS disk image is to use VirtualBox, QEMU or Bochs. We get the CDROM ISO file from freedos.org. We'll use QEMU. First, create a 200MB DOS disk,
qemu-img create dos.img 200MThen run the emulator to boot from the ISO image,
qemu-system-i386 -m 16 -k en-us -rtc base=localtime -hda dos.img -cdrom FD12CD.iso -boot order=dWe proceed with installation. We did a full installation, which took about 89MB. Additionally packages can be installed by running fdimples. Included on the CD are games, including a version DOOM clone, BOOM, which runs fine on QEMU.
We can mount the disk image in Linux,
sudo mount -o loop,offset=32256 dos.img /mnt/dos/The offset is necessary, because the DOS partition starts at sector 63. We can write the disk image to the SD card
dd if=/dev/loop0 of=/dev/sdb1We install the DOS MBR by adding it as the second disk,
qemu-system-i386 -hda dos.img -hdb /dev/sdband run `fdsik /mbr 2`.
After that, we can directly boot the SD card,
qemu-system-i386 -hda /dev/sdbOn an older PC with Intel Core2 Duo, it boots directly with a USB uSD reader. Or we can use GRUB chain-loading,
set root=(hd1,msdos1)We added this as another menuentry to the grub.cfg file.
chainloader +1
boot
However, if we try chain-loading on Atomic Pi, we get the error message "invalid EFI file path". The Atomic Pi BIOS cannot load the legacy MBR; and it may not provide the BIOS that DOS is depended on. It does not seem to have the Compatibility Support Module to provide the legacy BIOS support.
Is it possible to have a BIOS compatibility layer?
Wednesday, May 8, 2019
Atomic Pi
At some point, there is bound to be a version of Pi with an Intel processor. Atomic Pi is here for a similar price of $35. It comes with Atom x5-Z8350, 2GB RAM, 16GB flash. x5-Z8350 has a max TDP of 4W; with a large heat sink, it can run fanless. (Compared with a similar performance Core 2 Duo T7200 of 34W max TDP.) There is one USB 3 port; another USB 2 port does not has standard USB A connector. A 26-pin I/O header has 2 UARTs and 6 GPIOs. The audio circuitry is a little curious: a digital audio power amplifier and a microcontroller for two digital microphones. For most part it appears superior to Raspberry Pi.
The board is about 260g. It lacks a convenient power connector. So the first thing is to solder a more standard 2mm power jack.
We need to connect a keyboard/mouse to the USB and a monitor to the HDMI connector. Power up and we see the BIOS screen then the Lubuntu login screen. The current draw is about 1.2A and does not seem to exceed 1.5A. The board draws 0.1A after shutdown. In the suspend mode, the board draws 0.4A. We also need to attach antennas for WiFi and Bluetooth; both work fine. At the BIOS splash screen, DEL key gets into the BIOS settings. We set the date and time, which is back with CR2032 coin battery.
The preinstalled OS distribution is Ubuntu 18.04.1 LTS. The python script for BNO055 (gyro, accel and mag) works. Run stress to load the CPU; the temperature only gets up to 55C (from 44C idle) with current draw about 1.6A. The heatsink is only a little warm. The video playing at the full screen is smooth. Initially there is no audio through HDMI and the problem is solved by changing pulseaudio configuration (using instructions from the user forum).
I tried to boot from a uSD card, but it did not work. It appears not to support legacy MBR boot. We'll create UEFI boot partition and install efi bootloader,
We can also add the Linux system on the uSD to the default eMMC grub menu and boot into it.
The write speed to the uSD is 15.5MB/s and read speed is 29.1MB/s.
Run hardinfo benchmark; the results are: CPU Blowfish 6.60s, CPU CryptoHash 96.49MB/s, CPU Fibonacci 3.29s, CPU N-Queens 32.85s, FPU FFT 6.80s, FPU Raytracing 9.37s. (Compared with Core 2 Duo Blowfish 10.7s, CryptoHash 155.50s, Fibonacci 4.86s, N-Queens 29.45s, FFT 4.46s, Raytracing 16.59s.) According to PassMark CPU benchmarks, Z8350's average CPU mark is 1266 vs 1167 for T7200.
Next we'll test out the other connectors.
CN3 is the power button connector, unpopulated. When the two pin shorted momentarily, it turns on the system or wakes up from suspend.
CN10 is the debug UART serial port (3.3V), /dev/ttyS0, which is the boot console, at 115,200 baud. The AMI BIOS is also accessible here, so we do not have to connect a keyboard and a monitor, which is a great convenience.
Overall it is a very impressive board for the price.
The board is about 260g. It lacks a convenient power connector. So the first thing is to solder a more standard 2mm power jack.
We need to connect a keyboard/mouse to the USB and a monitor to the HDMI connector. Power up and we see the BIOS screen then the Lubuntu login screen. The current draw is about 1.2A and does not seem to exceed 1.5A. The board draws 0.1A after shutdown. In the suspend mode, the board draws 0.4A. We also need to attach antennas for WiFi and Bluetooth; both work fine. At the BIOS splash screen, DEL key gets into the BIOS settings. We set the date and time, which is back with CR2032 coin battery.
The preinstalled OS distribution is Ubuntu 18.04.1 LTS. The python script for BNO055 (gyro, accel and mag) works. Run stress to load the CPU; the temperature only gets up to 55C (from 44C idle) with current draw about 1.6A. The heatsink is only a little warm. The video playing at the full screen is smooth. Initially there is no audio through HDMI and the problem is solved by changing pulseaudio configuration (using instructions from the user forum).
I tried to boot from a uSD card, but it did not work. It appears not to support legacy MBR boot. We'll create UEFI boot partition and install efi bootloader,
grub-install --target=x86_64-efi --efi-directory=/mnt/ --bootloader-id=GRUB --boot-directory=/media/atomicpi/xxx/boot/It was not able to find the config file initially; it was looking for it under ubuntu somehow. So I put one there. There is probably a way to specify it. The uSD card had an Ubuntu 16.04 distribution, but it mostly worked here. It did report some kernel driver issues and the HDMI audio driver did not load, apparently missing snd-hdmi-lpe-audio kernel module, which was not included in the 4.4.0 version of the kernel. I upgraded the kernel to 4.15.0; now the audio driver was included. But there seemed some problem starting pulseaudio. In addition, a later version of gcc is required to compile the kernel module, i2c-gpio-custom.
We can also add the Linux system on the uSD to the default eMMC grub menu and boot into it.
The write speed to the uSD is 15.5MB/s and read speed is 29.1MB/s.
Run hardinfo benchmark; the results are: CPU Blowfish 6.60s, CPU CryptoHash 96.49MB/s, CPU Fibonacci 3.29s, CPU N-Queens 32.85s, FPU FFT 6.80s, FPU Raytracing 9.37s. (Compared with Core 2 Duo Blowfish 10.7s, CryptoHash 155.50s, Fibonacci 4.86s, N-Queens 29.45s, FFT 4.46s, Raytracing 16.59s.) According to PassMark CPU benchmarks, Z8350's average CPU mark is 1266 vs 1167 for T7200.
Next we'll test out the other connectors.
CN3 is the power button connector, unpopulated. When the two pin shorted momentarily, it turns on the system or wakes up from suspend.
CN10 is the debug UART serial port (3.3V), /dev/ttyS0, which is the boot console, at 115,200 baud. The AMI BIOS is also accessible here, so we do not have to connect a keyboard and a monitor, which is a great convenience.
Overall it is a very impressive board for the price.
Subscribe to:
Posts (Atom)
