Mock-up Motor Test
by Zach Oyog (Electronics & Control)
Introduction
The purpose of this post is to determine the average current draw when all 6 motors are in use. Two tests were conducted, one with the motors connected out of the sojourner chassis and the other test in the sojourner chassis with a mass of at least 450 grams [3] to simulate the load on each motor at 5V.
Tests
The tests were conducted using an Arduino Leonardo and electronic breadboard, the 6 DC motors were placed in parallel with an INA219 I2C High-Side Current sensor in series to measure the current. The INA219 measures the current across a high precision .1 Ohm shunt resistor. [1] Another method of measuring current without the INA219 is to replace the current sensor with a low ohm shunt resistor. Data was recorded form the serial port monitor and logged in MATLAB which was then saved into an array. The array was used to find the average current as well as the minimum and maximum current. This method was completed twice, one with no load and another with a total mass load of 475-grams.
/* INA219 break measure and serial port record to matlab *Zach Oyog *referenced from INA219 master library: https://github.com/adafruit/Adafruit_INA219 */ #include#include Adafruit_INA219 ina219; void setup(void) { Serial.begin(115200); while (!Serial) { // will pause Zero, Leonardo, etc until serial console opens delay(1); } uint32_t currentFrequency; // Initialize the INA219. // you can call a setCalibration function to change this range (see comments). ina219.begin(); ina219.setCalibration_16V_400mA(); } void loop() { float current = 0 ; current = ina219.getCurrent_mA(); Serial.print(current); Serial.println(); delay(300); }
% Sojourner Fall2017 % Zach Oyog % using serial port data from arduino average the value of current form the % ina219 high current sensor % Note: MATLAB will display " Adruino *Model* detected" in the command window % close all clear clc delete(instrfindall); % close exisiting ports s = serial('COM5' ); s.BaudRate=115200 ; % match with Arduino Baud Rate fopen(s) ; % open the serial port to record data s.ReadAsyncMode = 'continuous' ; readasync(s) ; sample = ; for i=1:sample serialdata = fscanf(s) ; flushinput(s) ; t = strsplit(serialdata, '\t') ; data(i,1) = str2double(t(1)) ; end delete(instrfindall); % close the serial port %% % Average of the current. avg_current = sum(data) / length(data) % mean() could save time... max_current = max(data) min_current = min(data) avgc = ones(length(data))*avg_current ; maxc = ones(length(data))*max_current ; minc = ones(length(data))*min_current ; sp = smooth(data, 0.3, 'loess') ; figure(1) hold on plot( data, '.b', 'linewidth', 1.5); grid on ; plot(sp, '.m', 'linewidth', 3 ) ; title('Arduino Serial Port Data ') plot(maxc,'.k' ,'linewidth', 3) ; plot(minc,'.k', 'linewidth', 3) ; plot(avgc,'.r', 'linewidth', 3) ; title(' Current Measurements') legend("Raw Data", "Smooth Data", "Max Current", "Min Current"," Avg Current");
Results
The current measurement data sent from the Arduino serial monitor to MATLAB is saved as a string then converted into an integer and stored in an array. With the array, simple calculations were completed to find the maximum, minimum, and average current. There were 500 data points saved with unique current values for each point. The number 500 was to cut down on time to read from the serial port. The difference between no-load and load current were nominal with averages of load current = 187.593 mA and no-load current = 182.815 mA.
- Measurement
- Max Current
- Average Current
- Minimum Current
- Load Current Draw (MA)
- 208.6
- 187.593
- 161.00
- No Load Current Draw (mA)
- 202.1
- 182.815
- 161.2
Conclusion
The MATLAB serial monitor was able to record the data from Arduino IDE. Both the no-load current and 475-gram load current reached a maximum draw of 182.815 mA and 187.539 mA which is much less than the allocated current of 360mA. [2]
[1]https://www.adafruit.com/product/904
[2]http://arxterra.com/sojourner-f17-power-budget/
[3] http://arxterra.com/sojourner-preliminary-documentation-fall-2017/#toggle-id-20