©2019 Robotics for COMPLETE Beginners

19

build a Robot: Design

 

In order to build an automated machine or write code for some automated process there should be a specific need being addressed.

 

The internet is littered with useless automated programs and videos of useless scraps they call "robots" that often have the same cute look.

 

This is one trait you will notice about what most people consider "robots"...They all have that same dumb look, like a breed of dog that man regretted making.  See below...

We can do better...

Surprisingly, NASA can't...but YOU can

Now, I am NOT knocking on the stuff marketed toward kids like the LEGO mindstorms and BOOST sets. Those are all fantastic for children to learn from, really.

Arduino is great for middle schoolers and Raspberry Pi is basically a mini computer that can run on Linux with robot capabilities.

I AM a fan of Raspberry Pi.

I have one. They are a whole different animal with other fantastic capabilities.

But as adults concerned with inventing simple inexpensive machines that perform work, we can do better.

We owe it to ourselves and the next generation to make designs that will inspire them to make even BETTER designs, making this world even more interesting than it already is...if you can believe that.

I know, I know!  It's hard at first.

Wash your ideas clean, light some incense and clear your mind.

Alright, now let's talk about the way you SHOULD be thinking of how to build ANY electronic project/robot/software program.

I bunch these together because they are all sides of the same coin.

They are all interrelated.

Once you start one you immediately have a foot in the others which is great news for you!

1.  Think of the NEED you want to address.

What problem needs to be SOLVED?

Is it a spam bot to annoy your least favorite....you get the idea..

Is it a machine that can bring you a can of your favorite beverage?

Is it a set of components that counts something, like the number of times a task has been done?

 

2.  Think of the STEPS you need to solve that problem or perform that task.

If you are building a beverage fetching machine what is the first step?

Maybe it is listening for a radio call sent out by your button press.

What's the next step?

It could be sending the wheeled robot to the fridge, etc.

After that, it would need to open the fridge.

The next step would be to raise itself or an arm to the level of the beverage in the fridge.

After that it would need to determine which beverage to pull out, avoiding other items.

It then should confirm that it has grasped and retrieved a beverage correctly and firmly.

It would need a routine to fall back on in case it cannot confirm these, maybe retry.

After that, it would need to find its way back to you.

It would need to raise the beverage in order for you to reach and let go when it senses you grasp it.

Then it should back away and enter a standby mode again.

 

WHEW!

 

See how complicated this can be?

This is why you MUST MUST MUST practice the fundamental, most basic programs and keep your projects as simple as possible.

Also, remember to review what you know out loud and teach others what you know.

That is the best way to look cool and convince yourself you have any idea what you are doing.

 

So, let’s design a simple robot with what you have learned so far.

Be patient with yourself.

You are starting to learn the CULTURE of machines along with the language.

It is PURELY logical, ON or OFF, no missing steps allowed.

This is all new and you are actually learning several skills at once so if you feel like throwing something across the room…walk away and come back to it later.

Or just throw.

I do this all the time and is the ONLY way I know how to complete any electronic design.

The first step to a GREAT design is the concept.

This is the foundation which you will build great things on.

Likely, you had a need for some automated task or chore completed.

Maybe you saw something and thought of how to improve it or maybe you saw a toy and want to replicate it’s basic design.

These are ALL great sources for your concepts.

The more exciting they are to you, the more powerful they will be in motivating you to push yourself until they are completed.

Let’s practice the simplest way to make a robot and practice concepts by mimicking an already existing design and replicating it!

 

Take this mini fan for example.

What do you think is the process behind it all?

Take a minute to think this out in the simplest way possible. 

 

 

Of course you could simply attach a low voltage battery pack to a low amperage dc motor with 2 wires.

A switch would help bridge the connection, right?

 

The components and any chips will be vulnerable to EMF flyback damage from the AC like current that flows backward when the switch is turned off.

Ok, so we should include a diode to prolong the life of our battery and motors, etc.

What next?

How about an led attached to the power line when turned on?

Ok, got it.

But we should probably put a resistor on that led to help prevent burnout, help it enjoy a long meaningful life.

Sure thing.

So far we have a simple dc motor, 2 main wires, a battery source, resistor, switch, diode and…

Let’s include a capacitor. Remember why?

That’s right, to prevent ‘brownout’, to provide constant voltage.

It’s good practice really…

The last and most difficult part would be making the actual propellor for the fan.

Guess how we can do this?

