ACS711 Current Sensor

Hi, I’m trying to connect a ACS711 current sensor carrier (+25A to -25A) to my (6V) motor. I’m using a Baby O, motor driver 18v15 and this current sensor to stop the motor when the motor draws more then 5.5 A.
I’ve been trying this code, but it doesn’t seem to give good measurements.

CS = (((analog_read_average_millivolts(2, 64) - 2500) * 1000) / 55);
			if (CS > 1100)		// Current Sensor measures more then ... A over motor
				set_digital_output (IO_B2, HIGH);   // LED ON

I’m checking the output of the current sensor with a LED and the if-statement in the above code, to see when the current sensor rises above a certain value.
I know my motor draws about 400 mA when it’s free running. But my coding gives a value of more then 1 A. with the current sensor. If I raise the amps in the if-statement and brake the motor it doesn’t seem to measure anything.
I’ve connected one side of the motor to IP- and one side to OUTB of the 18v15. IP+ is connected to OUTA of the 18v15. Vcc and GND of the current sensor are connected and OUT is connected to PC2 of the Baby O.

What am I doing wrong?

Your code (i.e. the offset of 2500) suggests that you are using the sensor with a 5V power supply. Keep in mind that the 55mV/Amp sensitivity is specified for a 3.3 V power supply and according to the data sheet, the sensitivity is proportional to the power supply voltage.

The data sheet does not give specs for 5 V operation, but I would guess the sensitivity to be about 83 mV/Amp. In any case, I would calibrate the sensor by driving some known currents through it, and measuring the output.