PIC sine peak

Status
Not open for further replies.

hkit711

New Member
Hello all. I'm using PIC 16F916. I want to convert the peak value of a sine wave by the A/D converter. I need help to know how to calculate the the time and how to know the exact peak of the wave.

Thank you in advance.
 
Use a zero-crossing circuit to detect the zero crossing point, then time it until the peak of the sinewave - but you need to know the frequency for this. You could always measure the time between two zero-crossings and half it though.
 
Thank you Nigel. I didn't thought about zero-crossing. I think that will work. By the way, the frequency is always 50 Hz.

Thanks again.
 
hkit711 said:
Thank you Nigel. I didn't thought about zero-crossing. I think that will work. By the way, the frequency is always 50 Hz.

If you're trying to measure mains power consumption?, check EPE, they have done two such projects - one a LONG time ago (which I built, using a 16C84). And more recently one using a 16F877 based one with two channels, and using a specific power measuring IC.
 
Dear Nigel. I'm not measuring the main power consumption. I'm building a "current overload protection" for an AC motor. I'm using a current transformer. I put a resistor in parallel with the secondary to have a voltage. I'm measuring that voltage and comparing with a set value. If this voltage (the current of the motor) goes higher then the set value then I will have a signal out to stop the motor. I will put the complete project on-line (because all of you guys are helping me to build it, it belongs to you too...) when I finish it to the end.
 

I would suggest you should just rectify and filter the CT's secondary AC output. Then scale it with a pot such that your you can read it as a DC voltage in your PIC's A/D input. You may have to calibrate the whole thing using a known load through the CT's primary, but after that it will be a whole lot simpler.

Lefty
 
That's right Leftyretro, but I'm trying to have a very compact circuit because I have more than 1 motor to control and it will be cheaper. It will be more complicated programing the PIC but cheaper for sure.
 
hkit711 said:
That's right Leftyretro, but I'm trying to have a very compact circuit because I have more than 1 motor to control and it will be cheaper. It will be more complicated programing the PIC but cheaper for sure.

Well then your main challenge then is going to be to making sure the peak to peak voltage swing of the CT's secondary stays within the safe range of the PIC's A/D input, basically 0-5VDC.

You normally have to tie one side of the CT's secondary to the PIC's ground refereance, so without rectification I don't see how you are going to deal with negitive voltages that the PIC will see on the negitive swings. Somehow you have to scale down and reference the AC voltage to 2.5VDC so that the total peak to peak AC swing stays in the PIC's 0-5VDC safe measurement range.

I still think rectification and filtering is the best way and because this is for measurement not power they can be very small components.

Lefty
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…