Arduino Autonomous Servo Robot Designed in Tinkercad
In this episode I'm gonna create a 3D
printed robot using Tinkercad for the design and the electronics. I'll show you
it all right here at Filament Friday Filament Friday is brought to you every
week by the generous donations of my patreon supporters. Support us at patreon and you get special access to CHEPClub.Com. I've been thinking about combining
electronics and 3D printing and make an autonomous robot.
This one from parallax is used in a lot of schools so I thought maybe I can make this educational so
this inspired me to design my own. Here's what I designed in Tinkercad I used
various parts that I found throughout Tinkercad and then put this together
plus a lot of modifications. It's got slots for servos on the sides the top
holes for Arduino and a little ball that goes on the front but here it is
fully assembled so you can see what its gonna look like. I found a lot of these
pieces available in the free area of Tinkercad.
I got a servos on both sides I
designed these custom wheels. I've got a servo on top with a Sharp sensor that'll
scan back and forth for obstacle detection. I've got an Arduino R3 on top
although I'd like to do my own custom electronics. On the bottom I have the
ball that I did find on Tinkercad and it's just got a pin going through it so
this can roll.
I've also planned some sensors that I can monitor the wheel
these holes in a wheel. I designed this wheel to go right by the sensor infrared
detector so I can count pulses and determine how far to go forward and back. This block here will represent sensors and possibly a line follower on the
bottom and then I've got some AA. Battery designed in for the servos and a
9-volt battery compartment underneath for electronics.
So that's the overall
plan but I'm gonna do something real simple just get this thing driving to
start. So here it is printed at a point three layer height on my CR 10 mini. I
did use supports and the holes for the servos so I popped out those supports
and this really came out quite nice for a point three layer height I just
used some PLA plastic. Then I installed some standoffs that I just screwed in
from the bottom into the holes for the arduino and then I put a screw through
the ball and just tightened this thing up.
I'm gonna have to list all these parts
at some point but right now I'm just kind of throwing it together. So then I
use some metric screws to tighten up these servos and they fit pretty nicely.
Actually I got the dimensions just about perfect.
You got to angle the servo here and these are parallax servos the same ones
using that robot I really like them and it pops in holds in place and then I
just use a screw and nut at the four locations and screwed it into the holes
that I designed into the wall. The Arduino pops over those posts that I put
in place earlier just slides on and then there's two nuts that I put at the back
of this thing and there's plenty of room for those nuts but the front two there's
not enough room for nuts so one of them I had to flip over and put a nut on the
bottom so it had to screw in from the top so I just put a screw and that fit
into this board the other hole was basically hopeless so it just stayed as
a locating post so I got three in place that should be good for power instead of
a 9-volt battery I used this 9-volt battery shield that I created and this
was a Kickstarter many years ago that I. Did, successful Kickstarter.
And that'll
power the electronics then I have this DF robot screw shield that has some
terminals for servos so I plugged in the left and right servos into pin 9 and 10
and power for the servos comes from four AA batteries now the connector
wouldn't fit in a little hole I'm gonna have to make that bigger so I just
shoved it through the top servo which I'm not going to use right away and then
I just used some double-sided sticky tape to hold this in place so I just put
it in place and squished it down so there's no 9 volt battery because that's a
shield but I want separate power from the motors and the electronics. Now these wheels are not the 3D printed design wheels these are ones that I had I want
to just get this thing working first so I want to get some code running so I
just used these for now and then the last step is just connect power from the
four AA batteries into the shield for the servos. So that's the assembly
it's done and this is actually the front of it so I need to do more work down the
road and make that look prettier but now it's time to do the code. So I go back to
Tinkercad circuits and here's the servo bot design that I made it's got two
servos and an Uno connected to nine and ten here like you see and then power and
ground.
That's the full circuit. Now I. Like to code in actually text mode not
the block mode I just find this is much easier for me so I included the servo
library with the servo dot H. I made a couple variables defined the two left and
right servo names and I'm the connections to
pin nine and ten.
Then I made a series of functions one that stops the robot and
by doing that if you send a fifteen hundred millisecond pulse or 1.5
Millisecond, fifteen hundred microseconds to both of them they they stall because
these are continuous rotation. A thirteen hundred drives it one way a seventeen
hundred drives the other way so that's how I do it forward and reverse then I
do two 17s for a right and two 13s for a left and I control how long it is by
this variable move. So in the main program all I have to do is call those
functions so I'm gonna call stop here with a thousand and thousand gets put in
to move and it's gonna stop for one second basically, and then it's gonna go
forward for two seconds left for seven hundred milliseconds forward for two
seconds and just goes back and forth and this is gonna draw a square or drive in
a square and then it's gonna do it again but everything in Reverse. The Tinkercad
circuits lets you simulate the operation which is really cool but now these
aren't continuous rotation servos these are standard servos so when they're flat
to each other that's when it stopped and then when they're both turning in
opposite directions that means it's going forward a reverse when to go on in
the same direction then that means they're turning.
So that's how I can tell
that my code is working. Now the next step I could do is run it in debug mode
which is another feature in Tinkercad now I can set a breakpoint here with
these little blocks so it's gonna stop at each of those lines and let me
control it. So it's gonna stop you can see they're both in line and the robot
I'm gonna show you how the robot should operate it's stopped and then it runs
the forward command and it does that and then it does a left turn
and I'm clicking the arrow over here to continue so I'm just stepping
through the program and then I'm showing you what the robot should do based on
these commands. So it's drawing the box and then turning and driving and turning
and driving so it's completed the box now it's gonna stop for a second and
then it's gonna go and reverse.
So it goes reverse and then it's gonna turn
right and then it's gonna go reverse for two seconds and then it's gonna turn
right and and then do that until it gets back to where it started hopefully. And here
it goes to the final movement and it drives back to where it started. Now you
can see it's not exactly where it started and the turns weren't perfect
but it's close enough for this so I'm gonna copy and paste this into the
actual Arduino IDE so I can program the robot and see if this will do exactly
what I want it to do so I plugged in the cable from the computer into the Arduino
and click upload and it uploaded the code and here it is in full motion
driving itself just like I showed in the debug but basically this is at full
speed here and then it does reverse and comes back so what I want to do now is
improve its accuracy of its turns and its movement so the next step in this
robot is to get the sensor working the infrared detector here that actually
shines through these holes that are in the wheels I designed. And so I've got to
improve the wheel a little bit that you can see if I make this a hole, let me
make it into a hole here, you can see that the sensor the center of the sensor
lines right up with these holes so I can count pulses by counting when there's a
hole or no hole and determine how much to turn or how much to go straight so
this should make the robot a lot more accurate.
This is a work in progress so
I'm not ready to release anything although I am sharing all the files with
the bronze, silver and gold members of CHEPCLUB.Com so they can build along
with me give me some feedback. So if you want to do that join us at CHEPCLUB. And
the winner from the last video for the CHEP Proto-Pasta candy apple metal
flake red filament is Keith Applegarth so Keith congratulations go to my
youtube channel about page my email is there Chuck@elproducts.Com, send me
your address and I'll ship it out to you. So if you like this type of project
maybe check out some of the other videos that are popping up over here.
Let me know in the comments what you'd like to see if you want to help
support the channel a dollar month to Patreon and gets you into CHEPCLUB and
if nothing else click on that CHEP logo and subscribe.
So that's it I'll see you
next time on Filament Friday..
printed robot using Tinkercad for the design and the electronics. I'll show you
it all right here at Filament Friday Filament Friday is brought to you every
week by the generous donations of my patreon supporters. Support us at patreon and you get special access to CHEPClub.Com. I've been thinking about combining
electronics and 3D printing and make an autonomous robot.
This one from parallax is used in a lot of schools so I thought maybe I can make this educational so
this inspired me to design my own. Here's what I designed in Tinkercad I used
various parts that I found throughout Tinkercad and then put this together
plus a lot of modifications. It's got slots for servos on the sides the top
holes for Arduino and a little ball that goes on the front but here it is
fully assembled so you can see what its gonna look like. I found a lot of these
pieces available in the free area of Tinkercad.
I got a servos on both sides I
designed these custom wheels. I've got a servo on top with a Sharp sensor that'll
scan back and forth for obstacle detection. I've got an Arduino R3 on top
although I'd like to do my own custom electronics. On the bottom I have the
ball that I did find on Tinkercad and it's just got a pin going through it so
this can roll.
I've also planned some sensors that I can monitor the wheel
these holes in a wheel. I designed this wheel to go right by the sensor infrared
detector so I can count pulses and determine how far to go forward and back. This block here will represent sensors and possibly a line follower on the
bottom and then I've got some AA. Battery designed in for the servos and a
9-volt battery compartment underneath for electronics.
So that's the overall
plan but I'm gonna do something real simple just get this thing driving to
start. So here it is printed at a point three layer height on my CR 10 mini. I
did use supports and the holes for the servos so I popped out those supports
and this really came out quite nice for a point three layer height I just
used some PLA plastic. Then I installed some standoffs that I just screwed in
from the bottom into the holes for the arduino and then I put a screw through
the ball and just tightened this thing up.
I'm gonna have to list all these parts
at some point but right now I'm just kind of throwing it together. So then I
use some metric screws to tighten up these servos and they fit pretty nicely.
Actually I got the dimensions just about perfect.
You got to angle the servo here and these are parallax servos the same ones
using that robot I really like them and it pops in holds in place and then I
just use a screw and nut at the four locations and screwed it into the holes
that I designed into the wall. The Arduino pops over those posts that I put
in place earlier just slides on and then there's two nuts that I put at the back
of this thing and there's plenty of room for those nuts but the front two there's
not enough room for nuts so one of them I had to flip over and put a nut on the
bottom so it had to screw in from the top so I just put a screw and that fit
into this board the other hole was basically hopeless so it just stayed as
a locating post so I got three in place that should be good for power instead of
a 9-volt battery I used this 9-volt battery shield that I created and this
was a Kickstarter many years ago that I. Did, successful Kickstarter.
And that'll
power the electronics then I have this DF robot screw shield that has some
terminals for servos so I plugged in the left and right servos into pin 9 and 10
and power for the servos comes from four AA batteries now the connector
wouldn't fit in a little hole I'm gonna have to make that bigger so I just
shoved it through the top servo which I'm not going to use right away and then
I just used some double-sided sticky tape to hold this in place so I just put
it in place and squished it down so there's no 9 volt battery because that's a
shield but I want separate power from the motors and the electronics. Now these wheels are not the 3D printed design wheels these are ones that I had I want
to just get this thing working first so I want to get some code running so I
just used these for now and then the last step is just connect power from the
four AA batteries into the shield for the servos. So that's the assembly
it's done and this is actually the front of it so I need to do more work down the
road and make that look prettier but now it's time to do the code. So I go back to
Tinkercad circuits and here's the servo bot design that I made it's got two
servos and an Uno connected to nine and ten here like you see and then power and
ground.
That's the full circuit. Now I. Like to code in actually text mode not
the block mode I just find this is much easier for me so I included the servo
library with the servo dot H. I made a couple variables defined the two left and
right servo names and I'm the connections to
pin nine and ten.
Then I made a series of functions one that stops the robot and
by doing that if you send a fifteen hundred millisecond pulse or 1.5
Millisecond, fifteen hundred microseconds to both of them they they stall because
these are continuous rotation. A thirteen hundred drives it one way a seventeen
hundred drives the other way so that's how I do it forward and reverse then I
do two 17s for a right and two 13s for a left and I control how long it is by
this variable move. So in the main program all I have to do is call those
functions so I'm gonna call stop here with a thousand and thousand gets put in
to move and it's gonna stop for one second basically, and then it's gonna go
forward for two seconds left for seven hundred milliseconds forward for two
seconds and just goes back and forth and this is gonna draw a square or drive in
a square and then it's gonna do it again but everything in Reverse. The Tinkercad
circuits lets you simulate the operation which is really cool but now these
aren't continuous rotation servos these are standard servos so when they're flat
to each other that's when it stopped and then when they're both turning in
opposite directions that means it's going forward a reverse when to go on in
the same direction then that means they're turning.
So that's how I can tell
that my code is working. Now the next step I could do is run it in debug mode
which is another feature in Tinkercad now I can set a breakpoint here with
these little blocks so it's gonna stop at each of those lines and let me
control it. So it's gonna stop you can see they're both in line and the robot
I'm gonna show you how the robot should operate it's stopped and then it runs
the forward command and it does that and then it does a left turn
and I'm clicking the arrow over here to continue so I'm just stepping
through the program and then I'm showing you what the robot should do based on
these commands. So it's drawing the box and then turning and driving and turning
and driving so it's completed the box now it's gonna stop for a second and
then it's gonna go and reverse.
So it goes reverse and then it's gonna turn
right and then it's gonna go reverse for two seconds and then it's gonna turn
right and and then do that until it gets back to where it started hopefully. And here
it goes to the final movement and it drives back to where it started. Now you
can see it's not exactly where it started and the turns weren't perfect
but it's close enough for this so I'm gonna copy and paste this into the
actual Arduino IDE so I can program the robot and see if this will do exactly
what I want it to do so I plugged in the cable from the computer into the Arduino
and click upload and it uploaded the code and here it is in full motion
driving itself just like I showed in the debug but basically this is at full
speed here and then it does reverse and comes back so what I want to do now is
improve its accuracy of its turns and its movement so the next step in this
robot is to get the sensor working the infrared detector here that actually
shines through these holes that are in the wheels I designed. And so I've got to
improve the wheel a little bit that you can see if I make this a hole, let me
make it into a hole here, you can see that the sensor the center of the sensor
lines right up with these holes so I can count pulses by counting when there's a
hole or no hole and determine how much to turn or how much to go straight so
this should make the robot a lot more accurate.
This is a work in progress so
I'm not ready to release anything although I am sharing all the files with
the bronze, silver and gold members of CHEPCLUB.Com so they can build along
with me give me some feedback. So if you want to do that join us at CHEPCLUB. And
the winner from the last video for the CHEP Proto-Pasta candy apple metal
flake red filament is Keith Applegarth so Keith congratulations go to my
youtube channel about page my email is there Chuck@elproducts.Com, send me
your address and I'll ship it out to you. So if you like this type of project
maybe check out some of the other videos that are popping up over here.
Let me know in the comments what you'd like to see if you want to help
support the channel a dollar month to Patreon and gets you into CHEPCLUB and
if nothing else click on that CHEP logo and subscribe.
So that's it I'll see you
next time on Filament Friday..

Comments
Post a Comment