I'm an arduino newbie and I'm going to be taking over a project from someone and expand it.
This is a project for post-quarantine but I'm starting to think of ideas so that I can order the necessary parts.
What I have so far:
I have an object that I wish to move linearly on a threaded actuator rod and I use a stepper motor to control the rotation of the rod. I implement the control system using an Arduino Mega to control the stepper motor and a W511 ethernet shield to host a web server where I send commands to the Arduino.
What I would like to implement:
I want to keep track of the real time position of the object that is independent of the stepper motor. Meaning, I don't want to infer the position of the object based on the # of revolutions of the motor but instead have something like a proximity sensor. I would also like to communicate these values to the web page.
To do this, I'm planning to use a second Mega with a proximity sensor + ethernet shield and have the 2 Megas communicate with each other. For example, if the second position-sensing Arduino reads out that the object is stopped, it will be displayed on the web page and will be relayed to the first arduino to stop the motor and reset.
Questions:
- Does this sound feasible? Any pitfalls that are not obvious to a newbie like me?
- Any thoughts on what kinda sensor I can use for real-time tracking?
Apologies for my naivete. I'm learning as I go.
I'm wondering why you think you need two Megas?
Can't you just run the stepper and the position sensor from the same one?
You might not even need a Mega at all, but a "lesser" Arduino.
Sounds ambitious, but possible. Start with smaller projects and learn your way up to this one. Also, I think you can do it all with a single Mega or a Mega and RPi.
jubukraa:
I'm wondering why you think you need two Megas?
Can't you just run the stepper and the position sensor from the same one?
You might not even need a Mega at all, but a "lesser" Arduino.
Well..
The way the logic works right now is I have limit switches at the START and END position of the rod and I check whether the object has moved from START to END within a pre-defined time limit of a few seconds (which it should have if it was successful). And I run the motor based on that. I also introduce a delay of a few microseconds between taking steps.
Because of these delays, I was thinking a true 'real-time' position readout would not be possible using just one arduino because the sensor readout isn't simultaneously carried out. But maybe I should be rethinking - the delays are probably negligible and I can just use one arduino?
Power_Broker:
Sounds ambitious, but possible. Start with smaller projects and learn your way up to this one. Also, I think you can do it all with a single Mega or a Mega and RPi.
Is there a reason why you suggest a Mega and RPi instead of 2 Megas?
I want to keep track of the real time position of the object that is independent of the stepper motor. Meaning, I don't want to infer the position of the object based on the # of revolutions of the motor but instead have something like a proximity sensor.
Why? and what accuracy do you expect from this?
zwieblum:
Why? and what accuracy do you expect from this?
Why I want an independent readout - in case something is jammed in the threaded actuator rod and my object (which is a Faraday Cup used to calibrate radioactive ion beams) doesn't move. There is a failsafe implemented in the form of automatic shut-off if end-to-end movement takes more than a calculated amount of time but it will be good to have an independent readout. Also, if an automatic shut-off happens or say, we have a power cut, it will be important to know where the FC is stopped. I could keep track of the # of rotations of the stepper relative to a "home" position but again, will be better overall to have a separate sensor.
Accuracy -
Well right now, assuming a rod of 1m, end-to-end movement takes about a minute and a half roughly. So a time period of 5s translates to 5cm which is probably enough of an accuracy. Keeping track of every cm of movement is probably overkill.
Ok, that are reasonable numbers. The easy way: use a potentiometer, limit travel to a save 180°. Calculate how many revolutions you have, caculate the gear ratio to get 0° ... 180°, be happy.
Example: 1mm/revolution --> 1000 revolutions --> gear rato 1:2000
zwieblum:
Ok, that are reasonable numbers. The easy way: use a potentiometer, limit travel to a save 180°. Calculate how many revolutions you have, caculate the gear ratio to get 0° ... 180°, be happy.
Example: 1mm/revolution --> 1000 revolutions --> gear rato 1:2000
Thank you for your response. I will explore this option.
However, if I'm understanding it right, this is not truly independent (which is a project requirement) of the stepper motor, is it? Instead of the potentiometer, can I have something like an IR sensor on the same Arduino Mega board and use that for real time tracking. I guess my main question is, is it possible to implement both the stepper control and (IR?) sensor readout on the same board?
IR won't work. But you might get a DRO like one of these:https://www.aliexpress.com/item/32917522652.html
Quality is poor for the advertised usage, but for your requirements it will most likely work.
There are also glasruler, they are a little bit more expensive (> 200.-), but work reliably.