Introduction: Arduino Neural Network Robot

Picture of Arduino Neural Network Robot

This instructable is based on a 3 Part series I made for the Make YouTube Channel which shows you exactly how to prototype, design, assemble, and program, your own Arduino neural network robot. After watching the full series, you should have a better grasp on neural networks, PCB Design, and Arduinos in general. You don't have to make this exact robot(of course you can if you want) but I want to help people understand the process and what it takes to make a robot from start to finish. All of the files are open source and are available for you to download and modify. Follow these steps to make your own Arduino Neural Network Robot.

Be sure to also Subscribe to my personal YouTube Channel, where I release all sorts of cool open source projects that you can make yourself, for free!

Sean Hodgins YouTube Channel

Step 1: Watch Part 1: Design and Prototype

If you're going to be designing your own robot, you need to prototype and test some components before you begin to design a custom circuit board.This video will do just that. We will finish off with a completed custom PCB to send away to be ordered!

Step 2: Get the Parts and Tools.

Picture of Get the Parts and Tools.

Step 3: Prototype and Develop.

Picture of Prototype and Develop.

If you're making your own design, now is the time to make a simple prototype that will allow you to test the components you will be using later on. This will help you sort out any problems you may encounter in the future. Make a breadboard version of the robot, and add some firmware to test out the components.

Step 4: Create the Schematic.

Picture of Create the Schematic.

With the prototype completed, you can use the exact same wiring to create your own schematic. This will be the map for when you start to work on your custom PCB. I personally use KiCad for my projects.

Step 5: Design the PCB Outline.

Picture of Design the PCB Outline.

I like to design the PCB in cad software before I start working on it in KiCad. This way you can export the design as a DXF Files and import it into your KiCad project. Makes it way easier to create cool looking circuit boards.

Step 6: Start Placing Your Components and Routing Traces.

Picture of Start Placing Your Components and Routing Traces.

This is probably the most difficult part of the whole build, especially if you haven't done it before. Place the components into small sub groups. This helps organize things prior to placing them on the board. Then take the sub groups and start placing in locations on the board. Its easiest to centralize the microcontroller, then look at where the lines have to go and place the components accordingly. Start routing traces. Take your time and just work away at it, moving things as necessary.

Step 7: Send Your Board Off to Be Manufactured.

Picture of Send Your Board Off to Be Manufactured.

Pick a PCB manufacturer to create the real custom PCB you just made! I use OSHPark and PCBWay depending on my needs.

If you want to just directly order the board I made you can purchase it here from OSHPark or here from PCBWay.

Step 8: Watch Part 2: Assembly and Programming

Now that you have ordered your PCB, check out part 2 of the video series. This part I will show you how to assemble the board, and give you some tips and tricks along the way. Check it out!

Step 9: Organize Your Components.

Picture of Organize Your Components.

I like to separate the components into different types, surface mount discreet(resistors, capacitors), surface mount chips(integrated circuits), then lastly through hole components(this will be installed last). The resistors and caps will be installed first, then the ICs. Also its nice to start with the smallest(shortest) components first, so you don't end up hitting things with the tweezers.

Step 10: Add Your Solder Paste.

Picture of Add Your Solder Paste.

You need to apply solder paste to each one of the pads on the board where a component is being installed.

Step 11: Start Adding Components!

Picture of Start Adding Components!

Like I mentioned start with the shortest components and work up, starting with the resistors, caps, any discreet components. Then move onto the integrated circuits. We will install the through hole components later.

Step 12: Stick It in the Oven.

Picture of Stick It in the Oven.

Time to cook it! In my case(with my cheap toaster over) I set the oven to the max setting 230C, turn it on, and wait for the solder to "reflow". After that happens, I wait a few seconds, then take it out of the oven and let it cool off. Its a very simple process.

Step 13: Fix the Components.

Picture of Fix the Components.

Some components may have shifted or not soldered properly. Slowly go over the board and visually inspect it for problems. Fixing them with your soldering iron. Fix any bridged pins on the IC components as well. The video covers various techniques.

Step 14: Solder the Through Hole Components.

Picture of Solder the Through Hole Components.

Time to soldering on the remaining through-hole components. No particular order, but again doing the shortest components first is ideal.

Step 15: Add a Bootloader

Picture of Add a Bootloader

At this point, since everything is on, its time to power up the device and add a bootloader. Use the Atmel ICE on the programming header. You will need to power the device separately, either with another USB connected, or the batter. Open Atmel Studio 7 and Follow the instructions in the video.

The Bootloader can be found here: https://github.com/IdleHandsProject/makennbot

Step 16: Run Your Test Program.

Picture of Run Your Test Program.

We developed the program earlier to test the robots features. If your schematic has not changed at all you should be able to use the same test program. Try it out! It works!

Step 17: Watch Part 3: Neural Networks and Arduinos

In the third and final part of the series we talk about Neural Network and running them on an Arduino. I show you how the robot can be controlled with and without one. Its an interesting experiment. This video will cover some basics to Neural Networks and should hopefully help you understand a little bit more of what is happening.

Step 18: Program the Robot With the Neural Network Program.

Picture of Program the Robot With the Neural Network Program.

