I want to make a robot for Science Olympiad Robot Tour. It requires you to create a robot that can traverse through a maze. Right now I have an arduino uno R3, an l298n motor driver and dc motors with encoders (link to where I got them and their specs, Amazon.com: DC 6V DIY Encoder Gear Motor with Mounting Bracket 65mm Wheel Kit Micro Speed Reduction Motor Mini Motor for Art Car Robot Model DIY Engine Toy(100RPM) : Toys & Games). So far I have tried multiple ways which I could find online to get them to work but none of them have. I noticed that when I connect 2 of the wires of the Encoder DC motors directly to 5v and GND it works but I am unable to figure out a way to control when it starts and stops. If someone could help me figure out the wiring I would really appreciate it.
Not enough information. Please read and follow the instructions in the "How to get the best out of this forum" post, linked at the head of every forum category.
You need ~9V/4A power supply for your motor, L298N has about 2V drop.
Read this to start with:
Hi, @quickpenguin123
Welcome to the forum.
Forget about the encoder for the moment, just try and get the motor running, it will work without the encoder.
Please post your code, in code tags.
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Tom....
![]()
Ohhhh, I see. I tried it and it works now. The only question which I have though is how do I control how many turns it's taking, for example if I want it to turn exactly how would I do that? I just need to know the wiring for the wires of the encoder which aren't the power and gnd.
Start the motor, use the Arduino encoder library to count the number of encoder steps, and stop the motor when the desired number of steps is reached.
Your encoder gives apparently 11 ticks per turn according to the image I posted previously so you won't get a lot of precision.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

