0

INA219 DC Current Sensor
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

INA219 DC Current Sensor

by MidnightSparks on Sun Jun 13, 2021 9:09 am

With a INA219 module, how would the code look to read the DC current from a DC servo motor? I keep writing my code based off the "getCurrent" example sketch in the INA219 library, but I can't figure out how to get the sensor and the servo to work at the same time.
2.jpg
2.jpg (33.61 KiB) Viewed 123 times

3.jpg
3.jpg (99.49 KiB) Viewed 123 times

MidnightSparks
 
Posts: 4
Joined: Sun Jun 13, 2021 8:53 am

Re: INA219 DC Current Sensor

by adafruit_support_bill on Sun Jun 13, 2021 9:24 am

Servo current draw varies widely depending on activity. Assuming that you want to see the current draw when the servo is moving, send a command to the servo, then immediately start reading the sensor.

adafruit_support_bill
 
Posts: 81589
Joined: Sat Feb 07, 2009 10:11 am

Re: INA219 DC Current Sensor

by MidnightSparks on Sun Jun 13, 2021 9:47 am

That worked! OMG THANK YOU SO MUCH!!! I was stuck on this for over a day now (I feel like an idiot)
(for anyone in the future, I opened the example "getCurrent" code found in the INA219 library and did as "adafruit_support_bill" suggested - In the beginning of the loop(), I told the servo to begin rotating and then checked the serial monitor and sure enough, it works!)

MidnightSparks
 
Posts: 4
Joined: Sun Jun 13, 2021 8:53 am

Please be positive and constructive with your questions and comments.