Thursday, March 26, 2015

Isolated current sensing using LA25-NP

Another popular sensor used in my laboratory is current sensor LA25. In power electronic research, we tend to use sensor with safety standard. LA25 seem to fit in.


This sensor has nominal sensing current of 25A, and peak sensing current is 36A.
It needs +/- 15V supply voltage, and output current is 25mA.

It can be configured to change the sensing range in order to get more accurate result.
I draw each of the configuration on real picture as it will be more visual-able compared with datasheet.

25 AMP configuration

Pins 1 to 5 are connected together for "input sensed current", 
while pins 6 to 10 are connected for "output sensed current". 
M is the measurement, while +/- is for +/-15V supply.

12 AMP configuration
Pins 1 to 3 are connected together for "input sensed current", 
pins 4, 5, 8, 9, 10 are linked together. 
Last pins 6 and 7 are connected for "output sensed current".

8 AMP configuration
Pins 1, 2 are connected together for "input sensed current", 
pins 3, 9, 10 are connected together, 
pins 4, 5, 8 are connected.  
Last pins 6 and 7 are connected for "output sensed current".

6 AMP configuration
Pins 1 is for"input sensed current", 
pins 2, 10 are linked together, 
pins 3, 4, 9 are connected, 
pins 5, 7, 8 are also connected.  
Last pins 6 is for "output sensed current".

5 AMP configuration
Pin 1 for input,
Pin 6 for output,
Pins 2 and 10 are connected, pins 3 and 9 are connected, pins 4 and 8 are connected, pins 5 and 7 are connected.

The inner resistance change with each configuration, the lower the sensing range, the higher the internal resistance.
The supply voltage and output signal configuration are same as LV25











Isolated AC voltage sensing using LV25-P

Voltage sensing is one fundamental thing in embedded system design.
The simplest and cheapest way to sense the high voltage is using the voltage divider to scale the voltage into ADC allowable sensing range.

Additional filter capacitor (0.1uF) can be added in between VADC and ground to eliminated the noise.

Voltage divider sensing is easy to implement, has good accuracy, and sensing range can be customised. By adding a trimmer in between R1 and R2, a more precise measurement range can be obtained.

The only drawback of this method is that common ground issue, the ground from sensing voltage needed to be grounded together with microcontroller. In this regard, there might be safety issue, when measuring >100V. Also, by common ground, it is easier to induce noise to your circuitry especially in power converter applications.


Isolated sensing should be used in high voltage and noisy measurement. The LEM LV25-P is a hall-effect voltage sensor. It has galvanic isolation in between the sensing voltage, and signal output. It has safety certification (EN 50178: 1997), thus make it a very expensive device.

The price from Element14 is around RM294.91.

Above is basic layout of LV25 and it's pins descriptions. The signal is connected to +HT and -HT, "+" and "-" sign need +/- 15V supply voltage. M is the output signal. 

The basic circuit connection for LV25-P is as follow:

Although LV25 is a voltage sensor, but it actually sense current. A sense resistor is needed to limit the current before fed into LV25. The equation to select the suitable resistor is dividing the maximum sensing voltage with 10mA. The 10mA is the nominal current rms LV25 can tolerance. So, LV25 can withstand primary current, measuring range from 0 to ± 14mA.

The output of LV25 is current (Secondary nominal current rms 25mA). However,  ADC module only accepts the voltage signal instead of current signal. A resistor is placed at the output side to convert the current to voltage. The resistor value must be less than 300 ohm, else the linearity will change at difference voltage range. It is advisable to add an op-amp to amplify the signal instead of using a trimmer at the output to vary the gain.

If you are sensing DC voltage, the output signal range is from zero to positive value. 

If AC voltage, you will get a bipolar output, an offset circuitry (suggestion: use differential amplifier) is needed to shift the voltage range from +/-, to 0/+.






Wednesday, March 25, 2015

VC830l multimeter teardown

I have one broken unit of VC830l, and since it is no doing any good. I was so tempted to open it and I did.

I use two tools - Philips test pen and Proskit SD-803. That two are basically what I have in hand.


This is the back PCB of the multimeter and I do some guessing myself.


Above is the back cover, I think that is a buzzer, and it is connected to PCB using the two springs. 


Further unscrew, back PCB and front PCB. 

Front PCB has that nice looking circular track.


And we have the rotary thing with copper coupled.


This is the front cover, and there are two ball bearings.

The whole pcb look simple, and I only saw two ICs,
the controller and ST-GZ 344. 

