Arduino Robot: wall follow maze

I have an arduino robot. I want to make it follow a wall using PID. I have an IR sensor on the left side and a sonar sensor at the front. I checked the web for it but all I could found was for uno or other boards. Arduino robot has the wheels and everything built already and I am kind of lost with where to start from.
I want the robot to detect the IR reading and make it maintain a specific distance at all times. I want to implement PID controller to make sure it does its job. Please help me!!!!

I want to make it follow a wall using PID.

Why? This sounds like a class project that you don't have a clue about.

PID is used to control processes based on feedback, like lowering the power input to a heating system as the temperature gets closer to the desired temperature, so you don't overshoot.

How that relates to a wall following robot is not at all clear.

I want the robot to detect the IR reading and make it maintain a specific distance at all times.

So, you have a distance. What are you going to vary to possibly change that distance?

Thank you for the reply
What I want to do is basically to maintain a certain distance from the wall at all times. If it drifts from away,the PID algorithm calculates the error and change the motor speed accordingly to veer it back towards the set point and does the same if it veers too close. Arduino does have a PID library but I am just not sure how to implement with arduino robot.
I tried with open loop system where its not taking any feedback and its terrible. I want the robot to sense the veering and change wheel speed to veer back to the set point.
Hope I made it clear.

I tried with open loop system where its not taking any feedback and its terrible. I want the robot to sense the veering and change wheel speed to veer back to the set point.

So, what is the problem? This is not the place to ask people to write code for you. That's done in Gigs and Collaboration.

Here we'll review what you've done, ask questions, and offer suggestions. But, in order to offer suggestions, we need to know what the problem is.

Hi, what is the IR device your are using, does it give an output that is proportional to distance.
If you are using this as your wall detecting device it will have to give you distance info.

Tom...... :slight_smile: