Hot!PIC32MM Calculating Frequency of rectified AC

Junior Member
  • Total Posts : 95
  • Reward points : 0
  • Joined: 2016/05/01 06:51:28
  • Location: 0
  • Status: offline
2018/06/13 09:36:29 (permalink)

PIC32MM Calculating Frequency of rectified AC

This question isn't directly related to the PIC32MM per say but does consider the available resources it provides. I'm hoping I can validate my approach before I go ahead and code it up.

There is an AC source which is rectified, resistor divided and fed into the ADC. Normal working voltage is up to 35V. The source is high impedance, fixed current type and has a low frequency ranging from about 10Hz-200Hz.

The AC has shunt protection managed by the PIC. If the voltage rises above 35V a darlington shorts the rectified voltage. A darlington typically has a ~1.2v drop between base-emitter but lack of capacitance plus the low frequency should allow the PIC to determine when the voltage has gone below this (nearing zero edge, shunt disengages). Using a circular buffer to average the results I'll be establishing this "trigger point" manually every time the ADC interrupt fires.

All my S/MCCP peripherals (7) are in use for PWM. I didn't go down the capture-compare route as I wasn't sure whether the slow rise would be acceptable as a "leading edge" trigger or whether there'd be debouncing issues.
The resolution does not need to be dead-on accurate. +/-1 Hz would be perfectly acceptable.


Is to use a constantly running timer with enough resolution to ensure the count won't over-run for any frequency value. When a new ADC interrupt fires and the "trigger point" established in specification is met then the count is read and the value reset. The rest is basic math.

What do you think?

One potential snag (which I've come to realise is why the PIC32MM is priced lower) is the lack of timers. I'll probably have to use one for several operations using some quasi counters to differentiate execution.

0 Replies Related Threads

    Jump to:
    © 2018 APG vNext Commercial Version 4.5