This tutorial serves as a guide to building and programming the small, fierce, and autonomous monster robot Znap. Through out the project, you will learn not only lego construction but EV3 programming as well. Make sure to read every step carefully, utilize all help links, and have fun!
What You'll Need
- LEGO MINDSTORMS Education EV3 Core Set
- LEGO MINDSTORMS Education EV3 Expansion Set
- EV3 Software (Available for Windows and Mac OS)
Step 1: Step 1: Build Znap
The first step is to put together the Znap robot. There are a lot of pieces to this model set, so make sure that you separate out the pieces from one another and to keep track of them. Make sure that you follow the instructions provided in the program so that every piece fits nice and snug. When determining the length of the pieces, please refer to the backside of the card stock insert that comes with the set. There is a section that shows you the part number and the size of it.
After the Znap is finished being built, it is time to add some modifications. The first modification is to add the red tank grips on the treads of the Znap. This comes from the TankBot set in the Lego box, but has been re-purposed for Znap. This allows Znap to have better grip on any surface which in turn means better response from the motors. See the photos to get a better sense of the tank treads.
The next modification is to add two wheels to the brick itself. This modification is needed because the grips on the treads make it so that the Znap does a wheelie when it moves forward. All we did was simply take the 120 degree elbow piece and attach a wheel to it that would allow it to spin. From there we attached it to the main body on the brick. The wheels are not meant to have full contact with the ground. Think of them as training wheels for Znap so that it doesn't rear back when it moves forward.
Step 2: Step 2: Programing Znap
The second step is to proceed forward with programming the brick for the Znap. This will allow the Znap to move autonomously after begin the program. What you will need to do first is to open up a new program from the EV3 file under the Znap folder ( this is where you will get the instructions to construct the robot). Although it is not required, it may help to write out on a sheet of paper what you want the robot to do.
We have provided an image of the program that we utilized to make the Znap come to life. It would be helpful to save the photos so that you can zoom in on the details of the code. There are many different ways you can program Znap to perform what you desire. The main motors that allow the Znap to move forward and backward are labeled "A" and "D" on the brick. The motor that controls the neck movements is labeled "B". The reason why there is no "C" motor is because the port is open on the brick. Referring back to the image, you will notice there are two separate program lines. The top line deals with the movement, and the bottom line deals with the sensing. For the top line, you will notice the blue "Activate" nodes. This is for the Znap to bite when he notices anything near his sensor field. Make sure that for the sensing line, that you will include tolerances for the sensors. This is so that he does not pick up something that is, for example, 5 feet away.
Some helpful tips when programming: Negative values for motors "A" and "D" will make the motors spin clockwise which will allow it to move forward. If you do not do so, you will find that the Znap motions will move backwards. When programming the turns, make sure you use the movements node and set the values opposite from one another (-100,100). This will allow the motors to spin opposite directions.
Step 3: Step 3: Optimize
Now that you have programmed and built Znap, it is time to run the program. Using trial and error, change the values on the individual nodes on the program to get different outcomes. For example, change the number of cycles from eight to four so that Znap does not move as far. If you want to add more spins, you may add more to suit your needs. The program itself is very flexible on the movement line of the program. If you notice an error while running the program or the program does not do what you wanted it to do, you will need to check and see if the programming nodes are in order or are defined. Often if there is an error, it will usually be because of the simple switch up of the nodes. That is why you need to be meticulous while programming the Znap or any thing in the EV3 program.