Although, I never tear a fluke multimeter, but I think this pcb is simple. Maybe that why Victor can sell it at such low price. 





Review of VC830l multimeter

Previously when I want to buy VC830l, I try to google for the review on this multimeter. The result come out zero. Maybe this thing is too cheap to be reviewed, most people just use and toss. So I do a review myself.

The casing of VC830l felt hard and empty, firm hand grip. Maybe I was bias, so I treat it softly. Robustness wise, no idea. Well, is new, I havent drop it yet.

This multimeter has stand, but it is not perfectly aligned. It make "click" sound when you open and close it, especially when you close it.

The buzzer sound was loud and clear, it is actually quit high pitch. But I like the loud indication.

To test the accuracy, I have tested it with Fluke 73III. Some might argue that you cant compare RM30 with >RM1000. Actually Fluke is not famous for accuracy as you can see below:

Instead, the safety features, the sturdiness are Fluke main selling points. 

Even the fluke probe is still fine, after being roll over by chair with a 60kg person sitting on it. 

An accuracy comparison between both is a fair comparison.
First, it is tested with AC voltage. Fluke shows 239.9V, while VC shows 240V. 
VC only has two ranges for AC voltage, 600V and 200V. I use 600V to measure AC.


Fluke has higher precision, VC only has 2000 counts. Nevertheless, the result is acceptable.

Secondly, it is tested with 3V coin cell. Some thing, Fluke has higher counts, but reading until 2 decimal points for 20V testing is good enough.


After that, I measure the 12V battery, the reading is exactly the same.

I was happy to see that. 
A comparable accuracy with branded multimeter.
I mostly work with the DC voltage which is less than 100V such 5V supply, 3.3 signal, +15/-15. So this multimeter comes in handy.

Following that, I test the 1.5k. 0.25w, 1 percent tolerance, resistor.
I start with 200k ohm range, 


the 20k ohm range, I get extra decimal point accuracy.

the 2k ohm range, 3 decimal points accuracy.

I also have tested the resistor with Fluke,

only 0.002 difference, For me, that is acceptable, resistor tolerance can up to 5 percent. Most designs use 5 percent tolerance resistor. So the resistance measurement is good.

Just out of curiosity, I change to 20 mega ohm range, well, it get zero.

After that, I change to 200 ohm, it is over the measurement limit. The VC over-limit indication is not OL, rather, is a 1 on most left hand side.

Overall, I like this multimeter as it has all the basic useful functions, but I will treat it softly, not so harsh as Fluke. Btw, another bright side of VC830l is the big lcd display, it is really a plus.

Pros:
Has all the crucial functions which work well.
Big lcd display.
Acceptable accuracy.
Cheap.
has stand.

Cons:
Manual.
No capacitance measurement.
Only two range for AC measurement.




Tuesday, March 24, 2015

Buying a multimeter

I was thinking to buy a multimeter for myself. I am using the fluke multimeter in lab, it is a very good, solid, reputable multimeter.

But fluke is not something affordable and I am not using multimeter for safety critical work, so fluke is like an overkill.

I am surveying some cheap multimeters online, and I was extra cautious. Cheap thing doesnt come with quality.

After reading some reviews, I am planning to buy mn35, manual multimeter from Extech.
It has features like:
Type K Temperature
1.5V and 9V Battery test function
Data Hold locks reading in the display.

Beside that, the reviews from amazon are good, make it a valid reason as it is a decent multimeter for that price.

Conveniently, it is also sold at Mouser Malaysia for RM81.96. After registered with mouser, and put the multimeter in cart and proceed to checkout. I notice there is a shipping fee required, RM20.
That mean I have to pay extra quarter for multimeter.
Element14 and RS have free shipping, so I was hoping to get free shipping if I buy more than RM100, so I add another item in the cart. Nope, also no free shipping.

I choose to buy the second in my list. Cheaper one but with similar functions, vc830l. It is made by China manufacturer "Victor", it is considered a branded multimeter in China aside Atten, and Uni-t. I was sceptical, but sparkfun is selling it for a very long time. There must be a good reason why sparkfun is selling it? Maybe. Sparkfun has custom white colour skin vc830l - look nicer, and there are a mixed reviews on this multimeter, but I decided to give it a try. After all, you cant argue with the price - RM32 at Cytron.

Myduino is selling the exact model (vc830l) but white colour version. The price is RM58.00 which is almost double than the yellow colour version. I decided to go with fluke yellow look alike multimeter. Appearance is not important.