Yep, use anything really.

Fold some paper, cut cardboard or thin plastic sheets, etc.

Use ANYTHING that is cheap and available.

Remember, this is your CONCEPT design.

Make sure there is a center with a small hole to attach to the motor.

Use some hot glue gun to attach it to the motor and BAM!

You just replicated a mini fan that people pay anywhere from $5 - $30 for in stores.

The only difference is yours is lacking the plastic case that makes it look nice.

Is this a robot?

Not quite.

Is it electronic?

Yes.

Is it functional?

Yep.

Can we add to it?

Damn straight we will!

Now we are going to make this fan a bit more complicated.

Much like the way our brains are developed into layers, each responsible for higher level tasks than the previous layer, our robot will start with the idea of a mini fan and grow into a lean, mean, fighting machine.

Now, we have our idea of the mini fan.

Let’s think of how we can improve it.

How about pwm to glow the LED on and off?

How about pwm to rev up the motor?

How about servos to move the mini fan up and down and left and right?

We could attach some sort of rudimentary lathe to each fan blade.

We could even hook up some wheels to motors and control it all with a simple PS2 joystick (not Playstation).

There are many ways to improve this thing because right now, its too boring.

 

If we plan on doing anything interesting we should include our brain, the microcontroller.

If you have read the “Microcontrollers” section you will know that I use Atmel AVR microcontrollers and will be using the popular 328P chip found in the Arduino Uno.

REMEMBER! You can use any version of the AVR chips and may even use other brand chips but the programming I will show here will be compatible with the AVR series.

 

However, the concepts here can be carried on to any microcontroller project.

The microcontroller would be programmed to interact with this new and improved death dealing mini fan tank.

Now, you see how we can expand, modify, or copy existing designs and materials.

Your first step in robot design is going to be what I like to call Skully McSkullface.

Here he is in 1/4 of his glory...

This is the him in his early stages...and a little photoshop to help me visualize the potential for such a simple project like this one.

I have attached a cardboard block on the back with a glue gun and grabbed onto that with the snake phone stand that clips to my desk.

A cheap solution with a very cool effect.

Makes me want to try and make 

Skully McSkullface has:

 

1.  Glowing LED eyes

2.  Servos which move the lower jaw up and down

3. Push button which controls the movement of the jaw

This will be a project which you can practice the following skills:

1.  Design

2.  Assembly

3.  C programming

4.  PWM implementation (so important for electronics and robotics)

5.  Combining multiple components and functions

6.  Soldering

7.  Troubleshooting (I hate this too...its ok...cry on my shoulder if you must.)

This project is designed around the mask/case while other projects may have the case designed around the components so keep that in mind.

You can think of the design process very simply like below.

Another important part of the design process that can be easily overlooked is the need to divide the separate functions your robot will do into their own little mini projects.

 

Alot of people refer to this as "chunking" and it works.

 

Let's say you want to make a robot that lifts a beer can to your hand from the ground.

 

This can get very complicated very quickly unfortunately.

 

What we can do is establish the structural needs: your design needs to be stable enough to hold a can full of liquid which is heavier than you may realize.

 

Then, you may want it to have wheels although it is best to keep it as simple as possible and add to your design as you go.

 

Then, you will need an elevator mechanism to raise it up to your hand level.

 

This can be done in a few ways and you may want to draw out a logic tree comparing your various options.

You could have a complex arrangement of servos attached to planks of a solid, lightweight material which would look like several arms bending open as it raises the can to your hand.

However, you would need servos strong enough to do the job.

What's an easier way to do this?

How about a motor attached to a long screw-like pole.

We can attach a flat plank or cup holder to a long nut.

When the motor rotates in on direction it causes the nut to travel upward and vice versa.

Much like what you can see on 3-D printers and CNC machines.

This is a much simpler, easier way than our servo idea.

After we build the basic concept and have everything working THEN we can start making the design look pretty and add more functions to our build.

This is how I maintain simplicity in such a complex hobby.

Always walk before you run and look both ways before you cross that busy highway of pain that this can quickly become.

All you will need for our simple robot face build is ANY kind of mask.

You may use any lightweight plastic Halloween mask like I did, or paper, or even make one with cardboard.

Mine was only $2.

*Pro tip: Don't spend more than 1 minute deciding

The first thing we need to do is separate the lower jaw from the upper portion of the head.

The next thing you may want to do is loosely reattach the lower jaw.

