{"id":142,"date":"2010-02-09T19:04:15","date_gmt":"2010-02-10T00:04:15","guid":{"rendered":"http:\/\/ammonsengineering.com\/blog\/?p=142"},"modified":"2010-02-09T19:26:43","modified_gmt":"2010-02-10T00:26:43","slug":"even-more-current-analysis","status":"publish","type":"post","link":"https:\/\/ammonsengineering.com\/blog\/2010\/02\/even-more-current-analysis\/","title":{"rendered":"Even more current analysis"},"content":{"rendered":"<p>I thought my plans for scaling the current and calculating the overall current would work well.\u00a0 The exact factor of two was appealing &#8211; until I ran the motor in the other direction.\u00a0 In that direction, the factor looked closer to 1.8, which totally confused me.\u00a0 I was frustrated and decided to take a break for while.\u00a0 In the meanwhile, I continued discussing my issues measuring current on the NI discussion forum.\u00a0 Yesterday Eric from NI answered all my questions very clearly (see\u00a0<a title=\"NI discussion forum topic\" href=\"http:\/\/sine.ni.com\/niforum\/niforum?requireLogin=False&amp;forumDU=http:\/\/forums.ni.com\/ni\/board\/message?board.id=280&amp;message.id=7789\" target=\"_blank\">How is NI-9505 current sense measured?<\/a>\u00a0for details).\u00a0 He explained that there are two resistors used to measure the current.\u00a0 During the On cycle, the\u00a0resistor that the current passes through depends on the direction of rotation.\u00a0 During the Off cycle the current goes through both resistors, which makes the measured current\u00a0twice the actual current and totally explains why the Off cycle was measuring about twice the On cycle.\u00a0 The different factor for each\u00a0direction of rotation is because the two\u00a0resistors have slightly different values.\u00a0 Once I realized this, I compared the waveforms and found out that for CW my 9505 module has an Off\/On\u00a0ratio of about 2.05, and for CCW the ratio is about 1.95.\u00a0 Once these correction factors are applied, the On and Off cycles are almost exactly equal for both directions.\u00a0 Therefore, my current measurement scheme will be:<\/p>\n<ul>\n<li>Measure at the center of the Off cycle if the PWM &lt; 30% (to avoid spike effects in small pulse widths) and leave the value as is.<\/li>\n<li>Measure at the center of the On cycle if the PWM &gt; 30%, and multiply it by the appropriate scaling factor (CW = 2.05, CCW = 1.95) to get it to match the Off cycle.<\/li>\n<\/ul>\n<p>This will give me an accurate current measurement at any PWM and either direction.\u00a0 The scaling factor for the current measurement will be 3.1 mA\/count since I will have twice as many counts during the On cycle.<\/p>\n<p>I believe this resolves my issues measuring current, so I can move on to the next step &#8211; reading the encoders to determine position, velocity, and acceleration.\u00a0 I can also start programming a PID loop to control the current.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I thought my plans for scaling the current and calculating the overall current would work well.\u00a0 The exact factor of two was appealing &#8211; until I ran the motor in the other direction.\u00a0 In that direction, the factor looked closer to 1.8, which totally confused me.\u00a0 I was frustrated and decided to take a break [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-142","post","type-post","status-publish","format-standard","hentry","category-software"],"_links":{"self":[{"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/posts\/142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/comments?post=142"}],"version-history":[{"count":4,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/posts\/142\/revisions"}],"predecessor-version":[{"id":144,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/posts\/142\/revisions\/144"}],"wp:attachment":[{"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/media?parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/categories?post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ammonsengineering.com\/blog\/wp-json\/wp\/v2\/tags?post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}