16F877 ADC using the Allegro ACS754 Current Sensor


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Trial and error and possible solution

    I've been trying allot of different approaches to my problem not wanting to give up and certainly not going to wait for someone to drop code in my lap. I came up with this routine that seems to be pretty stable.

    Code:
    mainloop:
            Gosub   getx            ' Get x value read ADC return value in 'x'
            x = x - 128
            vmin = vmin min x     ' Get min value
            WHILE VMIN <> 0    
                GOTO MAINLOOP  'stay here until the cross road of 0
            WEND
            vmax = vmax max x  
            resv = vmax * 3906
            resv = div32 1000
            READING = 1
            VALUE = resv
            gosub average         'send calculated amps to darryl's average routine
            resv = value
            cnt = cnt + 1
            if cnt >= 120 then    'get 120 averaged readings then display the amps
                Serout2 so,baud,[27,"[2;7H", dec5 resv]
                cnt = 0               'reset the counters and 
                vmax = 0
                VMIN = 1
            endif
            Pause   10             ' Do it about 10 times a second
            Goto    mainloop
    This seems pretty stable so far and switching between the hair dryers hi and low settings I can clearly see the amps switch between 5.8 ish and 12.8 ish give or tak an ish he he he. I've got a call into a friend to see if he's got a real accurate amp meter that I can test and see how accurate this ACS754 is. I'll keep you posted.

    If anyone else has any ideas about this code or possibly see something wrong with my code or has a better idea please let me know.

    Thanks
    David

  2. #2
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Allegro Support

    Just got off the phone with Allegro support who called me back after I emailed them just to confirm I wasn't going crazy and I didn't hook up something incorrectly and sure enough the Vout on the ACS754 will produce a sine wave proportionate to the current being used. So I simplified the heck out of my prorgam and just have it loop through as quickly as possible keeping track of the MAX and displaying that at every 300 count. I will experiment with that and watch it closely. I need to incorporate this into a circuit with another sensor, pressure transducer, hopefully I can run that pressure transducer and 2 of these Allegro ACS754's all on my 16F877.

    They did tell me that the ACS754 is going to go away and be replace by the ACS756 so... He also told me that the have an 8 pin version that for my application will read up to 30 amps and I should really be looking at that. He also told me the data sheet for the ACS712 has some peek voltage circuit examples which I am going to look at right now.

    Again if anyones worked with one of these current sensor and has any good code examples they found worked I would not mind taking a peek at that.

    Thanks
    David

  3. #3


    Did you find this post helpful? Yes | No

    Default current sense

    You could rectify the output and add filter (resister/capicator) and have a DC voltage related to the AC current. Still would have the offset voltage, about 2 volts which you subtract out anyway. 10 micro-farad and 100K ohms will smooth output.
    don
    Attached Images Attached Images  
    Last edited by amgen; - 5th May 2009 at 14:11. Reason: change filtering

  4. #4
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Going to try the recified output...

    Quote Originally Posted by amgen View Post
    You could rectify the output and add filter (resister/capicator) and have a DC voltage related to the AC current. Still would have the offset voltage, about 2 volts which you subtract out anyway. 10 micro-farad and 100K ohms will smooth output.
    don

    Don, Thanks I will give that a try. I'll let everyone know how that turns out.

Similar Threads

  1. Need a cheap touch sensor idea.. here it is
    By mister_e in forum Code Examples
    Replies: 20
    Last Post: - 16th April 2016, 23:42
  2. PIC 16f877 A/D conversion Allegro ACS712
    By DavyJones in forum General
    Replies: 32
    Last Post: - 4th June 2011, 05:54
  3. ADC input using a current transformer?
    By jessey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th May 2009, 23:13
  4. current sensor interfacing
    By hell_pk in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th January 2009, 05:55
  5. Reading (ADC) negative current
    By sougata in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 21st November 2006, 18:38

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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