Tuesday, January 22, 2019

Multimeter measurement of resistance

How does a multimeter measure resistance?  A lot of online answers suggest that a constant current stimulus is used.  I looked into it and found that the stimulus current is not constant at all for digital multimeter.  Perhaps it was true back in the analog meter days.  The digital multimeter uses a constant voltage with a resistor in series.  For different measurement range, different resistor value is used, large resistor value for large measurement range.  Some meters also change the constant voltage for different ranges, normally large voltage at lower resistance range.  The series resistor and the resistor under measurement form a resistor divider.  The resistance measurement is calculated from the divider voltage.

It is fairly easy to find out the stimulus voltage.  First set the ohm meter to manual range.   Use a volt meter  to measure the voltages of the ohm meter for two known resistance.  From the two equations, we can solve the stimulus voltage and the series resistance.

For Fluke 87, the stimulus voltage is 1.235V, the series resistances over the ranges are 6.5K (400-Ohm), 15.7K (4K-Ohm), 106K (40K-Ohm), 1.02M (400K-Ohm), 10M (4M-Ohm) and 10M (40M-Ohm).

For Cen-Tech multimeter, the stimulus is 3V for 200-Ohm range and 0.3V for others.  The series resistance is 1.59K (200-Ohm), 3.34K (2K-Ohm), 12.5K (20K-Ohm),  103K (200K-Ohm),  and 1M (2M-Ohm).

For high-end digital multimeters, like Keysight 34401A (6.5-digit), it uses current source, 1mA (100 and 1K-Ohm), 100uA (10K), 10uA (100K), 5uA (1M), 0.5uA (10M), 0.5uA||10MOhm (100M).

Friday, January 18, 2019

Aukey Dash Cam GPS Antenna

The GPS antenna ($20) has 4-conductor 3.5mm plug that goes into the Aukey Dash Cam for location information to be included in the recorded video. 


We'll try to decipher to the interface signals.  From a picture of the disassembled GPS antenna, we know the pinouts for the plug, VCC, GND, TX, RX.  It is more than just an antenna; it is a GPS module.  We'll take a look what the protocol is.  First we want to know the VCC voltage.  VCC is measured to be 3.3V, so are TX and RX.   The we'll look at the TX and RX to see what kind of signals they are.  There is no activity on RX.  TX shows what appears to be 3.3V UART signals.  The minimum pulse width is about 104us, so the baud rate is 9600.  The messages come in 580ms burst every second.  We connect TX to a UART receiver.  We can see the standard NMEA GPS strings.  The messages include GPRMC (recommended minimum), GPVTG (vector track over ground), GPGGA (fix information), GPGSA (satellite data), GPGSV (detailed satellite data), GPGLL (lat/lon data).

We can tap into the TX signal to extract GPS data for other purpose.

Sunday, December 30, 2018

0.96" I2C 128X64 Blue OLED Display Module

I ordered a 0.96" I2C 128X64 Blue OLED Display Module from eBay for $2.85 (shipping included).   It claims: voltage 3-5V,  power consumption of full lit screen 80mW, SSD1306 driver IC, compatible with Arduino.  When it arrived about three weeks later, the circuit on the back looked a little different from the product pictures on eBay.

Notably there is no regulator IC that would generate 3.3V from 5V.   It also lacks the level shifters  that are on the similar product by adafruit.   I'm a little skeptical that it can run on 5V..  So we'll start with 3.3V supply.  The two I2C signals are pulled up with 10K resistors.

We will test it using esp32-pico-kit with Arduino on Linux.  The CP210x UART Bridge is mapped to /dev/ttyUSB0.  Adafruit SSD1306 library (along with GFX library) claims to be compatible with ESP32.  We will try the example sketch ssd1306_128x64_i2c.   We need to know the default I2C pins.  It took a while to poke around the ESP32 code to find the pin definition: SDA=21 and SCL=22.   We compile and upload the code.  We open the serial monitor (9600 baud) and see some output, but there is nothing on the display.

We'll try a different library, "ESP8266 and ESP32 Oled Driver for SSD1306 display".  After modifying the I2C pins, the example SSD1306SimpleDemo works nicely.  The current for the module is 4 - 12mA as the program runs through different screen drawings.


