PICs on a bus . . . ?


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Measuring AC current is not as easy as it seems. I assume that the voltage is something above 60V.

    Although the voltage waveform of your AC might be a sine wave, the current waveform seldom is. Unless your load is purely resistive, you cannot measure current by taking a percentage of the peak value output of a current transformer or Hall-effect device. If you are measuring "mains" voltage, then measuring the current by sensing voltage drop across a resistor is probably not an option. A Hall-effect device is usually the best option.

    So, you will probably need to measure RMS current.

    In order to get decent accuracy, you will have to sample the current waveform at least 10 times in each half-cycle, multiply each sample value by itself (square it), then average the samples by adding the squares together over a period (at least one cycle) and dividing by the number of samples, and finally taking the square root of the average.

    You *can* do this, and I don't want to sound like a broken record - but 18F parts are better at most everything!

    That said, I have used an 18F8723 to measure 4 channels of RMS current with good accuracy using Allegro Hall-effect current sensors.
    The chip was very busy, and was running at 40Mhz.
    Charles Linquist

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    In order to get decent accuracy, you will have to sample the current waveform at least 10 times in each half-cycle, multiply each sample value by itself (square it), then average the samples by adding the squares together over a period (at least one cycle) and dividing by the number of samples, and finally taking the square root of the average.
    Are you sure?

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    If you have a better idea, I'm open to it. Yes, you can sample slowly if you can tolerate a longer-term average (like you would need to display on an LCD). I realized that even with low sample rates, I would sample every part of the waveform eventually. But I needed an "electronic circuit breaker" that had to respond on a cycle-by-cycle basis.

    I proved that I could respond in one cycle by connecting a bridge rectifier + resistor + FET across the load and connecting the gate of the FET to a pin on a PIC development board then bringing the the gate high for 17 ms. It worked and the circuits are in the hands of a happy (and very demanding) military customer.
    Charles Linquist

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I went back and read the entire thread, and realized I was incorrect when I told ibralfy that it was necessary to sample often (that was *my* requirement). Aratti, you are correct when you imply that you don't a high sample rate. 20 or 30 samples between each LCD update should be enough.

    But ibralfy, if you sample slowly, you need to make certain that you aren't sampling at a sub-harmonic of the line frequency.
    Charles Linquist

Similar Threads

  1. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 13:35
  2. Communicating between two PICs over DC bus
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th May 2009, 12:57
  3. Retrieving infos from multiple PICs on a bus/chain
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th October 2007, 04:42
  4. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  5. Two pics in a I2C bus?
    By robert0 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th January 2006, 13:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts