After finishing my sumobot I was really excited to build another robot so I started brainstorming. I finally decided I wanted to try and make a balancing robot sort of like a segway only a lot simpler. Now the problem is I didn't have any super fancy sensors like accelerometers or gyroscopes so I had to find a way to know if it was balanced with what I had lying around. What I ended up using was 2 super bright LEDs and a LDR (light dependent resistor) to "see" how far the floor was and know if its falling one way or the other.
Once I got the LDR running through an analog input I had to find a way to tell it when it was balanced so I hooked up a potentiometer to another analog input and made that so I could manually set the balance point. Unfortunately the only potentiometers I had lying around was a one turn style which make tuning it a little hard but all in all a fun way of interacting with it.
Now since Im only using a LDR as a crude distance sensor a whole bunch of variables affect its performance such how much light is in the room or what color the surface its balancing on is, although I kind of enjoy this as I have to continually interact with it. The program is really simple in that if the sensor is farther away from the floor than the balance point then the motors move backwards, if it's closer than they move forward. This gives the robot an oscillation around Its balance point which makes it not the most stable as it does fall over some times.
I'm pretty happy with the way it all turned out. I set out to build a robot that balanced on two wheels and finished it in one weekend with parts i had lying around for pretty cheap. I do plan on trying to improve the program to be smoother and better balanced. I want to learn and incorporate a PID controller and if anyone knows some good learning resources or tutorials for it I would appreciate that. More power to the wheels would be better too so I'm thinking of trying a 9 volt battery instead of 4AAs. As far as improvements are concerned any suggestions would be appreciated.
cool robot. i think my mini cool robot. i think my mini sumo is gonna be a failure D: the design is too cramped!!! anyway, that just my prototype, gonna make a better one.i may make a balancing robot too. haha
Wow! This project sounds awesome, your sensors remind me of a line following robot I read in a book. It shines a bright LED on the ground and compares the amount of light reflecting in the LDR, but a balancing robot is so much better! I can’t wait to see the video.
RobotRoom Are you talking about the books from David Cook because thats were I got the inspiration to try it from. I actually have both his books and his website is a great resource. His stuff really got me into trying to build my own robots.
What kind of algorithm are you using to calculate the response of the bot? are you using any averaging/integrating/filtering?
I think that LDRs have a relatively slow response time, something like 4 or 5 times that of phototransistors - maybe it’s not important but it would speed up the cycling of the program?
Basically the program is really simple, it bascically goes like this:
IF LDR is less than tuning pot then move fowards
IF LDR is more than tuning pot then move backwards
Loop
Really simple although I would like to try and play with some better algorithms like a PID controller or something like it but I still need to learn more about it and how to use it. But then again everything can always be improved so we’ll see what I actually end up doing.
if it is posible for you try to put some bigger wheels (3 inch.or so)on your robot,maybe it will stabilise it. leave the sensor at the same hight as you have it now