. When the IR breakbeam detects movement I want the stepper motor to take a certain amount of revolutions and reverse the same amount of revolutions. Also was wondering for the Elegoo stepper motor do I have to connect it to the breadboard or can I connect it to an external 5v power supply? If I can fit both of these parts to one uno what pins do I have to connect to where. Much appreciated
Hello blh64 thanks for the help, can you explain what pins should the IR breakbeam go into and what pins should the stepper motor and driver go into thanks.
Fix the stepper where you have it , any digital input pin ( but avoid 0,1 ) can be used for the break beam sensor , providing your sketch doesn’t rely on an interrupt ( which only certain pins can readily be used)
Thanks hammy , may I ask what's an interrupt all I want is the IR breakbeam to detect motion and then make the stepper motor to go a certain amount of revolutions and then reverse the same amount of revolutions. Can you guess whether or not I will use an interrupt?
, when the IR breakbeam detects movement it then makes the stepper motor take a certain amounts of revolutions and then reverse the same amount of revolutions
. Here's the stepper motor link https://www.amazon.com/gp/aw/d/B01CP18J4A/ref=ox_sc_act_image_1?smid=A2WWHQ25ENKVJ1&psc=1 .
If the Arduino uno r3 microcontroller can fit both of these parts then can you tell me what pins should I plug the IR breakbeam into and the stepper motor to. Also for the stepper motor can I take the wires from the breadboard and connect it to an external power supply? Thanks in advance
An Uno can easily do what you want. You can use any pins that you want, but it is better to avoid pins 0 and 1 as they are the hardware serial pins that connect the Uno to the PC (through the USB to serial converter) to upload code. And the serial port is your best debugging tool.
Thanks groundfungus , can you tell me what pins would would connect the IR breakbeam to and the stepper motor to , also don't they both need to be connected to the gnd on the Arduino board or you can connect multiple different parts to different gnd? A rough draft from you would be helpful
Grounds are all common. There are 2 grounds on the power header and another beside pin13. All grounds connect together. The ground from the stepper driver and the 2 grounds on the IR break beam components all together to Arduino ground(s).
The way the pins are used in the diagrams in your first post is fine. Enable the internal pullup on pin 4 (if you connect the IR sensor to that pin) with pinMode(4, INPUT_PULLUP);
Yes I know , more eyes sir. Did not mean to offend. Any help I would appreciate besides the critique of my post etiquette. Do you think my question if feasible how would you connect the two parts to the Arduino ? Thanks in advance
What you did is called cross posting and cross posting is against the rules because it results in members wasting time. Do not cross post. Repeated offenses can result in time outs (temporary ban).
Your two topics on the same or similar subject have been merged.
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum
It will help you get the best out of the forum in the future.
Here is my standard explanation to this (in part at least ):
An interrupt is a mechanism for performing an action which can be executed in "no time at all" with an urgency that it must be performed immediately or else data - information - will be lost or some harm will occur.
It then returns to the main task without disturbing that task in any way though the main task may well check at the appropriate point for a "flag" set by the interrupt.
So what sort of actions do require such immediate attention? Well, generally those which result from the computer hardware itself, such as high speed transfer of data in UARTs(, USARTs) or disk controllers.
So interrupts have nothing to do with your present project and you are extremely unlikely to need them. They are however already used by the system itself for functions such as timing.