Sketch uses 166885 bytes (12%) of program storage space. Maximum is 1310720 bytes.
Global variables use 11444 bytes (3%) of dynamic memory, leaving 283468 bytes for local variables. Maximum is 294912 bytes.
esptool.py v2.1
Connecting........__
Chip is unknown ESP32 (revision 1)
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...

Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 7540.8 kbit/s)...
Hash of data verified.
Compressed 14128 bytes to 9213...

Writing at 0x00001000... (100 %)
Wrote 14128 bytes (9213 compressed) at 0x00001000 in 0.1 seconds (effective 818.5 kbit/s)...
Hash of data verified.
Compressed 168032 bytes to 92899...

Writing at 0x00010000... (16 %)
Writing at 0x00014000... (33 %)
Writing at 0x00018000... (50 %)
Writing at 0x0001c000... (66 %)
Writing at 0x00020000... (83 %)
Writing at 0x00024000... (100 %)
Wrote 168032 bytes (92899 compressed) at 0x00010000 in 1.6 seconds (effective 861.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 122...

Writing at 0x00008000... (100 %)
Wrote 3072 bytes (122 compressed) at 0x00008000 in 0.0 seconds (effective 4691.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...
ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:13076
entry 0x40078ad0




Tuesday, December 4, 2018

LCR-T4 Transistor Tester Display Upgrade

I ended up with a  transistor tester lcr t4 with a damaged LCD display.  We'll try to replace the display with a 1.8" 128x160 TFT color LCD (which can be purchased for about $4).  We used a version of the display previously.  This version has a different (better) pinouts that separates out the SD card connections.  The display uses ST7735S controller chip that is supported by the tester software.

The first issue is the supply voltage.  The tester uses 5V and the display uses 3V.  The display has a regulator to generate 3V from 5V, but the I/Os have to be compatible.  There is no evidence that the input signals to the display are 5V tolerant.  So we'll insert 1-2K resistors in series to limit the current to about 1mA.  Then these is the issue of the backlight.  The display has the cathode grounded, incompatible with the tester connections.  The backlight LED has a forward voltage about 3V@20mA; the tester circuit seems to operate at about 5mA (2.6V).  We'll drive it with a 330-Ohm current limiting resistor from 5V.  The tester is turned on with a push of a button, but kept on with the current through the backlight LED.  So we'll insert a 4.7K resistor at the original LED connection, which would provide about 1mA base current.

We traced the tester's LCD pads,
  • SCK - PD2
  • SDA - PD3
  • A0 - PD1
  • RESET - PD0
  • CS - GND
1.8" TFT 128x160 LCD Module
LCR-T4 with 1.8" LCD
We updated the firmware.  The Flash is very close to full.  It might be hard to add any new features.
AVR Memory Usage
----------------
Device: atmega328p
Program:   32060 bytes (97.8% Full)
(.text + .data + .bootloader)
Data:        202 bytes (9.9% Full)
(.data + .bss + .noinit)
EEPROM:      882 bytes (86.1% Full)
(.eeprom)
When operating, the tester draws about 23mA.  It works to about 7V.



Sunday, November 4, 2018

Transistor Tester LCR-T4

The tester was originated here, and continued here.  I got a version of the tester, LCR-T4 for $6.39.  It was reviewed by Dave of EEVblog here.  It uses AVR ATmega328P (8MHz) with a 128x64 LCD with back light.  The closest schematics is one here.  78L05 regulates 9V battery to 5V and TL431 provides 2.5V reference.  One push button is used for user control and selection and the 14-slot ZIF socket is convenient for different pin spacing.

It can identify and measure a number of 2 or 3-terminal devices and gives reasonably accurate readings  Another attractive aspect is that it can be reprogrammed (through the 6-pin header).  The source code is available.  One issue is the variety of the boards with slight differences, especially the LCD interface.   It appears that this one uses 4-wire interface,
  • PD0 - RST, reset
  • PD1 - A0, command/data 
  • PD2 - SCL, serial clock 
  • PD3 - SI, serial data
Chip Select does not seem connected to any pin, probably grounded.

Install gcc-avr and avr-libc to build the code with the makefile in mega328_T4_v2_st7565.  avrdude is used to flash the microcontroller.  The old AVR ISP with RS232 interface is supported, choosing avrispv2 as the programmer type.  For AVR JTAGICE3, the programmer type is jtag3isp.   Press the button while flashing.   Also we can use an arduino board as a programmer when flashed with ArduinoISP.   The programmer type is avrisp.  The 6-pin programming header can be connected together except for the reset pin, which goes to D10.

See here for a list of software features.

Friday, August 31, 2018

New life on an old computer with Tinker Board

In 2003, I bought an HP/Compaq Presario 2100 laptop, not the best purchase that I made.  In this days of age, it is just not very useful even after I put in a solid-state hard drive and installed light-weight Linux desktop.  It just could not handle the very basic functions of web surfing.  But it seems such a waste to throw it out.

On the other hand, little single board computers, such as Raspberry Pi show  great potential.  They cost about 20 times less than what I paid for the laptop. But they do not come with a screen, keyboard/touchpad.  I recently acquired an Asus Tinker Board, which has pretty impressive performance.    With a fast microSD card, it can surf the web comfortably.   When they are networked together (but having to settle for 100Mbps Ethernet), the laptop just serves as a terminal for the Tinker Board by running VNC.  I found tigervnc to be the best. However, VNC does not pass audio.  One solution is to connect the audio output to the laptop microphone input and run loopback to the speaker (pactl load-module module-loopback latency_msec=1).  This arrangement proves to be quite usable even though the screen resolution is relatively low.  If an external monitor is attached through HDMI, synergy can be used to share the keyboard and pointer.


Sunday, August 19, 2018

TI Simplelink BLE

Here we try out TI SimpleLink Bluetooth Low Energy (BLE) CC2650MODA+MSP432P401R Launchpad bundle ($35).  MSP432P401R comes with an out-of-box demo with LEDs.  We install the latest CCS 8.1.0 and SimpleLink MSP432P4 SDK (v2.20.00.12).  From the SDK, we import outofbox_msp432p401r_MSP_EXP432P401R_tirtos_ccs and  compile and upload.  After that is successful, we download SimpleLink SDK BLE Plugin (simplelink_sdk_ble_plugin_1_40_00_42) and also BLE-Stack (ble_sdk_2_02_02_25). 

We import from SimpleLink SDK BLE Plugin project_zero_MSP_EXP432P401R_tirtos_ccs.   We compile and upload.   When the USB is connected to a PC, two serial ports are created.  On Linux they are /dev/ttyACM0 and ACM1.  Connect to the serial port at 115200 baud, the following message comes up.
--------- Project Zero Example ---------
Initializing the user task, hardware, BLE stack and services.
LEDService: Registered callbacks to application.
ButtonService: registered callbacks to application
DataService: Registered callbacks to application.
LEDService: Registered service, 1 attributes
ButtonService: Registered service, 2 attributes
DataService: Registered service, 2 attributes
Scanning for Bluetooth devices, "Project Zero" should come up.   TI Android App SimpleLink SDK Explorer can be used for testing; it has a Project Zero interface to control the LED, read buttons, and send text.  On Linux, we can use hcitool lescan to scan and gatttool to test
gatttool -b A0:E6:F8:BD:EB:02 -I
[A0:E6:F8:BD:EB:02][LE]> connect
Attempting to connect to A0:E6:F8:BD:EB:02
Connection successful
[A0:E6:F8:BD:EB:02][LE]> primary
attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x0008, end grp handle: 0x0008 uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0009, end grp handle: 0x001b uuid: 0000180a-0000-1000-8000-00805f9b34fb
attr handle: 0x001c, end grp handle: 0x001e uuid: f0001110-0451-4000-b000-000000000000
attr handle: 0x001f, end grp handle: 0x0025 uuid: f0001120-0451-4000-b000-000000000000
attr handle: 0x0026, end grp handle: 0xffff uuid: f0001130-0451-4000-b000-000000000000
[A0:E6:F8:BD:EB:02][LE]> char-write-req 0x001e ff00ff
Characteristic value was written successfully
[A0:E6:F8:BD:EB:02][LE]> char-read-hnd 0x001e
Characteristic value/descriptor: ff 00 ff
When both buttons are pressed, CC2650MODA is flashed.  However, note the default project includes cc2640r2lp_simple_np_uart_pm_sble hex, which does not work with CC2650.  We replace it with simple_np_cc2650bp_uart_pm_sbl_2_02_01_18a_merge.  If there is some problem flashing, install SmartRF Flash Programmer 2 (v1.7.5).

CC2650MODA draws about 160uA when idle, and 0.1uA when in reset.  There is a 100K pull up resistor on the reset pin, which could contribute to 30uA if the reset pin is pulled low.