Introduction: Build STEMbot1 - a Robot That Makes Programming Fun and Easy


The modern smartphone or tablet (mobile device) has more computing power than desktop computers had just 10 years ago. Modern mobile devices are full of sensors including: GPS, compass, 3-axis accelerometers, gyroscopes, etc and are well connected via cellular network, WiFi, and Bluetooth. Chances are, you have an old iphone or Android phone in a drawer somewhere collecting dust. Put it to good use making your next DIY project smarter.

Programming is an important part of many Science, Technology, Engineering, and Math (STEM) education programs. Breaking a large task into smaller tasks is at the core of programming, and easily demonstrated graphically by visual based programming languages like Catroid. Mobile devices with high resolution touch screen displays make visual programming a literal “hand-on experience”. Inserting the mobile device into a DIY project that moves according to the program written using the GUI provides direct visual and physical feedback of the programming effort.

STEMbot1 is a low-cost, easy to build, smartphone based robot. Controlled by any application that can playback a WAV file or generate audio tones. The robot can be built using an Android phone or an iphone. this instructable will provide direction for use on an Android phone. Catroid and RFO BASIC are the Android applications discussed in this instructable. Catroid is a graphical programming language based on MIT's Scratch. You can learn more about Catroid (and download it to your phone) here: http://blog.catroid.org/        Catroid controls the robot by playing back WAV files. WAV files are available to command the robot forward, right, left, and backward. You can download the WAV files from the EMGRobotics.com website or create them yourself using the EMGRobotics RC Servo Controller. Instructions to do both will be provided in this instructable.

For more advanced programmers, RFO BASIC for Android is a based on the language many of us learned to program on ourselves, BASIC. RFO BASIC was written by the creator of Atari BASIC (http://laughton.com/basic/). You can download RFO BASIC with the servo command (required for this project) to your Android phone here:http://api.ning.com/files/-ughp-tcovJuOzH*k2w28M6wFpBZF3NkaBRYyUVZNaQB3C5isW3hJJdKZksfnOM4jRX-a*egceidA7dosdTENwbvXqNOQcts/Basic.apk

Step 1: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

STEMbot1 is an easy to build robot, requiring only eight components (including the smartphone). The "motors" and wheels are actually RC servos purchased from Sparkfun (https://www.sparkfun.com/products/9347). These special servos are "full rotation" servos. Included with the servos, is a special large round servo horn that is used as the wheels for STEMbot1. 
If you are not familiar with RC servos, they are special motors that contain built-in drive electronics. Normally, RC servos only rotate about 180 degrees (this will become important when we start programming later) these servos provide full rotation so they can be used to drive wheels. You can learn more about RC servos here: http://www.rcmodelreviews.com/howservoswork.shtml
RC servos are commanded by a RC servo controllers through a three-pin connector. The servos require 6 volts (4 AA batteries) to drive their internal motors (this is provided through the red and black wires on the three-pin connector). The third pin (white wire) is a control pin.
The EMGRobotics Audio 2 Servo Controller Board (A2SCB) makes controlling RC servos from an Android phone easy. The A2SCB_ML ships fully assembled with a 4AA battery holder. Simply plug the servo three-pin connector directly into the A2SCB_ML, and plug the headphone jack into your Android or iPhone device. Two servos can be plugged directly into the A2SCB_ML. You can purchase the A2SCB_ML from www.EMGRobotics.com.
In addition to the servos and servo controller, you will need a popsicle stick, double sided tape, a large binder clip, and finally a cell phone holder. The cell phone holder was purchased at Walmart, but it is also available at Walgreens, target, and probably various other large stores. Just make sure the cell phone mount has the T mount with the 3M tape (see pictures).

The whole robot can be built for less than $60.00

Step 2: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

Step 1) Find the large round servo horn in the bag that shipped with the servo ( https://www.sparkfun.com/products/9347 ).
Step 2) Using the small screws that shipped with the servo, screw the large round servo horn to the shaft of the servo.
Step 3) Using wire cutters, clip the plastic mounting tabs (with the holes in them) off the servo.
Step 4) Measure and cut two 4 cm pieces of double-sided tape and put one piece on the bottom of each servo.
Step 5) Measure and cut one 3 cm piece of double-sided tape and apply according to images below.
Step 6) In the 1 cm gap, center the popsicle stick as pictured.
Step 7) Push the two servo's together as shown (bottom to bottom with the popsicle stick sandwiched between them in the 1 cm gap).