I used small rubber bands and small eye hooks I glued to the inside with a hot glue gun.

You can figure this out or choose not to do it, it depends on your mask type really..

Where do you think we can fit all of our components?

That's right, the back, behind the forehead.

We are going to need:

  • 1 AVR Microcontroller (I'll be programming a 328p 8 bit chip but you can use others)

  • 2 servos

  • 2 LEDs

  • 1 ping pong ball

  • 2 resistors (anything around 200-1k ohms resistance is fine)

  • solder-able electrical wire (16 gauge solid core sturdy and easy to solder to)

  • wire rods (I found some cheap 20 gauge flexible solid core garden wire which I twisted 2 pieces together to form a flexible, strong rod)

  • some cardboard or glue and popsicle sticks to form a small box

  • solder

  • soldering iron

Optional: small eyehooks and small rubber bands for added jaw stabilization

You are going to be blown away when you see what you can do with just a few materials here.

What I did was cut the mask to separate the upper and lower jaw.

Mine already had a path for my knife to follow.

I was careful not to break anything, just go slow and you may want to use a vice to hold it while cutting.

After that, I had a small cardboard box I made from leftover packaging materials.

Again, you can think of something.

Build a box with popsicle sticks, whatever works.

I then hot glued my box to the back of the forehead.

After that, more hot glue on the bottom of the box to attach my servos.

**Note: I did have to reverse one servo's wiring because I wanted to use 1 pin to control 2 servos which would basically rotate in the same direction but would be placed in opposite directions of each other.

See my picture below.

To learn how to rewire a servo see my video here.

You don't have to rewire a servo like I did.

In fact, you can just set up another Timer to control the second servo but that would take up 2/3 of the Timers available and only 1 has the higher 16-bit resolution we want for the most accurate servo control.

It's up to you but I recommend cracking open a cheap servo and learning how to rewire it. It will add another very useful skill which you will utilize again and again.

Now, that we have the servos glued we can make the eyes.

Our eyes are simply LEDs.

If we just wire LEDs to the center of the eye sockets it looks dumb.

We need some sort of background to constrast with and hid the wiring.

I used a ping pong ball that I cut in half, poked a hole through the middle and colored the inside with a black marker.

Stick the LED through the hole and BOOM, you have a nice looking eye!

Before we leave the LED in there we want to solder a resistor to one end of the LED and solder two wires which will connect to GND and a single pin which we will use with an 8-bit resolution Timer to make both LEDs glow to life.

If you don't want to make them glow you can simply attach one end to GND and one end to VCC.

You don't have to but I recommend sliding on some heat shrink wire covers to protect the soldered connections and the resistors so they don't break off so easily. It's also good practice in general.

Ok, so we have wires soldered to the LEDs and resistors, now just poke those LEDs through the holes in the ping pong ball halves and tape or glue those to back of the mask at the eye sockets.

Now we can twist the thick, solid wire together and clip it to size.

Now, screw one end into the servo and glue the other end to the lower jaw.

You will figure it out.

You should have something looking similar to this...

And that's it!

Remember, perfectionism will hold you back so just make a sloppy concept and fix it as you go.

If some wiring or glue comes undone don't panic in a fetal position, just redo it and always trust that you can figure out design as you go.

And that's it!

Remember, perfectionism will hold you back so just make a sloppy concept and fix it as you go.

If some wiring or glue comes undone don't panic in a fetal position, just redo it and always trust that you can figure out design as you go.

Get my favorite books on programming AVR chips I use.

Equip yourself with the most dependable, no hassle, quality usb programmer I use daily.

Make sure you have a basic kit. Arduino is fine, it contains the removable AVR 328p chip we will use.

 

I started with something very similar.

Summary

I hope this demistified designing a robot for you.

Design can be either the most fun or the most frustrating depending upon the project and your skill level.

My rule of thumb is to keep it as simple and cheap as possible for the concept and then just go from there.

Even if you believe you are not artistically talented you will find yourself designing no problem.

The key point I want to make here is there are few amazing robot design, at least in my opinion.

Think to yourself "How can this look better? How can I make it more functional?"

Try new things not just copy the same old square robot with 4 wheels and a proximity sensor on it.

Don't think that unfolding servo arms are all that can be made, think more natural.

Study anatomy and bone structure. Nature will teach you better design.

In the next part we will be learning how to setup and initialize Timer Code and apply it to the glowing LED eyes function of our robot face.

See you there!