Arduino code to solve maze using 3 ultrasonic sensore

i make simulation in protues but dc motors not work

i’m a beginner, so i need help in my code

how to control speed of two dc motor? ,how make robot rotates 180 degree when no way(road is closed)?

i will use (left hand algorithm) to find (dummy) to rescue and return from the shortest way, this algorithm will be good?

the entrance of maze is the same outlet

thanks very much if you help me

see attachment for my code
_2017-07-04_Maze_solving_with_ultrasonic.zip (989 Bytes)

1 Like

Hi,

Here are answers to your questions:

Please note that we will not help you debug or write your code in details. But, we can certainly point you in the right direction and make sure that the hardware part / libraries are working properly, so that you can have a good start.

You can rotate your robot by activating the proper motor driver channels. How much you turn depends on how long you stay in that mode. If you have no encoders on the motors/wheels, then the easiest solution is to simple base it on time: 1) Start timer of some kind; 2) Activate motors for turning; 3) Turn off motors when turned enough. Of course, the timing will be different when: the surface changes, the battery charge drops, the motors age, etc. It is best to use encoders on the motors/wheels in this case. These can tell you exactly how many turns (or part of a turn) you have completed, therefore allowing you plan how many are needed for a 90 or 180 degrees turn. It also helps if you want to move a certain distance (forward, backward), too.

Yes, it should work. Of course, if you have a maze that includes a loop / is not simply-connected, then that algorithm will not work. You can read more about maze solving algorithms here.

Good luck!

Sincerely,

P.-S.: Please note we modified your original post to add your code as an attachment. This is for two reasons: 1) it makes it easier to read posts when there is no large blob of code in them. 2) it makes it easier for other to help you, since now the code and be easily extracted by anyone and compiled right away in the Arduino IDE.

Hey brother. Did your robot work? If so please can you send me the coding. I am also working on a maze solving robot. And i took the idea from your circuitry. Its pretty simple and I love the idea. Thought or making a robot for myself as well.
P.S: How did you make the robot to turn itself around ?

How to make the robot save the shortest path to the end point to make it reach in the second run in the shortest time

Hey,

Here are some answers to your questions and comments:

We do not know if the member ever completed this robot project, since they never posted again on our forum. You could send them a private message about it, though. When logged in to the forum, click on the user’s name. You will see their profile page. From there, you should see a link to send a private message.

Typically, you make a robot turn by having motors on opposite sides go in opposite direction. You can find plenty of examples and tutorials online, such as this one.

Finding the shortest part typically requires information about all the paths available. Typically this is stored as a graph (directed graph is there is one-way paths, and weighted graph if not all paths are equal in work to go through or even both combined: directed, weighted graph).
A graph of the maze could either be programmed beforehand (if the maze is known) or built by your robot (if it is unknown in advance) as it drives through it.

Once you have the graph established, you can use any shortest path solving algorithm. A typical one that would be simple to implement would be A* based shortest path finding. You may also want to read more about pathfinding in general.

A possible way to go about this would be to figure out what algorithm you wish to implement for finding the shortest path. Then, figure out how you will obtain the data required to feed the algorithm. If the maze data is unknown/needs to be gathered by the robot, you will need to also design and implement a maze-exploring algorithm that builds a map / tries to find/explore all spaces.

We hope this helps.

Sincerely,