After I make a purchase on cytron website, I saw another teardown review on a Taiwan blog. For the one he bought, the rotary part get loss, and he adds another paper below to tighten it. Starting to doubt at my decision.

For the one I received vc830l from cytron, look good.

Unfortunately, it is broken.



Luckily I will get the replacement from cytron.

I get the reply in one day, that is very efficient.

Since, I will get a new multimeter, I will tear the broken vc830l in the coming few days.


Monday, March 23, 2015

PIC18f USB-HID

I always want to try the USB communication but USB is a notorious protocol. I read a lot about USB from online resources like waitingforfriday, engscope, wikipedia. I was confused.

And finally the author from engscope says that you dont need to understand USB software stacks to implement USB, so I decided to give it a try. The simplest way is to run existing projects offered by Microchip.

First, download the Microchip Libraries for Applications (MLA) from here and install it.
Just install it in the default location.

Also, I have MPLAB IDE v8.92 and c18 preinstalled, these can be downloaded from Microchip software achieve. Took me some times to find it.

For the hardware part, I use the development kit from cytron and the PIC I used is PIC18f4553.

In order to use the USB port, two pins (USB, SEL) inside the red circle need to be short.
Also I use the switches and leds on board to run the MLA demo projects.
1. SW1   - RB0
2. SW2   - RB1
3. LED1 - RB6
4. LED2 - RB7
We will use these in the source code initialization later.
Okay, the preparation is done.

--------------------------------------------------------------------------------------------------------------------------
The USB also have a few protocols, HID and CRC are the most commonly used.
HID - dont need driver, slower transfer rate.
CDC - need driver, act as serial, faster transfer rate.
There is a discussion "HID vs CDC"at Microchip forum.

Since HID is the simplest (cause no driver needed), so I decided to try the "Device - HID - Custom Demos" of MLA.
It can be found in "C:\microchip_solutions_v2013-06-15\USB\Device - HID - Custom Demos".

Now to go the "Firmware" in "Device - HID - Custom Demos" folder, you can see many Microchip MPLAB.Project files which are made for Microchip development kits.

I use the "USB Device - HID - Simple Custom Demo - C18 - PICDEM FSUSB" because it is the closet resemble of cytron SK40C. Need some modifications on the code later.
After you open the file, you should see something like this at the workspace.
Usually I would create a new project and copy the files to another folder to avoid the modification of original files.

Also I use pic18f4553, but this project is for pic18f4550. So it is more convenient to create a new project with pic18f4553 using project wizard.

The hard part of creating a new project "pic18f4553 usb hid" is to find all the header files and source files needed.

So the easiest way is copying all related files and folders into your project location.
From "C:\microchip_solutions_v2013-06-15\USB\Device - HID - Custom Demos\Firmware", 
copy out -
main, HardwareProfile, usb_config, and usb_descriptors.

Goto "C:\microchip_solutions_v2013-06-15\Microchip\Include"
copy out -
Compiler, GenericTypeDefs. And the entire folder "USB".

After that, you project folder should contain all these.

Finally, add the header files,  source files, and subfolder according to the second picture shown.
Phew, one of the crucial parts is done.

--------------------------------------------------------------------------------------------------------------------------

Modifying the source code.
First, go to github and download the "HardwareProfile - PIC SK40C".
Open "HardwareProfile.h" and modify the section shown at picture below:

or just copy the following lines and paste it.
        #if (defined(__18F4550) || defined(__18F4553))
            #include "HardwareProfile - PIC SK40C.h"

Some desciptions on the SK40C is shown at picture below

it is modified according to onboard leds and switches.

Last is the linker files.
If you are planning to use the pic18f4550, dont need to modify the linker file.
For the pic18f4553 user, open the linker file and modified the below section.


--------------------------------------------------------------------------------------------------------------------------

Testing part:
After you burn the program to pic, Led1 and Led2 will be blinking alternative when you plug it into computer.

Open the "GenericHIDSimpleDemo" at "C:\microchip_solutions_v2013-06-15\USB\Device - HID - Custom Demos".

Click "Connect". Clicks "Toggle LED(s)", the blinking will stop.
Press "Toggle LED(s)" again, both leds will on.
Now, press the "SW1" on SK40C, in the same time, press "Get Pushbutton State", you will get "State: Pressed".
Let go the "SW1", press "Get Pushbutton State" again, you will get "State: Not Present".

Implementation of other work is easy, without theory and understanding of USB, you can get it to run.
But modifying it for your own use is difficult.