SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By wireless102
#15266
hello all,

i am working on a project that uses an avr and 74hct573 to activate a couple of relays. the motor that is activated on these relays will have a spike in current and level out at about 2 amps. what would be the best way to stop the motor if current goes over 2.5 - 3 amps. i have wrote all the code with bascom avr and everything works great just need a way to stop this thing if the current goes to high.

it is basically a protection if something is in the way of the part that is moving if the optical sensors dont see it

thanks
By wiml
#15268
you could do this in hardware with a "slow-blow" fuse or a self-resetting "polyfuse" (I think polyfuse is a trademark, there are many makers). In software, you could put a (small) series resistance on the return line, and measure the voltage drop across it with an ADC input. If it's above a threshold for more than a certain number of consecutive samples, shut off the motor.

If this is a safety issue (device might catch fire, or crush somebody, etc.) I'd go with the fuse...
By wireless102
#15269
if it hits something i want it to stop and backup so the fuse probably wouldnt work but the voltage drop method

thanks
By wireless102
#15270
hi wiml,

do you have a link to some sample code for doing this?

i was using 8515's for the project but will move to the atmega for the adc inputs
By wiml
#15274
does the 8515 have a comparator input? you could use that instead of an ADC since all you really want to know is whether the voltage is higher than a certain value. you'd need some way to generate a reference voltage for the comparator's other input ... maybe something as simple as a trimpot would work?

I don't have any sample code, I'm really just thinking out loud here :)