Im busy with a arduino project where i want to stop a motor with a to high off amps.
I bought a ACS721 current sensor where i can read the amps with. i looked all over they internet to find a movie or instruction how i can put this in a arduino sketch but found nothing. My plan was to turn the motor on till the amps rise and then cut the motor off bye him self. Can someone help me with my project?
Try to read the sensor and display the current in the serial monitor before you combine it with your motor code.
Enter "ACS712" in the search box on top of this page.
Leo..
i have read the sensor in the serial monitor till there everything went ok.
But the next step to stop the motor i don't get that done if i slow the motor i see the amps rise but can not find a code who also shut the motor off
i have read the sensor in the serial monitor till there everything went ok.
But the next step to stop the motor i don't get that done if i slow the motor i see the amps rise but can not find a code who also shut the motor off
What was the A/D value.
Those sensors come in one-way and bi-current.
Was the value ~100, or ~512.
A simple "if" statement could stop the motor.
if (analogRead(A0) > 650) { motorPin = LOW
digitalWrite(motorpin, LOW);
}
Show us the motor code you already have (inside code tags).
Leo..
I have my ACS712 connect on:
the VCC on 5v from my board
the OUT on 0 from my arduino
the GND on gnd from my board
Then 5v from my board to my ACS712 to my motor and then connect with ground from my board.
Do you have a motor. How big is is (voltage, stall current).
How do you supply the Arduino and the motor (different supplies?)
How do you control it (you wanted the Arduino to be able to turn it off).
What is the current rating of the ACS712.
Previous qestion: what is the A/D value of the sensor without motor current.
Some untested example code.
Leo..
int sensorValue; // holds A/D readings
int offset = 511; // sensor zero current offset | adjust value if needed
int motorPin = 10; // the pin the motor driver is connected to
void setup() {
pinMode(motorPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(motorPin, HIGH); // start the motor
delay(500); // wait untill the motor has started up
sensorValue = analogRead(A0); // read the sensor
Serial.println(sensorValue - offset); // print the value
if (sensorValue > 123) { // if the motor current rises above this A/D value...
digitalWrite (motorPin, LOW); // switch motor off
delay(5000); // for 5 seconds
}
}
Wawa
Its just the normal DC motor who you get with your arduino starterskit.
The A/D value is around 512
i connect the motor at the arduino on the most simple way 5V from arduino to my ACS712 to my motor to -
how i connect the ACS712 with my arduino:
the VCC 5v from my board
the OUT on 0 from my arduino
the GND on gnd from my board
Then 5v go out my board to my first pin from my ACS712 then a cable goes from my second pin to my motor and then connect with ground from my board.
But do you know how i can get this in my code ? Arduino Current Feedback Motor Torque Control - YouTube
I get everything with this code my current is almost 0:
void setup() {
// put your setup code here, to run once:
Serial. begin (9600);
}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue = analogRead (A0) ;
Serial.println( 511 - sensorValue);
delay(250);
and if i hold the motor i see the current rise but i don't now or can find a code where i let the motor stop. on like current 5