Shunt current sensor and pwm
I’m currently experimenting with current sensing in power switching applications (motor driver, resistive loads such as heating pads etc.), and I’m frankly not sure what I’m doing at this point :)
I’ve built this break-out board (see schematic) which is basically just a set of dual gate drivers and four small N-channel mosfets for low-siding driving of anything. This is all good and fine, but now I’ve added these TI INA197 shunt current sensors too. The idea was, that you could use this feedback for some adaptive pwm control of the gate drivers.
The problem however, is that when driving the mosfets using pwm the output from current sensors is also “pulsed” (for lack of a better and more correct word) and this does not fly with the ordinary arduino analogRead. The readings can be anywhere on the rise/fall/0/Vout part of the signal. But is it possible at all to just get the Vout part without hardware modifications (like input filter to the INA197)?
I believe I have seen someone somewhere setting up the atmega adc to be in phase with the incoming signal and only reading the “high” part. But I have no clue on how to that. Any help or thoughts on the design and problem is greatly appreciated. Thanks.
RE: Shunt current sensor and pwm - Added by martynj about 5 years ago
ltj, the objective is to get some measure of the effective “average” of the current passing?
RE: Shunt current sensor and pwm - Added by ltj about 5 years ago
@martyn, Yes. I wanted to do something similiar to this https://s3.amazonaws.com/heatit/files/heatit\_1\_1\_sch.pdf (schematic of http://heatit.cc - a kickstarter arduino clone). But I did not want to connect the adc pin directly on the high side of the shunt. From heatit’s github (https://github.com/Heatit/heatit), it seems like they do some pwm and adc synchronization using direct port manipulations and register settings.
I think my problem is that I do not fully understand the concept of current sensing in pwm settings. According to datasheets and app notes It seems like its pretty common in motor or solenoid control applications. So maybe it makes more sense to explain what I want to achieve: I wanted to make a breakout board that could drive heating elements used for activating thermochromatic dyes in textiles. It is meant for design students with no or very little technical background, so I liked to idea that they could get some sort of feedback on the current - they should still measure the resistance of the heating elements before hooking them up to the board and do the calculations to get everything working, but they would be able to see Ohm’s law in effect on average voltage/current when varying the pwm duty cycle. I might be completely off track with this solution though.