Not 40amp, 30amp
Motor_Protection.ino (735 Bytes)
I'm using a 12v Jump start battery pack 1200Ah Peak amps 1200.
Not too good on the drawing but if you looked on the opening screen on You Tube there is one there.
Maybe it will come up here. It is for me.
From the drawing, between the battery and Arduino relay I have a DPDT relay which I operate by a push button. This changes polarity to the actuator, extending it. The NC of the DPDT is wired directly to the motor so that once the button is released the actuator reverses. So I push the button, DPDT powers through the current sensor. Uno then switches Arduino relay when overcurrent stopping it and when the button is released the motor returns.
If you watch the You Tube video I am not using the delay at the stop. I can change that or leave it as I only require it to stop for 2 or 3 seconds before it is to return.
Much appreciate all your help and time. I wish there was a way I could repay you.
Is there something to protect you???
1200A is more than sufficient to evaporate your setup in a split second and set your house/shed on fire.
Talking to yourself?
Cleaned up the code, moved relay to digital pin2, etc.
Don't connect relay power to the 3.3volt pin, as the guy in the video did.
There is a proper 5volt pin close to it (called IOREF on your Uno).
Untested.
Leo..
const byte relayPin = 2; // digital pin
const byte analogPin = A0; // current sensor
int offset = 512; // zero current value
int sensorValue, oldValue; // raw A/D value
// user input
int cutOffValue = 15; // value on which motor switch off for 5 seconds (0-512)
int ignoreTime = 200; // in milliseconds
void setup() {
Serial.begin(9600); // setup serial
pinMode(relayPin, OUTPUT);
delay(ignoreTime); // first peak current
}
void loop() {
sensorValue = abs(analogRead(analogPin) - offset); // now independent of motor direction
if (sensorValue != oldValue) { // only print if different
Serial.print("ADC Value: ");
Serial.println(sensorValue);
oldValue = sensorValue;
}
if (sensorValue > cutOffValue) {
digitalWrite(relayPin, LOW);
Serial.println("Motor stop");
delay(5000); // stop time
digitalWrite(relayPin, HIGH);
delay(ignoreTime);
}
}
Always?
With and without current?
I see in the code it has an offset of 512...
So what does it read when there is current?
It is a wind screen wiper motor (probably salvaged from a car). Not a linear actuator... if you connect an arm to the shaft it us an actuator, but still not linear...
You cannot stall that by hand. It has a gear box, which makes it very strong.
You may als damage the gear box if you stall it using tools like pliers.
Simply measure the resistance of the motor.
I am afraid the value may be too low to get a really accurate reading...
Hi , Been away. Firstly yes I have it protected with a 5amp fuse.
A 5 amp fuse seems too little. If it is if slow type and your motor is running freely, it might work.
And it will save your house/shed/eyes.
The offset? I think that is the value to stop the motor?? I have tries a lot of values. I've even taken it right down to 1 but that has no effect.
You asked "Always?" Do you mean the return of the actuator. Yes, but it switches off with the actuator built in microswitch.
The current reading. Is that the readings when I click on the Serial Monitor? That fluctuates around 512.
I did have a current sensor module I purchased on AliExpress
That stopped the actuator well but it the module had to be switched off to reset it each time the sensor activated. That does not meet my needs. I tried all was around it but to no avail.
You think the relay module could stand 5V?
So I change the code to what you have laid out above or is that a new code? If new how do I download it. I think I said I was new to this!!
The max. load the actuator is to 400Nm. That equates to 40KG. (88Lb) and I estimate I want to stop it around 25Kg (55Lb). I had the current sensor from Ali set so I could quite easily stop it with my hand. If I could find one that would not need to be reset, would be the easiest for me. Hence I am looking at Arduino. When I saw the You Tube video I thought it would be easy. The coding is scaring me though!!
Regarding the fuse I want to keep it close at this stage. As you said protect my city!! I was using 4amp but got tired of replacing it so beefed it up an amp. When (if) I get it running I will use a 10 amp. The Set up is to run off a 12v 120AH lead acid battery. Recharged from a 150w solar panel.
It's getting late here (New Zealand) so will catch up here tomorrow.
Good Night.