Step 3: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

Step 8) Fold the servo wires along the servo as shown in the images.
Step 9) Measure and cut two 6 cm pieces of double-sided tape and apply according to the images.
Step 10) Apply the large binder clip over the double-sided tape as shown.
Step 11) Remove the arms from the clip by pinching them as shown.

Do what you can to mount the large binder clip so the top of the clip is parallel to the servos.
The purpose of the binder clip is to provide a surface for mounting the cell phone holder. 

Step 4: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

The 3M tape on the cell phone holder is unusually strong. It may be impossible to separate if stuck incorrectly or to the wrong place. Do not remove the red plastic covering until you are ready to stick the cell phone mount to the robot. BEFORE REMOVING THE RED PLASTIC test the mounting first.

Step 12) The cell phone mount contains a piece of metal in the shape of a T with two pieces of 3M double sided tape covered by red plastic on it. The metal T mount is stuck to the side of the large binder clip as shown (this will become the BACK of the robot). BEFORE REMOVING THE RED PROTECTIVE PLASTIC, perform a few dry runs. The T mount should be straight after attaching. Perform a few dry runs with the red plastic protector in place. When you are absolutely ready, remove the red plastic protector and push the T mount to the large binder clip as shown.

Step 13) The plastic cell phone mount connects to the T mount using the same super strong 3M double-sided tape. Attach the plastic cell phone holder on the T mount as shown. The plastic mount has a top and a bottom, make sure it is not mounted upside down. Pay special attention to the photos below.


Step 5: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

The EMGRobotics line of audio interface boards provides a low cost, easy to use, expandable interface between your mobile device’s headphone jack and DC motors or RC servos. You can control up to 16 RC servos or DC motors by simply plugging an EMGRobotics audio interface board into the stereo headphone jack on your mobile device. Compatible with both Android and iOS mobile devices with headphone jacks; almost any application that can generate audio tones between 1khz and 11khz or playback a wav file can control motors and RC servos using the EMGRobotics line of audio interface boards.

Applications like Catroid (the GUI programming language for Android) can play back wav files that the EMGRobotics audio interface board converts to motion by controlling DC motors or RC servos. Programming languages like RFO BASIC for Android that can control up to 16 servos or motors using the ‘servo’ command. Finally, the EMGRobotics Servo Controller Android app lets you control motors and servos directly using on-screen sliders. Motion sequences can be recorded, edited, and played back. Motion sequences can be saved as wav files or RFO BASIC programs.

This project uses the EMGRobotics A2SCB_ML board ( www.EMGRobotics.com ) which ships with a 4AA battery holder. The switch side of the 4AA battery holder is stuck to the back of the T mount as shown using double-sided tape.  The switch faces the front of the robot as shown. The screw side of the 4AA battery holder will be visible from the back of the robot making it easy to change the batteries.

Step 14) Mount the 4AA battery holder to the T mount using double-sided tape as shown.

Step 15) The A2SCB_ML ships with a piece of double-sided tape. Use the tape to mount the A2SCB_ML on the top of the large binder clip as shown.

Step 16) Plug the two RC servo's 3-pin connectors into the A2SCB_ML with the black wire towards the edge of the board as shown.

Optional Step) Use tie wraps to wrap-up the wires for a clean robot. Small tie-wraps sometimes called wire ties can be purchased from Radio Shack, Home Depot, or Menards.

Optional Step) The tires are plastic and will slip heavily on some surfaces. If this is a problem, use wide rubber bands around the servo horns. You can order wide rubber bands from here: http://www.legoeducation.us/product/details/610







Step 6: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

My apologies for the rotated pictures. 

