Hello,
I'm working on a school project for my graduation where I have some troubles with.
I have to present my finished project next wednesday and the only thing that has to be done is the programming of an Arduino nano. The problem is that the teacher for Arduino at school this year stopped before the lessons started. So I have only a few days left to program the device with no knowledge at all how to do it. The program should go like this:
When the device is turned on a green light with "ready" on it should be on.
If a button gets pushed, the light goes out, and a motor begins to spin in a one direction, at the same time a red light goes on with "busy"
The motor drives a platform.
If the platform hits a stop, the current trough the motor gets higher, the current sensor detects it and stops the motor from spinning. The "busy" light goes off and the "ready" light comes on.
When the button is pressed again, the proces repeats but the motor turns in the other direction.
This program should move a lift with a dirt sample on it against a sensor to measure radioactive gamma rays. This way they can measure the sample without holding it against the sensor themselves.
-The motor is a 12v brushed dc motor with a gearbox that outputs 600rpm
-To control the motor I have a L298N motor controller
-To measure the current I have a ACS712 current sensor
I hope someone can give me a good start or is nice enough to write the code that is needed to get this thing working.
Thank You!
when I connect the current sensor to the serial monitor
What current sensor. Please supply a link to its data sheet.
I get a unloaded value of max. 15mA and loaded min. 20mA
Are you absolutely sure? That sounds ridiculously small for a motor that is expected to lift anything? I think you maybe are not measuring it correctly.
I measured the current with my multimeter and the current sensor and they both gave the same values.
How did you measure this with that current sensor? The sensor has a sensitivity of 185mV per amp. So to get a reading of 10mA you would have to have an output of 1.85mV. The ADC on the Arduino is 10 bits so with a 5V reference that is 4.8 mA per step. This is bigger than the signal you are trying to measure.
Samisdeman:
And the low current of the motor is because there is a gearbox on it.
You really believe the motor's current will go up the moment you remove the gearbox? Because I don't. It is more likely to go down (less load when running freely).
15-20 mA is very little for a motor, and it will not be able to lift much.
Do you have any code for this project? Schematics?
I'm sorry, the motor currect is unloaded 150mA and loaded 200mA the extra zero wasn't in the serial monitor but I saw it on my multimeter.
Also the values of the current may be changed in the testing fase, so its for now important that the code works but the current values are for sure going to change.
Generally, you won't get anyone to write code from scratch for you here unless you want to pay. Further, forum participants are very reluctant indeed to do your schoolwork for you. What they will do enthusiastically however is to help you get your code working once you have some.
The good news is that your requirements are pretty simple. I'd suggest you get going on using the code examples in the IDE to figure out the basics and start on the coding ASAP.
Those currents sound much more reasonable indeed for a small DC motor.
This doesn't sound like a very complex project to me. Wait for button press; start the motor upon press; wait for current to surge (I'd use a limit switch for this - less stress on the motor); switch off the motor; wait for button press; lower platform again. You don't even have to worry about debouncing the button.