PDA

View Full Version : Accuracy of PWMPAL?



aeklo
01-08-2006, 12:21 PM
I have built a zero crossing detection circuit (for 220V AC) which gives a TTL-pulse on every crossing. I want to use this to trigger the hardware motor control in the PWMPAL, to control a motor. But it seems the PWMPAL is inacurate with regards to the hardware trigger.

Does anybody know the accuracy of the PWMPAL hardware triggers? My plan in using this was to free up the BS2 in waiting in code for every pulse.
The PWMPAL is set up with a 100Hz (50Hz AC gives 100 zero crossings) PWM-signal which I vary in duty cycle.
My motor does run, but very uneven - making it obvious that it is not triggered at the same place in the cycle every time.

Any other suggestions for sync'ing the PWMPAL with the mains would also be appreciated http://forums.parallax.com/images/smilies/smile.gif

/Anders

PJ Allen
01-08-2006, 10:42 PM
OK, this has been up here for a while, so I'm going to have a go.


aeklo said...
My motor does run, but very uneven - making it obvious that it is not triggered at the same place in the cycle every time.

·
Sounds like your transistor is dying (?).· I think that there should be a diode across the motor, as shown in the attached drawing.· It doesn't matter if you're using a FET or a bipolar-junction transistor.· Try replacing your transistor and add the diode (I spec'd a 4002, but I think most any 1N4000-series diode should suffice.)
If possible, please U/L your schematic, as well, to aid further discussion.

[ see also: http://forums.parallax.com/attachment.php?attachmentid=37701 ]



Post Edited (PJ Allen) : 1/9/2006 2:49:23 PM GMT

aeklo
01-10-2006, 03:21 AM
As you can se from my attached schematic, I do use diodes.
My believe is that either my zero-crossing circuit, or the PWMPAL itself is inaccurate.
The zero-crossing detection should be simple enough, but since I am using another rectifier bridge for detection (to avoid the capacitor on the main bridge smoothening the crossing point) might that introduce a time difference?

Or, as my subject suggests, might it be the PWMPAL not being accurate enough?
And, does the PWMPAL restart the cycle at each trigger, or does it only continue on the cycle when triggered?

Any other solution for my PWM-control would be greatly appreciated - the main objective is freeing the BS2 from the task, asit will be needed for monitoring incoming MIDI-signals...

Thanks in advance!

/Anders

PJ Allen
01-10-2006, 04:32 AM
Your "zero-crossing" detection:
U2's output/collector·does not go HI·when the output of VBR1 is 0V, but when·VBR1 < U2's VF·-- and that·is a longer time than BR1's output is 0V (probably more time than that, because IIRED·in U2 will likely be insufficient to keep·the output/collector LO before VBR1 < VF· (esp. with IIRED(PK) = 1 mA.)· If you have an oscilloscope, I'm sure this period (U2 output = HI) could be measured easily.
So, I wonder whether your PWMPAL input is positive-edge triggering or if there is that whole period of " < VF " time as opposed to a "true-zero" time (which would be much shorter) where your error could be from.· As it stands, U2 out goes HI sometime long before "true-zero" and goes back LO long afterward.

[ I'm not a PWMPAL expert. ]

Post Edited (PJ Allen) : 1/9/2006 10:51:46 PM GMT

aeklo
01-16-2006, 07:16 AM
Thanks for your thorough explanation, or at least for thinking loud http://forums.parallax.com/images/smilies/smile.gif
As I am kind of stuck on this, I figured this was a good opportunity to buy an oscilloscope.
I am excited to see what the measurements will reveal http://forums.parallax.com/images/smilies/smile.gif