I need help with my code. I'm trying to make a code with PID control.
Hello! Sorry for the inconvenience! I have a robot with these components: TCRT5000 sensor with 5 channels, an Arduino Uno board, an L298N board and 2 motors (the L298N board is powered by 6 AA batteries of 1.5V each, and the Arduino Uno board is powered by 4 AA batteries of 1.5V each) and I have a code for it that works, but I heard on the internet and in various places that for a line-follower robot, like mine, there is another type of code, that is, with PID control. I would like, if anyone can, to explain to me how that PID works, what it does and if anyone can give me a starting code for my robot ( with PID).

28 Replies
Do you know what pid is? And what it does? If so explain it back in a basic manner.
I don't know. That's why I asked if someone could explain to me what PID does and how it works and if someone could give me some code as an example.
https://youtu.be/tFVAaUcOm4I?si=Omb5KWVG6Drp8gtm
Its a mathematical algorithm to controll logical controls to respond like analog devices.
DigiKey
YouTube
What is a PID Controller? | DigiKey
PID controllers are popular control mechanisms found in many systems used to help drive the main process’s output to achieve some desired set point. PID stands for “proportional, integral, derivative.” The controller compares the output of the process to some set point to create an error term. That error term is used in three separate calc...
Here is a video for you
Solution
Thank you !
Is this code good for something ?
Do i need to modify anything ?
Or I need to add something ?
ignore this . i accidentaly clicked on "Apps" and "Mark solution"
Or to delete something?
@Maderdash ? I saw you wos online a few hours ago .....
What's up?
.
Oh im not looking at files uploaded im on a cellphone
Oh . Should I sent u pictures ? Or text ?
I really need this code because I'm participating in a robotics competition in my country and I need this code to win. I'll modify Kp, Ki and Kd.
I understand but I want to know if I did the right thing and after all it doesn't say in the rules that we are not allowed to copy or anything like that. If you want I can give you the rules. But after all I asked for an opinion and help and explanations not a code.
You can post it in a past bin but to be honest its not going to mean anything to me. Its one of those things you need to load it on your bot. Test. Refine adjust retest. Repeat till you get it dialed in. There's not going to be anything there i can look at and say its going to work or not.
If you don't want to help, please don't get involved, because in the end it's none of your business if I get a low grade in the contest or if I don't win. If you want, you'll help, if you don't, you don't have to!
I know but I want to see if I understood it correctly and if it really needs to be done that way, because maybe even if it doesn't give me any errors in the code, maybe I didn't do something right or the calculations aren't good. I want the opinion of a professional or something like that. I want to know if the logic is good in the code.
I gotcha. I can look at it in a pastbin its a website that you can past code at. Then when you click save it saves it for 7 days and gives you a web link so others can view the code
This site : Pastebin.com - #1 paste tool since 2002! https://share.google/SYOK3c2EXdWLVZeKR. ???
Or is there another site? Should I look for it?
Thats the site
Past your code there set the language arduino give it a name.. all the settings then create the past
Ok
I'll do it tomorrow because it's a bit late in my country now and I've been working on the robot all day on the case code version and I'm tired. See you tomorrow!
Again idk if there is much I can do but I will look at it for you
Hello again ! in what category i put the code ?
and should I put a tag?
or a password ?
No password needed , no need for a tag. Syntax cpp or arduino
ok
wich category ? Source code ??
Sure
the name is same like here . "I need help with my code. I'm trying to make a code with PID control." . I didn't register. Should I?
No just coppy and past the web link now
Pastebin
I need help with my code. I'm trying to make a code with PID contro...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Ty looking
So it looks like your applying it to the sensor reads correctly. You're looking fine as far as I can tell; I don't know what the values should be.
ok . should i ask someone else ? who knows the PID ?
Sure