Step 17) Install the smartphone into the mount. The "wings" of the mount can be removed and inserted into various slots in the plastic cell phone mount (see instructions that came with the cell phone mount for additional information) to acomodate various phone sizes.

Step 18) Plug the A2SCB_ML headphone jack into your smartphone. Be sure to turn the volume all the way up on your smartphone.

The attached pictures provide views all around the robot. Use these pictures to verify your robot is ready for the next steps - testing and programming.


Step 7: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

Adjusting and Testing the Robot
--------------------------------------------


The Sparkfun Full Rotation Servo ( https://www.sparkfun.com/products/9347 ) requires the A2SCB_ML servo controller to be in "absolute" mode. This is done by removing all jumpers ( this is the default setting as shipped ).    

After verifying the servos have been plugged into the A2SCB_ML correctly (black servo wire towards the edge of the board) plug the A2SCB_ML into the smartphone's headphone jack.

THE ROBOT MAY MOVE WHEN DOING THE FOLLOWING STEPS
Use the switch on the 4AA battery holder to turn on the robot. You will see the lights on the A2SCB blink.

ON THE SMARTPHONE go to this URL:   http://buildsmartrobots.ning.com/profiles/blogs/stembot1-wav-files
Turn the volume on the smartphone all the way to MAX. Click on the stop.wav URL. Play the WAV file.

At this point, the wheels on your robot may be turning. Using a small straight screwdriver, adjust the "rest point" by turning the potentiometer in the servo behind the little hole labeled "middle point positioner" as shown in the images.

Adjust the "rest point" until the servo stops turning. Do this for each servo.

ON THE SMARTPHONE go to this URL:   http://buildsmartrobots.ning.com/profiles/blogs/stembot1-wav-files
Turn the volume on the smartphone all the way to MAX. Click on the slowforw.wav URL. Play the WAV file.

Both wheel should turn forward, and the robot should start moving forward.

ON THE SMARTPHONE go to this URL:   http://buildsmartrobots.ning.com/profiles/blogs/stembot1-wav-files
Turn the volume on the smartphone all the way to MAX. Click on the slowright.wav URL. Play the WAV file.

At this point, the servo's have been adjusted, and the robot tested. It is time to start programming the robot.






Step 8: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

Using Catroid to control STEMbot1 is easy. Simply use the "Start sound" Catroid block to play the WAV file for the action you desire.
See images below for an example Catroid program to make the robot move in a square pattern.

You can find additional information about Catroid on their project site: http://developer.catrobat.org/

There is also a blog: http://blog.catroid.org/

And a project page with lots of example programs: https://pocketcode.org/

There is also a Google+ page: https://plus.google.com/communities/116816272940643231129




Step 9: Build STEMbot1 - a Robot That Makes Programming Fun and Easy

RFO BASIC is a feature rich BASIC for Android written by the author of Atari BASIC.
RFO BASIC is available on Google play, but EMGRobotics has added a custom command to RFO BASIC; the servo command can control up to eight servos.

The enhanced version of RFO BASIC can be downloaded here: http://api.ning.com/files/-ughp-tcovJuOzH*k2w28M6wFpBZF3NkaBRYyUVZNaQB3C5isW3hJJdKZksfnOM4jRX-a*egceidA7dosdTENwbvXqNOQcts/Basic.apk

There is a great manual available here: http://laughton.com/basic/

T
he 'servo' command has the following format: servo 0,5, servo1, servo2, <servo3>, <servo4>, <servo5>, <servo6>, <servo7>, <servo8>

The 0 and 5 are for advanced features. Parameters servo1 and servo2 are the servo positions. Parameters servo3 through servo8 are optional (for daisy chained ADSCB_S).

The following is an example RFO BASIC program for driving STEMbot1 in a square pattern.

REM Start of BASIC! Program

loop:
rem move forward
servo 0,5,104,80
pause 5000

rem turn right
servo 0,5,80,80
pause 2000

goto loop



Epilog Challenge V

Participated in the
Epilog Challenge V

Toy Contest

Participated in the
Toy Contest