I would like to know if the project can work. I have some doubts because it will require arduino to do few things almost at the same time.
I am building manipulator with 5 degree of freedom. Each motor will have potentiometer attached to output shaft to check position. I hope building it that way will allow for greater control than using circuit from servo (shaking motor back and forth trying to reach position and poor torque between close points because of PWM)
I would need arduino to receive position input through serial port like [a=10, b=75...] etc.
then decide which direction each motor should go and start it all at the same time and based on potentiometer input turn motors off after reaching desired position.
Is it possible to implement piece of code which checks if position changes when motor is running and if not to shut it down as a safety feature in case of stalling. (I have idea how to write it with delay but it will hang the whole program for that time ...)
Can simple voltage divider be used to measure how much battery has left?
I don't intend to use stepper. just dc motor rigged with potentiometer to make it work like servo.
Then you have a lot of work infront of you. Do you have that sort of skill in hardware and software?
Using data recieved over the serial port to control something is commonplace. You can certainly write a program to control servos that way.
If the output from the servo's potentiometer can be read by the Arduino it will be able to check the position.
An Arduino can be used to measure voltage. A voltage divider is needed to protect the Arduino if the voltage to be measured exceeds 5v. If your program is measuring the voltage on a battery it can certainly raise an alarm or shut the system down if the voltage is too low. However a battery's voltage can fluctuate significantly depending on the short-term current draw so the measured voltage may not be a good indicator of battery charge.
I suggest you develop at least part of your system using standard servos and the Arduino Servo library so as to gain experience without the complexity of building your own motor systems.
More importantly - break your learning into separate pieces - receiving data; moving a servo, measuring a voltage - and only bring them together when you can do each one separately.
Serial Input Basics
Planning and Implementing a Program
If your program is measuring the voltage on a battery it can certainly raise an alarm or shut the system down if the voltage is too low.
The trick is to have the power to the Arduino an independent voltage of that from your batteries. This means either having two power sources or regulating the voltage to the Arduino so that it is independent of the voltage of the battery.
The trick is to have the power to the Arduino an independent voltage of that from your batteries.
I had assumed that was the case.
However it is also possible for an Arduino to measure the voltage of the battery that is powering it. Let's wait to hear from the OP before complicating matters with that.
A fair assumption but the question was
- Can simple voltage divider be used to measure how much battery has left?