You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.9 KiB

  1. Given out scaling and that n=100 on the secondary for the A6302 probe,
  2. and a 16-bit DAC value, each LSB cancels out 300 µA of current on
  3. the primary, for a maximum range of
  4. DAC 0000h ≈ -9.83 A (-300 µA * 2^15)
  5. DAC 8000h ≈ 0.0 A
  6. DAC ffffh ≈ 9.83 A (300 µA * 2^15)
  7. Let's use 14 bits from the DAC. The range covered by a single bit is
  8. (9.83 A * 2) / 2^14 = 1.2mA
  9. For 5 more bits from the probe, we need to measure 1.2 mA / 2^5 = 37.5 μA.
  10. The probe scaling is 1mA = 10mV.
  11. So 37.5 μA is 375 μV.
  12. The PIC can measure 12 bits over 2.5V which is 0.61mV, so we need
  13. to scale the probe output. Scale by (4.32) so that
  14. 1mA at probe = 43.2mV at PIC
  15. 37.5μA at probe = 1.62mV at PIC
  16. (PIC input) = clamp(0, 1.25V - (probe current * 10 * 4.32), 2.5V)
  17. Clamp by putting a 1K in series with diodes to VSS/VDD.
  18. ----------
  19. DAC range is ± 10 A.
  20. Probe range should be about 2^-14 as big, so ±610 μA
  21. which is 0.000610*10*4.32 = 26.35 mV.
  22. PIC measurements:
  23. (1.25V + 26.35mV) / (2.50 / 2^12) = 2091
  24. (1.25V - 26.35mV) / (2.50 / 2^12) = 2004
  25. --
  26. 1 bit change at full 16-bit DAC resolution is 0.3mA.
  27. At PIC, the voltage will change by (0.3mA * 10mV/mA * 4.32) = 12.96 mV
  28. This means changing 1 bit at the DAC should cause the 12-bit ADC count to change by
  29. 12.96 mV / (2500mV / 2^12) = 21.234
  30. To reset the PIC input to 2048, we therefore need to step the DAC by
  31. ((2048 - count) / 21.234)
  32. --
  33. If it starts off centered, the ADC value at the PIC will max out when
  34. it gets a step of 1250mV. This corresponds to an input step of
  35. (1250mV / (10mV/mA * 4.32)) = 28.935 mA.
  36. Sampling rate is 8000 Hz, so this limits slew rate to 28.935 mA * 8000 Hz = 231.48 A/s
  37. A 1A sinusoid with is sin(t*2π*60), so the max slope is max(2π*60*cos(t*2π*60)) = 376.99A/s
  38. TODO:
  39. - Kick sampling rate up by 4, to 32 KHz on ADC and DAC commands.
  40. - That should up our slew rate to 900 A/s.
  41. - Send data to PC as fast as possible; 8KHz or 16KHz or all 32KHz (?)
  42. - Smarter recentering algorithm (!)