Head to the GitHub to download the firmware for the robot. If you follow along in the video it should help you understand what the different sections of the code are doing. Program it, and train your neural network!

Step 19: Run Some Tests!

Picture of Run Some Tests!

Now that you have gained a little more knowledge in neural networks, play with the program, setting, input, etc. and see how it affects it. Also see if you can come up with even better ways to train or control the robot. This definitely isn't perfect, or the best way by a long shot.

Step 20: Have Fun With Your Little Neural Network Bot!

Picture of Have Fun With Your Little Neural Network Bot!

Step 21: Support These Projects!

Picture of Support These Projects!

If you think I have earned it, please consider subscribing to my YouTube Channel. I will be doing a lot more cool open source projects like this one in the future, and I would love for you to join along.

Sean Hodgins YouTube Channel

If you want to support me on the next level, and have some cash to spare. Please check out my Patreon. The more patrons I receive, the more complicated and intricate projects I can develop and share to the world. I want to make cool stuff, and make that cool stuff free and public for everyone else to make as well.

Sean Hodgins on Patreon

Comments

landger (author)2017-11-21

This looks like an excellent implementation! Regarding the neural network, however, it is not being trained what to do at non-extreme input levels, so the neural network will only try to converge at extreme levels. At subsequently exposed intermediate levels it will respond in a way depending on the initial, random weights setting, but more on the number of training iterations. As it is minimizing RMSE, it will sharpen decision levels depending on the number of iterations. So I think it would be interesting to train on a set including (sensible!) intermediate levels. But you could also add other inputs, like sound level, distance sensors, or whatever you can think of. Of course that will take a lot more training time, but it will make the robot look more intelligent. Like that it stops moving when being shouted at in the light, but not in the dark. Also, to make it more insect-like, it should move away from a (changing) shadow, like a hand trying to smash a fly, instead of being attracted by it. In fact, you could record these situations and define the desired output, to make it more realistic. Anyway, great work and good fun!

rlbruderick (author)2017-11-20

Even though I haven't made the project yet, I am very impressed with how carefully you prepared this tutorial. The GIFs are helpful - you are illustrating non-static things. Keep up the great work!

WannaDuino (author)2017-11-18

i see myself in you dude, even OUR looks......:-)

send me one and i will make it in YOUR HONOR, I LOVED IT TOTALY from A to Z

wannaduino.com check me out dude and read my story, 1 THING in that you probebly NEVER did luckily but the rest you can relate too.

IgorF2 (author)2017-11-17

Great tutorial! I loved those gifs! :D

Raphango (author)2017-11-17

Great work!! Congratulations! =D

misterxp (author)2017-11-17

This is very interesting. Hope to find time to have a go at making one soon. Thanks for sharing!

acheide (author)2017-11-15

It takes a long time to load this page due to the many .gifs.

seanhodgins (author)acheide2017-11-16

Sorry about that. I like using GIFs, helps explain the story more. They're often not larger than any photos I would upload.

ThomasK19 (author)seanhodgins2017-11-17

For someone with tendency to epilepsy this page is also not recommended. I don't get any advantage of ANY of those gifs.

billbillt (author)acheide2017-11-16

FOR ME ALSO... NEEDS TO BE REDONE...

benoke1 (author)2017-11-17

Well done

What happens if you give it two light sources of different colors?

DIY-Guy (author)2017-11-16

Whoo hoo! That's sweet!
Good work Sean. Thanks for posting this. It's worth saving the project and buying parts to make it.

akm3726 (author)2017-11-16

That's a neat project. Thanks for the neural network description. I've come across them before but it was good to see one applied to such a simple function. I'll have to play with the ideas a bit, though.

seanhodgins (author)akm37262017-11-16

Thanks! That is the point, get people thinking about applications for them. People hear the words all the time, but don't really know where they can be used. Hopefully this helps a bit.

akm3726 (author)seanhodgins2017-11-16

Just by changing the training parameters, I guess you could make it follow lights, or maybe find the edge of a shadow or shade spot. Good fun!

anfedres (author)2017-11-15

Is it really using a "real" neural network? Or is it just an state machine that tells the robot to follow the light.

frarugi87 (author)anfedres2017-11-16

If you look at the code you'll find two basic functions, one for training a neural network and the other to execute the calculated values. Personally I've always preferred to train the NN on a PC and to just execute it on the embedded micro, but I think the author wants this to be an educational project.
BTW the neural network he is using is called Multi-layer perceptron (MLP), and is one of the "historical" neural networks

seanhodgins (author)frarugi872017-11-16

Exactly, training on a PC would be the way to go in 99% of the cases. But the robot itself is a learning tool. So the entire process takes place on the robot, without the need for a computer.

seanhodgins (author)anfedres2017-11-16

Its a neural network. It trains the network based on given inputs and outputs. The Arduino sketch has two different programs that can be run from the menu. One is a simple light avoiding algorithm, the other is a neural network.

About This Instructable

12,109views

193favorites

License:

Bio: M.a.Sc in Mechanical Engineering. Pretty much designing a new circuit board every day, and I have made a few inventions of my own ... More »
More by seanhodgins:Arduino Neural Network Robot3D Printed Pumpkin Bokeh CoverLearn to Surface Mount Solder Using an SMD Challenge PCB
Add instructable to: