r/Python • • Feb 16 '19

A line follower robot my classmade and i made with python for our minor project. Turned out working great :D

1.1k Upvotes

46 comments sorted by

10

u/CyberNerd88 Feb 16 '19

I have to do this at the end of my current python class. How hard was it?

9

u/Marc_B7 Feb 16 '19

It was pretty easy to do. There's already alot of tutorials out there so by following them you should be able to do it.

11

u/logincat Feb 16 '19

Raspberry Pi?

13

u/Marc_B7 Feb 16 '19

Yes we put a Raspberry Pi on top.

1

u/logincat Feb 18 '19

πŸ‘

5

u/[deleted] Feb 16 '19

What kind of OS is running on the raspberry PI?

3

u/Marc_B7 Feb 16 '19

Linux

4

u/[deleted] Feb 16 '19

Is is controlled by an always-running programm?

3

u/Marc_B7 Feb 16 '19

Yes we had to manually turn it off

5

u/[deleted] Feb 16 '19

Besides the raspberry pi what hardware did you need

4

u/Marc_B7 Feb 16 '19

We used a powerbank for the batteries, a rgb color sensor and the robot is a standard robot package you can buy. We also had an ultrasonic sensor but we didnt use it.

22

u/TurnTheTideTM Feb 16 '19

Very cool! If you want it to go faster, look into the PID control algorithm, it's rather easy to implement and leads to great improvement.

4

u/xCAKSx Feb 16 '19

Are you guys bachelor students?

5

u/[deleted] Feb 16 '19

Not sure if they did this for a class or not, but my school has this as a class project for a 100 level ECE course.

2

u/TheGenocides Feb 16 '19

I had a similar assignment in 2013 in ECE 101, but I also had to stack a brick on a pillar and hit a ball into a cup that was 1 foot away. These damn millennials have everything so EASY! /s

4

u/[deleted] Feb 16 '19

very cool, well done!

4

u/Splitje Feb 16 '19

G E K O L O N I S E E R D

3

u/DQQpy Feb 16 '19

What's the reason for having two ultrasonic sensors? They don't look like they are inclined.

3

u/desal Feb 16 '19

Jeez, get your shit out of the way, cant you see my little buddy is trying to get to work /s

7

u/temperlancer Feb 16 '19

Better than Uber's self-driving car

2

u/Marz0008 Feb 16 '19

Why is it turning so much when the line is straight? Great job BTW

5

u/IAmDaBadMan Feb 16 '19

If I were to hazard a guess,the reflection of the light coming from the window onto the shiny tape is throwing the robot off.

2

u/hoppla1232 Feb 16 '19

Really cool to look at! Did you use a PID to drive along the border between black and white or is it a digital black/white recognition? A few years ago I and a few frieds of mine programmed a Lego Mindstorms EV3 robot with Python using an SD card to liveboot a Linux System on it and it was so much more convenient to program using Python instead of the Mindstorms Programming Software... I could just use a PID library instead of tediously transferring it into the graphical interface of the software

2

u/vlanins Feb 17 '19

This is pretty cool and inspiring! I have a rasperrypi but never did much with it.

1

u/mutemute Feb 17 '19 edited Feb 17 '19

Do a Pi-hole!

2

u/vlanins Feb 17 '19

thanks! Adblocking sounds pretty interesting.

btw, you are missing a colon after 'https' in your url. It leads to http://www.https.com which is some home improvement site and I was very confused haha. The url should be https://pi-hole.net/

1

u/eddyabasiada Feb 16 '19

This is lovely. Hope to get there soon

1

u/[deleted] Feb 17 '19

Would the bot wander less going in a straight line if the black line was narrower? Just curious. Awesome project!

1

u/koning_willy Feb 17 '19

What school / field of study do you follow?

1

u/wiz007 Feb 18 '19

that's cool !

1

u/[deleted] Feb 16 '19

I've only ever done an intro to python course but I have no idea how you use python to program hardware...how does it work?? Explain like Im 5?

2

u/Jopakes3 Feb 16 '19

He programmed a raspberry pi, which has sensors connected to it, that it uses for input to control the movement.

0

u/[deleted] Feb 16 '19

Some high schools have kids that are interested on making Python robots. My school has kids that smoke in class and think they're cool. #feelsbadman

-3

u/Darkwisper222 Feb 16 '19

My fundamentalist nature would force me to code it all myself. But good work on ctrlc gtrlv

-2

u/[deleted] Feb 17 '19

Pretty good for highschoolers.

But you definitely can dump down the side of the robot. Maybe it’s not necessary to use a RPI at all. A simple Arduino would just do.

-10

u/ephem1235 Feb 16 '19

Doesn't work to well

5

u/[deleted] Feb 16 '19

Works better than one that doesn't exist at all!

1

u/ephem1235 Mar 20 '19

Bro a tesla follows lines

0

u/[deleted] Feb 16 '19

[deleted]

36

u/Marc_B7 Feb 16 '19 edited Feb 16 '19

We used the GPIO library. Here's a tutorial we used to to get the motor up and running:

http://explainingcomputers.com/rasp_pi_robotics.html

We used a color sensor to detect a white or black color. Here's a tutorial on that:

http://bradsrpi.blogspot.com/2013/05/tcs34725-rgb-color-sensor-raspberry-pi.html

4

u/iftoxicthengtfo Hatchling Feb 17 '19

to detect a white or black color.

Had a feeling that's what the tape was for lol

This is awesome!

6

u/SirBaum Feb 16 '19

I didn't build it. But in case it was buidl with pattern recognition, i would use OpenCV. Then only realize the black and white with a direction.

0

u/[deleted] Feb 16 '19

[deleted]

43

u/Marc_B7 Feb 16 '19

We started out without barely any knowledge of python. We worked on it for a few weeks including learning python. Building the robot and testing it was done in a few days :)

0

u/[deleted] Feb 16 '19

[deleted]

19

u/Marc_B7 Feb 16 '19

We tried working with opencv but it didn't give us the results we wanted. We taped a color sensor at the bottom to read white or black colors. For this we used:

http://bradsrpi.blogspot.com/2013/05/tcs34725-rgb-color-sensor-raspberry-pi.html

For the engine we used:

https://www.youtube.com/watch?v=LTBBcCV7A28

http://explainingcomputers.com/rasp_pi_robotics.html