Instructables
Picture of Hack the Snap Circuits Rover
In this Instructable you will learn how to hack the Snap Circuits Rover by adding a PICAXE micro controller and building a Snap Circuits Programmable Robot. First, you will learn how to install the PICAXE Programming Editor (the PICAXE is the microcontroller, or computer brain for your programmable Snap Circuits robot). Next, you will learn what a simple PICAXE program looks like and what it does. Then you will learn about the various parts and electronic components used to build robot. You will then assemble robot. Finally you will learn how to program and test the robot. And, as a bonus, you will learn how to build a motion detecting robot.

Snap Circuits is an educational toy that teaches electronics with solderless snap-together electronic components. Each component has the schematic symbol and a label printed on its plastic case that is color coded for easy identification. They snap together with ordinary clothing snaps. The components also snap onto a 10 X 7 plastic base grid analogous to a solderless breadboard. There are several Snap Circuits kits that range from a few simple circuits to the largest kit that includes 750 electronic projects.

All the kits include manuals printed in color with easy to follow diagrams to assemble the projects. The illustrations for each project look almost exactly like what the components will look on the base grid when finished. Because the electronic symbol is printed on each electronic component, once the project is completed, it will look almost exactly like a printed electronic schematic.

Elenco does not currently have a Snap Circuits programmable robot product. I find this surprising since Elenco has developed the Snap Circuits Rover, which is a remote controlled rover, and the Snap Circuits Micro that teaches you how program the PICAXE microcontroller and how to build circuits for the PICAXE, but Elenco has yet to develop a product that combines the PICAXE with the Snap Circuits Rover.

Here's a video of the robot running the test program (see the last step for a video of the motion detecting robot):



Parts Needed:

Software CD from the Snap Circuits XP kit or the Snap-Micro I kit (if you don’t have of these kits you can download the PICAXE Programming Editor from http://www.picaxe.com/Software/PICAXE/PICAXE-Programming-Editor/)

1 10 X 7 Plastic Base Grid
1 Snap Circuits Rover
1 9 volt Battery Block B5
1 Motor Control IC U8
1 8 Pin Socket U21 With PICAXE 08m Installed
4 1KOhm Resistors R2
1 Slide Switch S1
1 USB Programming Cable
3 Single Snaps
9 Two Snap Conductors
1 Three Snap Conductor
2 Four Snap Conductors
1 Seven Snap Conductor
1 Orange Jumper Wire
1 Yellow Jumper Wire
1 Green Jumper Wire
1 Purple Jumper Wire
1 Gray Jumper Wire
1 White Jumper Wire

Optional Parts:

1 Single Snap
1 100 Ohm Resistor R1

parts can be ordered from http://cs-sales.net/sncirepa.html

Install the PICAXE Programming Editor

The PICAXE Programming Editor is the software you will use to program the PICAXE micro-controller installed on the Snap Circuits 8 Pin Socket U14 block (the PICAXE chip carrier). The software contains the flowcharting software, the editor that you can use to write BASIC programs and the compiler for the micro-controller.

Install the PICAXE Programming Editor from the Snap Circuits XP or Snap-Micro I software CD on your laptop or desktop computer (Windows XP/Vista/7). The setup program will auto-run when you put the CD in the drive. When the dialog box for the install program appears on your screen, click the large button that says “Install the PICAXE Programming Editor software." When the install program finishes, you will see an icon on your Windows desktop that says “PICAXE Programming Editor.”

Insert the Snap Circuits USB Programming Cable into an empty USB port on your computer. Click on the PICAXE Programming Editor icon on your desktop to open the editor.

The Options dialog will automatically open (if the “Show options on startup” check box is checked). If it does not, go to View > Options. On the Mode tab, select 08M--this is your PICAXE microcontroller.

Click on the Serial Port tab and select the COM port where your USB Programming Cable is connected. Click the Ok button to go to the programming editor.

In the Programming editor click File and then click New Flowchart to start entering your flowchart. Before you start to create your flowchart, let’s take a look at some of the parts used to build your robot.
 
Remove these adsRemove these ads by Signing Up

Step 1: The Picaxe Microcontroller

Picture of The Picaxe Microcontroller
icsocket.bmp
08mpinout.bmp
The PICAXE is a micro-controller, or a computer on a microchip. It is the computer brain of your robot. It’s not as powerful as the computer in your video game console, or your laptop computer, but it does have circuits for processing, memory, logic, input and output. You can find micro-controllers in many toys, your DVD player, your TV, your microwave oven, and nowadays even in your washing machine and dryer. In your microwave, for example, the micro-controller processes what you punch in on the keypad, outputs information on the display screen, controls the cooking time, the turntable, and the bell when your dinner has finished cooking.

The Snap Circuits block (U14) that serves as the PICAXE carrier is specially labeled to more easily identify the pins on the PICAXE microcontroller chip. Think of the chip as a square bug with eight legs. There is a notch in the top to help you orient the chip and a little dot marks leg 1. Legs and pins can sometimes get confusing, but on the U14 block the legs (and the corresponding snaps the legs are connected to) are labeled in red 1-8 going in the counterclockwise direction.

Leg 1 (snap 1): This is the positive (+) voltage input. It can take from 3 volts to 5 volts. You will want to avoid putting more than 5 volts through the PICAXE since this might damage it.

Leg 2 (snap 2): S-In. Serial In pin--it is used to download your program to the PICAXE.

Leg 3 (snap 3): This pin 4! Luckily the snaps are labeled or the pin numbers could get confusing. Pin 4 can be used as an Input pin or an output pin. In the previous step this is the pin the program set to high to send current to the motor for ten seconds. Then the program set the pin low to cut the power to stop the motor from spinning.

Leg 4 (snap 4): This is pin 3. It is an Input only pin

Leg 5 (snap 5): This is pin 2. It can be used as an Input pin or an output pin

Leg 6 (snap 6): This is pin 1. It can be used as an Input pin or an output pin

Leg 7 (snap 7): This is pin 0. It is an Output only pin. It is also the Serial Out pin. This pin will also be used when downloading your program to the PICAXE.

Leg 8 (snap 8): This is GND or Negative (-) for the PICAXE.

Picture 1 source: http://cs-sales.net/pimiicinso6s.html

Picture 2 source: http://www.elenco.com/admin_data/pdffiles/SCM400.pdf

Picture 3 source: www.picaxe.com/docs/picaxe_manual1.pdf

Step 2: The Voltage Regulator

Picture of The Voltage Regulator
The simplest way to power the rover and power the PICAXE is to use two different power supplies that share a common ground. To power the PICAXE, you can use the Snap Circuits B5 block (it is also called a 9 volt Holder and Switch). The advantage to using this block is you can connect a standard 9 volt battery to the block and it will deliver a reliable 5 volts to the PICAXE through L7805 voltage regulator circuit (see circuit schematic). The B5 also has two 5 volt outputs--one to power the PICAXE and one that you can use to power another device.

Now you have a convenient way of powering your PICAXE with a reliable 5 volts from the B5 block. As a safety feature for the PICAXE, it would also be a good idea to keep the 9 volts from the rover separate from the PICAXE in case while you are building and testing the circuit something gets connected the wrong way. Thus for this build you will use an H-bridge. It has special circuitry inside it that will prevent the 9 volts from the rover's battery pack from accidentally passing through the PICAXE.

Picture source: www.snapcircuits.net/downloads/ic_info.pdf

Step 3: The H-Bridge

Picture of The H-Bridge
This is the Snap Circuits Motor Control IC, or H-bridge. At the top of the figure you can see the electronic schematic of the Motor Control block. On the lower left you can see a picture of the block. The lower center shows the function of each snap for the block and on the lower right is a description of what each snap does. The H-bridge integrated circuit (IC) is easy to use by simply applying power to a particular pin also called "setting the pin high" to drive a motor in one direction. Cutting the power to that pin and applying power to another pin will drive the motor in the opposite direction. The circuitry inside the H-bridge ICs is somewhat complicated, so most folks will choose to use an H-bridge IC rather than building the circuit themselves. The Motor Control IC will also help prevent accidentally sending 9 volts from the Rover’s battery pack through the PICAXE and frying it.

Picture source: http://www.elenco.com/admin_data/pdffiles/SCROV10.pdf

Step 4: The Snap Circuits Rover

Picture of The Snap Circuits Rover
rbot2.JPG
roversnaps.jpg
It’s time to start building your robot. There are three basic parts that you need to build a robot: a power source, a brain (the PICAXE of course) and a means of locomotion (in the case of a roving robot). The Snap Circuits Rover is one example of locomotion. It has advantages and disadvantages.

Advantages:

It is a ready-made vehicle. In other words, you don't have to build a vehicle--it is already built for you.

It has two motors, one on the right side and one on the left side. Each motor is connected to the front and rear wheels by a series of gears (the gearing was added in to slow the Rover down rather than a need for extra torque) so that the right motor turns the right front and rear wheels, and the left motor turns the left front and rear wheels. In the first picture you can see the front of the rover as well as the gears that connect the left side wheels to the left side motor.

It is designed to have the Snap Circuits base plate connected directly to it. It is also designed so that power and motor control are easily connected with Snap Circuits jumper wires.

It has a battery compartment for six AA batteries to power the motors with 9 volts.

Disadvantages:

It is not designed to have attachments such a robotic grabber arm attached to it.

You must be careful to design your circuit so that you do not accidentally pass the 9 volts from the rover's battery pack through the PICAXE microcontroller since this will most likely damage the PICAXE.

Picture 3 source: http://www.elenco.com/admin_data/pdffiles/SCROV10.pdf

Step 5: The Robot Circuit

Picture of The Robot Circuit
rbot3.JPG
rbot6.JPG
rbot5.JPG
rbot4.JPG
Let's build circuit for the robot.

Build the circuit shown in picture 1. If you want to design your own Snap Circuits diagrams go to http://www.snapcircuits.net/learning_center/designer See the photographs for the step by step build.

You'll recognize the power regulator block (B5), the PICAXE (U14), the H-bridge block (U8, labeled "Motor Control"), and the snaps for the rear of the rover. You'll also notice some new components. In addition to the snap conductors and the jumper wires, you will notice 4 1K ohm resistors.

Step 6: Program the Robot

Picture of Program the Robot
rbotprogpic.JPG
rbotcomplete.JPG
To create a new flowchart, in the Programming editor click File and then click New Flowchart to start entering your flowchart.. Use my example flowchart to make your own flowchart.

I’ve divided up each function into columns to make the flowchart easier to read. In the first column under “start” is a command to pause for 5000 miliseconds so once you switch the robot on, it will wait five seconds before proceeding through the motor tests. In the second column under the "Forward" lable are the commands to test the robot’s left forward motion. Under the "Backward" label are the commands to test the robot's backward motion. Under the label “Left Turn” are the commands to turn the robot left. And under the label "Right Turn are the commands to turn the robot right.

You can also convert the flowchart into BASIC program code. Click Flowchart and then click Convert Flowchart to BASIC. The following is what the code will look like in BASIC (I added the comments in the code to describe what the code does):

'BASIC converted from flowchart:
'C:\Documents and Settings\Desktop\dancebot.cad
'Converted on 9/9/2012 at 08:41:37

main:
  pause 5000           'Wait five seconds before proceeding
label_C1:                 'begin loop
                                   'FORWARD
  high 0                     'switch left forward motor on
  high 2                     'switch right forward motor on
  pause 500             'Wait .5 seconds before proceeding
  low 0                       'switch left forward motor off
  low 2                       'switch right forward motor off
                                   'BACKWARD
  high 1                      'switch left backward motor on
  high 4                      'switch right backward motor on
  pause 500              'Wait .5 seconds before proceeding
  low 1                        'switch left backward motor off
  low 4                        'switch right backward motor off
                                    'RIGHT
  high 0                      'switch left forward motor on
  high 4                      'switch right backward motor on
  pause 500              'Wait .5 seconds before proceeding
  low 0                        'switch left forward motor off  
  low 4                        'switch right backward motor off
                                    'LEFT
  high 1                      'switch left backward motor on                      
  high 2                      'switch right forward motor on
  pause 500              'Wait .5 seconds before proceeding
  low 1                        'switch left backward motor off
  low 2                        'switch right forward motor off
  goto label_C1       ' end loop

The code is very simple but should demonstrate how easy it is to program the robot.

To run the program, make sure the Snap Circuits Slide Switch S1 is switched off else the left motor might turn while the program is still downloading to the PICAXE and may accidentally disconnect the programming cable as the robot to turn right. Next, make sure that the Snap Circuits 9 volt Battery Block B5 is switched on or the program will not download to the PICAXE. Connect the Snap Circuits USB Programming Cable to your computer.

1.  Connect the orange snap to the S-In snap on the 8 Pin Socket U14 block (the PICAXE chip carrier).

2.  Connect the yellow snap to the S-Out snap on the 8 Pin Socket U14 block (the PICAXE chip carrier).

3.  Connect the black snap to the GND, or negative (-) snap on the 8 Pin Socket U14 block (the PICAXE chip carrier).

In the Programming Editor click PICAXE and then click Program. A status bar will display to show the progress of the download of the program to the PICAXE.

Wait a moment after the program finished downloading and disconnect the programming cable.

To save the program in the PICAXE memory, place the optional single snap on the S-In snap of the PICAXE block and connect the optional 100 Ohm Resistor R1 between S-In and GND (see picture 3).

Place the robot on the floor a safe distance from any obstacles. Then switch the Snap Circuits Slide Switch S1 to on. When you are ready to watch the motor tests, switch on the Snap Circuits 9 volt Battery Block B5 and watch the robot perform the motor tests.

Step 7: Bonus Robot Circuit!

Picture of Bonus Robot Circuit!
motionbotstep1.JPG
motionbotstep2.JPG
motionbotstep3.JPG
motionbotstep4.JPG
dancebot1.bmp
Now that you're familiar with building and programming a robot made out of Snap Circuits, it's time to start thinking about how to make the robot do something more interesting than just testing the motors on the Snap Rover.

It would be nice if your robot could respond to external stimulus. Fortunately, since we used the battery holder block from the Snap Circuits motion detector set, we can use the PIR sensor (the block labeled "Motion Detector U7") and transistor from the same set to build a motion detecting robot.

Parts needed for this build:

1 10 X 7 Plastic Base Grid
1 Snap Circuits Rover
1 9 volt Battery Block B5
1 Motor Control IC U8
1 8 Pin Socket U21 With PICAXE 08m Installed
4 1KOhm Resistors R2
1 Slide Switch S1
1 USB Programming Cable
1 Motion Detector Block U7
1 NPN Transistor Q2
1 Green LED D2
9 Single Snaps
11 Two Snap Conductors
2 Three Snap Conductors
1 Four Snap Conductor
3 Five Snap Conductors
1 Six Snap Conductor
1 Seven Snap Conductor
1 Orange Jumper Wire
1 Yellow Jumper Wire
1 Green Jumper Wire
1 Purple Jumper Wire
1 Gray Jumper Wire
1 White Jumper Wire

Optional Parts (so you can save the program in the PICAXE memory):

2 Single Snaps
1 100 Ohm Resistor R1

Build the robot according to the steps shown in the photographs

In the first circuit, we used all four of the output pins on the PICAXE to drive the Snap Rover motors. There are only two pins left--both of which are input pins--the serial in (S-In) and pin 3. I decided to use pin 3 as the input pin for the Motion Detector block. See picture 1 for the circuitry built inside the Motion Detector block. Though the circuitry looks complicated, there are only three snaps on the Motion Detector block: Positive (+), OUT, and Ground (-). I adapted the following circuit for the motion detecting robot so that I could light up an led when the motion detector detected motion to make the robot easier to program (the LED lights up whenever the motion detector detects motion then all I had to do was look at the voltage on pin 3 to differentiate between when no motion was detected and when motion was detected) :

www.elenco.com/admin_data/pdffiles/LED_Motion_Detector.pdf


While writing the program for the motion detecting robot I noticed that pin 3 had current on it while the LED was off (no motion detected), but was pulled down to 0 volts when the motion detector detected motion and the LED lit up. This serendipitously made programming much easier. All I had to do was tell the program to wait, or do nothing, until pin 3 to dropped to 0 Volts and then proceed to the motor tests. 

Take a look at the modified flowchart in picture 2. You'll notice the same set of motor tests "Forward", "Backward", "Left Turn", and "Right Turn". The "Pause 5000" block has been replaced with the following:

let b0=1 I added this to make sure that the variable b0 is greater than zero so the program did not accidentaly go through the motor tests before the motion detector detected any motion.

let b0=pins assigns the value of pins (in this case the input port, pin 3) to the variable b0. When no motion detected, "pins" has a value greater than zero (actually the value on my PICAXE pin 3 in this circuit equals 8, go figure). When motion is detected, pins has a value of zero.

The decision diamond says the following:

If b0=0 (motion detected) then proceed through the motor tests and when the motor tests are completed go back to the beginning of the program.

If b0 has any value other than zero, simply go back to the beginning of the program.

So, the robot will just sit there until the motion detector detects motion.



Picture 1 source: www.snapcircuits.net/downloads/ic_info.pdf

ToXiCATOM1 year ago
Cool instructable bro!!!!
nice, have you ever committed any of these snap circuit projects to a pcb?