Introduction: Hacking the Spy Video Trakr II

Picture of Hacking the Spy Video Trakr II

In the previous Instructable, "Hacking the Spy Video Trakr" (https://www.instructables.com/id/Hacking-the-Spy-Video-Trakr/), you learned how to open up the Trakr and install male headers in the GPIO connections on the circuit board. You also learned how to write, compile, and install a short program on the Trakr to flash LEDs by pressing the A and B buttons on the Trakr remote. Of course, getting the Trakr to flash LEDs isn’t very interesting, but now that you’ve completed your first Trakr hack, you can try more sophisticated hacks.

The voltage output directly from the GPIO pins is only 3.3 volts so, there aren’t many devices other than LEDs that you can drive with such low voltage. If you wanted to control, say, a Lego motor that runs on nine volts, you would need a nine volt voltage source yet prevent accidently sending nine volts through the Trakr’s processor and frying it.

When deciding what kind of circuit to connect to the GPIO pins, always apply the maxim, “Keep It Simple, Stupid” (KISS). If, for example, you wanted to drive a single motor in only one direction, the simplest device to keep a higher voltage source–the one used to drive a motor–from accidently passing through the Trakr’s processor is an electronic relay. This Instructable will demonstrate how to use a relay to control an external device with the Spy Video Trakr. You'll learn how an electronic relay works, what the electronic scematic diagram for a relay looks like, and what an actual electronic circuit diagram in which the relay is used looks like. You'll learn how to make conversion cables to connect the Trakr to external devices. You'll learn how to make  a larger cargo deck for the Trakr and see some examples of how some devices can be mounted on the Trakr. You'll learn how to tap into the Trakr's 9 volt and five volt power supplies. Finally you'll learn how to use the electronic relay to control an foam dart missile launcher.

Step 1:

Picture of

What’s a relay? You’ve probably seen a relay race where one runner hands off a baton to another runner. Similarly, an electronic relay hands off control from one circuit to another. A relay is a very simple device consisting of an electromagnet, an armature (a switch that closes when attracted by the electromagnet), and a spring that is connected to the armature. You can see in the diagrams (Source: How Stuff Works) how the relay works.

In Figure 1 of the diagram, there are two circuits. The first circuit is a battery (3 volts), a switch and an electromagnet. The second circuit is a battery (6 volts), a light bulb and the relay’s armature. While the switch to the electromagnet is off, no current can flow from the 3 volt battery through the electromagnet. So, the armature-switch is off and no current can flow from the 6 volt battery to power the lamp in the second circuit.

In Figure 2 the switch to the electromagnet circuit is switched on. When current from the 3 volt battery flows through the electromagnet, the electromagnet creates a magnetic field that attracts the armature to close the circuit to the lamp. Now current can flow from the 6 volt battery to the lamp, and the lamp lights up.

If you look closely at Figure 2, you’ll notice that while the armature-switch is closed allowing the current in the lamp circuit to flow from the 6 volt battery to the lamp, it does not come into contact with the electromagnet so, the 6 volts from the lamp circuit cannot flow into the electromagnet circuit. Thus, the 3 volts in the electromagnet circuit and the 6 volts in the lamp circuit remain separate.

Step 2:

Picture of

This is the electronic schematic diagram of a relay. The curly line represents the electromagnetic coil and the vertical lines represent the metal core the coil is wrapped around. The switch at the top of the diagram represents the armature.

Step 3:

Picture of

This is the electronic schematic of the circuits from figures 1 and 2 above.

Step 4:

Picture of

Since the Spy Video Trakr is a toy recommended for ages eight and older, this Instructable is designed for kids to try. Where ever possible I’ve tried to use alternatives to soldering and hot glue. Among the solderless alternatives selected for this Instructable are Snap Circuits.

Snap Circuits by Elenco is an educational toy that teaches folks about electronics with solderless snap-together electronic components. Each electronic component has the electronic schematic symbol and a label printed onto its plastic case that is color coded for easy identification. They snap together with what appear to be ordinary clothing snaps—hence the name Snap Circuits. The components also snap onto a 10 X 7 plastic base grid, which is 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.

Step 5:

Picture of

At the top of the picture you'll see the Snap Circuits relay. At the bottom of the picture you'll see three Snap circuits conversion cables that I have made. The cable on the left is a USB to Snap Circuits cable so that I can power motors and other devices up to five volts. The center cable is a header pin to Snap Circuits cable so that I can connect a Snap Circuits block directly to the GPIO header pins on the Trakr's circuit board. The cable on the right is a Snap Circuits to Lego cable so I can connect a Snap Circuits block to a Lego motor. They were easy to make.

I simply cut Snap Circuits jumper wires in half, removed about 1/2 inch of insulation from the jumper wire and the wires I wanted to connect them to, twisted the wires together, and covered them with shrink tubing to prevent short circuits from the exposed wire. These are temporary for now but can be made permanent with Wire Glue: http://www.wireglue.us/

I'm waiting for my jar of Wire Glue to arrive in the mail as I am writing this, so I'll have to wait until I can test the stuff.

Step 6:

Picture of

Next you'll want to design a way of mounting the devices you want to control on to the Trakr. This deck was made from Lego technic beams.

Step 7:

Picture of

This is the Lego Deck disassembled. I discovered that Lego cross axles fit snugly into the the mounting holes for the plastic deck that came with the Trakr.

Step 8:

Picture of

This picture shows the Lego cross inserted into the mounting holes for the plastic payload deck that came with the Trakr. I find that the holes in the Lego Technic beams are very versitile and allow me to mount many kinds of external devices. Don't worry if you don't have any Legos. There are many ways to attach various devices to the Trakr.

Step 9:

Picture of

Here's an example of a camera mount. (Courtesy of Trakr Hackr codenamed "Hagbard")

Step 10:

Picture of

Here's a mount for flashlights. (Courtesy of Trakr Hakr codenamed "Bannerbill")

Step 11:

Picture of

Yep. That's an Airsoft pistol mounted on the Trakr. (Courtesy of Trakr Hakr codenamed "Trakr Dude")

This project is for kids to try and I'm using alternatives to soldering and hot glue (we don't want kids burning themselves, branding the cat nor setting the drapes on fire).

An alternative to soldering is Wire Glue.

An alternative to hot glue is sugru.

Both Wire glue and sugru are recommended for ages 10 and older with adult supervision. Girls Scouts and Boy Scouts earn their Electronics Merit Badges by learning how to solder, and soldering irons are also recommended for ages 10 and older with adult supervision.

Federal Law requires a person be age 18 or older to purchase an airsoft gun. Airsoft also requires proper impact rated goggles or glasses to protect the eyes. With an airsoft pistol mounted on a Trakr in this configuration, it would be diffcult to determine from the Trakr's video feed whether or not a person is wearing eye protection. DO NOT fire an airsoft weapon at persons or pets as it could result in severe injury.

Even though this project demonstrates the use of sugru, Wire Glue, and Snap Circuits as safer alternatives to hot glue and soldering, this does not let parents and guardians off the hook from supervising kids who want to hack their Trakrs.

Step 12:

Picture of

Once you've decided on what external device you want to control and how to mount it on the Trakr, you are ready to begin designing the circuit.

In this example, I'm using the missile platform from a USB laser guided missle launcher.

In the platform there is a single motor that turns in one dirction to rotate a cam shaft that launches all three missiles in one after the other.

Since I only have to drive one motor in one direction, I can use an electronic relay.

Step 13:

Picture of

Next you'll want to add a common ground for your projects. Since you'll have the Trakr opened up anyway, might as well add a 9 volt power tap the the positive solder point on the Trakr. Use the same process as making Snap Circuits conversion cables. I had a red Snap Circuit jumper wire half and a black Snap Circuit jumper wire half left over.

You can solder or Wire Glue the black Snap Circuit jumper wire half to the ground or negative solder point on the Trakr's circuit board. It is where the black wire from the battery pack is soldered to the Trakr's circuit board.

You can solder or Wire Glue the red Snap Circuit jumper wire half to the 9 volt or positive solder point on the Trakr's circuit board. It is where the red wire from the battery pack is soldered to the Trakr's circuit board.

(Note: Wire Glue will also work if you want to use it to permanently connect the male header pins to the GPIO connections)

Step 14:

Picture of

Now that a common ground is avaialble, at least two power sources are available from the Trakr: the 9 volts from the Trakr's battery pack and five volts from the USB. The USB missile launcher only requires 5 volts so, I can use my USB to Snap Circuit adapter cable to power the rocket launcher motor.


The Snap Circuit relay will power on at 3 volts as you can see in the following video:

http://player.vimeo.com/video/33376632

Often when using electronic relays in circuits it is recommended that you insert a flyback diode to protect sensitive electronics. The magnetic coil in the relay stores electricity like a capacitor and when the voltage is cut from the coil the current can flow back into the circuit--back to the GPIO pins. I've built this simple circuit to demonstrate what I mean. You may have to wait a moment for me to dim the lights a bit to see the led flash, but when I push the button, this engages the electromagnet in the relay and you may be able to hear the relay click on. When I release the button this cuts off the voltage to the relay (you may be able to hear it click off) and the magnetic field collapses and the current flows back into the circuit causing the LED to flash.

http://player.vimeo.com/video/32551898

Fortunately the voltage is so low you will not need to insert a flyback diode.

For some reason, however, there just isn't enough current from one GPIO line to get the relay's armature to close so, we have to add two GPIO lines. This is definitely a kludge, yet nontheless will demonstrate how to use a relay with the Trakr. In the schematic you will see that there are two GPIO lines connected to the positive side of the relay coil. I used the GPIO to Snap Circuit conversion cable that I made. The negative side is connected to the Trakr's negative or ground using the black Snap Circuit jumper wire half that is soldered/Wire Glued to the Trakr's circuit board. Those are all the connections on the Trakr side of the relay.

On the missile launcher side, 5 volts from the USB is connected to the relay's switch. I used the USB to Snap Circuit conversion cable that I made. The negative cable from the USB is connected to the Trakr's ground or negative black Snap Circuit jumper wire half. The positive side of the rocket launcher motor is connected to the relay's switch and the negative side of the rocket launcher motor is connected to the Trakr's ground or negative black Snap Circuit jumper wire half.

Step 15:

Picture of

Here's the Trakr side of the relay with the two GPIO lines connected to the positive side of the relay coil. I used the GPIO to Snap Circuit conversion cable that I made. The negative side is connected to the Trakr's negative or ground using the black Snap Circuit jumper wire half that is soldered/Wire Glued to the Trakr's circuit board.

Step 16:

Picture of

Here's a picture of the missile launcher connected. 5 volts from the USB is connected to the relay's switch. I used the USB to Snap Circuit conversion cable that I made. The negative cable from the USB is connected to the Trakr's ground or negative black Snap Circuit jumper wire half. The positive side of the rocket launcher motor is connect the the relay's switch and the negative side of the rocket launcher motor is connected to the Trakr's ground or negative black Snap Circuit jumper wire half.

Step 17:

Picture of

Here's the missile launcher platform mounted on the Lego deck. The pegs that stick out from the bottom fit the Lego technic beam holes so, the platform needed no further modification to connect it to the Lego Deck.

Below is the C Langusage source for the Trakr App:

                                 ////////////////////////////////////////////
                                 //relaycontrol app for Spy Video TRAKR.
                                 //Program scans to see if button A was
                                 //pressed on TRAKR remote and sets GPC0 high
                                 //and GPC1 high to send current through
                                 //a relay's electromagnetic coil. This will
                                 //activate the relay's switch closing the
                                 //circuit of an external device.
                                 ///////////////////////////////////////////

#include "svt.h"                 //include Official API
#include "JAPI.h"                //include "Secret sauce" API

#define GPC0 (1<<0)              //bitmask for pin GPC0 = 00000001
#define GPC1 (1<<1)              //bitmask for pin GPC1 = 00000010
#define GPC2 (1<<2)              //bitmask for pin GPC2 = 00000100
#define GPC3 (1<<3)              //bitmask for pin GPC3 = 00001000
#define GPC4 (1<<4)              //bitmask for pin GPC4 = 00010000
#define GPC5 (1<<5)              //bitmask for pin GPC5 = 00100000
#define GPC6 (1<<6)              //bitmask for pin GPC6 = 01000000
#define GPC7 (1<<7)              //bitmask for pin GPC7 = 10000000

int keyState;                    //define "keystate" as integer

void Start()
{
JAPI_SetIoOutputMode(GPC0+GPC1);//Set output mode for pins GPC0 and GPC1
}
bool Run()
{
    keyState=GetRemoteKeys();    //TRAKR remote control key pressed
                                 //assign to keystate
    if (keyState > 0)
     {                           //if keystate is greater than 0
       if(keyState&KEY_INPUT1)
        {                        //Button A pressed
            JAPI_SetIoHigh(GPC0+GPC1);//Set GPC0 and GPC1 pins high (3.3v)
         } else {
            JAPI_SetIoLow(GPC0+GPC1); //Switch off pins GPC0 and GPC1
        }
       if(keyState&KEY_HOME)
        {                        //if Home button pressed
         return false;           //this will end the loop
        }
    }
    return true;                 //loop will repeat until false
}
void End()
{                                //Program end - switch off both pins
JAPI_SetIoLow(GPC0+GPC1);
}


And next is the Make file:

# Makefile for TRAKR Toy
# Trakr Project

TRACKR_PATH = C:/Trackr
PROGRAM_NAME = relaycontrol
PRETTY_NAME = relaycontrol
OUTPUT_PATH = ./Intermediate
OUTPUT_NAME = $(OUTPUT_PATH)/$(PROGRAM_NAME).elf
INTERNALS_PATH = ../Internals

SOURCES = app.c
S_OBJECTS = $(OUTPUT_PATH)/app.o

OBJECTS = $(S_OBJECTS) $(INTERNALS_PATH)/trakr.a

SHELL = sh
CC    = arm-elf-gcc
AS    = arm-elf-as
BIN = arm-elf-ld
LD    = arm-elf-ld

TOPMEMORY=0xFFE7C000
CFLAGS = -O0 -I../Internals/Include -I../Internals -Wall -gstabs+ 
TARGET_FLAG = -mcpu=arm926ejs -mapcs-32 -mlittle-endian -specs=specs.semi 
LDFLAGS = -T ../Internals/WJ_APP_8M.ld -Wl,--defsym -Wl,__stack_base=$(TOPMEMORY) -Wl,-Map -Wl,$(basename $@).map -nostartfiles -static 

all: prebuild $(OUTPUT_NAME) postbuild

$(OUTPUT_NAME): $(OBJECTS)
   @echo "Linking... "
   @echo "Creating file $@..."
   @$(CC) -u _start -o $@ $(INTERNALS_PATH)/trakr_start.a $(OBJECTS) $(TARGET_FLAG) $(LDFLAGS)

$(OUTPUT_PATH)/app.o:app.c Makefile
   @echo "Compiling $<"
   @$(CC) -c -o "$@" "$<" $(TARGET_FLAG) $(CFLAGS)

.PHONY: clean prebuild postbuild

clean:
   $(RM) -f $(PROGRAM_NAME).bin
   $(RM) -f "$(PRETTY_NAME).bin"
   $(RM) -f $(OUTPUT_PATH)/app.o
   $(RM) -f $(OUTPUT_NAME)
   $(RM) -f $(MKDEPFILE)

postbuild:
   arm-elf-objcopy -O binary $(OUTPUT_NAME) "$(PRETTY_NAME).bin"
   @if [ -d "E:/" ] ; then \
      cp "$(PRETTY_NAME).bin" e:/APPS/ ; \
    fi  
prebuild:
  



# End of Makefile

Step 18:

Congratulations! In this Instructable will you learned how to use a relay to control an external device with the Spy Video Trakr. You learned how an electronic relay works, what the electronic scematic diagram for a relay looks like, and what an actual electronic circuit diagram in which the relay is used looks like. You learned how to make conversion cables to connect the Trakr to external devices. You learned how to make  a larger cargo deck for the Trakr and see some examples of how some devices can be mounted on the Trakr. You learned how to tap into the Trakr's 9 volt and 5 volt power supplies. You also learned how to use the electronic relay to control an foam dart missile launcher.


Here are some additional resources you might find useful when hacking the Spy Video Trakr:

Spy Video Trakr Wiki

http://www.trakrhakr.com/wiki/index.php?title=Main_Page

Official Spy Video Trakr forums:

http://www.spygear.net/forum/viewforum.php?f=18

Fun With Snap Circuits Hacks:

http://funwithsnapcircuits.wordpress.com/2011/03/17/and-now-for-something-completely-different/

Disobedient Tiger hacks:

http://disobedienttiger.blogspot.com/search/label/Spy%20Trakr

Hack a Day First Hack:

http://hackaday.com/2010/09/02/spy-video-trakr-software-and-first-hack/

FCC REFERENCE (CIRCUIT DIAGRAMS, EXTERNAL PICTURES, INTERNAL PICTURES):

FCC reference for Trakr remote:

https://fjallfoss.fcc.gov/oetcf/eas/reports/ViewExhibitReport.cfm?mode=Exhibits&RequestTimeout=500&calledFromFrame=N&application_id=545152&fcc_id='N3ESPYVIDEOTRAKR1'

FCC reference for Trakr:

https://fjallfoss.fcc.gov/oetcf/eas/reports/ViewExhibitReport.cfm?mode=Exhibits&RequestTimeout=500&calledFromFrame=N&application_id=884190&fcc_id='N3ESPYVIDEOTRAKR2'



OTHER REFERENCE MATERIAL:

W55VA91 Design Guide:

http://docs.google.com/viewer?url=http%3A%2F%2Fdl.dropbox.com%2Fu%2F4295670%2FW55VA91_DesignGuide%2528fullset%2529%2520-%2520A4.pdf

nRF24L01 (Radio Transceiver Chip):

http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01

ARM926EJ-S Technical Reference Manual:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0198e/index.html

W9864G6IH 8 MByte SDRAM:

http://www.winbond.com/hq/enu/ProductAndSales/ProductLines/SpecialtyDRAM/SDRAM/W9864G6IH.htm



HARDWARE SPECIFICATIONS:

Two ARM 9 processors (Nuvoton W55VA91: ARM926EJ core running @ 192 MHz, and hardware-assisted JPEG codec)
8 MB of on-board RAM – for sophisticated, memory-intensive, user-generated apps (programmed in C).
SD card slot – for removable, high-capacity program, video, audio and image storage.
Accessible USB host port – for connection of USB devices.
USB device port – for connecting to a computer for reprogramming and communication.
Omni Vision VGA camera – potential frame rate of 30 frames a second (the TRAKR is set for 15 fps). (Enables programming for real-time image processing.)
Nordic 2.4 GHz radio – for low-power wireless communication.
Dual, high current (2A) H-Bridges with current sensors – enables advanced motor control.
QVGA screen & speaker on remote with 5 buttons and 2 joysticks – potential to be reassigned for different tasks.
Audio block with polyphonic synthesizer – includes support for speech synthesis.
Operating System:Lunix OS
IR LED is illuminated by switching on an SS8050 transistor.
FLASH/SPI/USB Boot


BLEEDING EDGE TRAKR HACKING:

http://www.trakrhakr.com/wiki/index.php?title=Bootstrapping

http://www.trakrhakr.com/wiki/index.php?title=I2C_library

Comments

vov35 (author)2012-02-07

Use a MOSFET. get $3, go to radioshack, look in the bin labeled "transistors".

You'll never go back to mechanical switching again.

KRA5H (author)vov352012-02-10

Thanks for the comment. I do use the L7805 in my project: Dance Dance Roverbot! Build a Light Activated Dancing Snap Circuits Programmable Robot.

https://www.instructables.com/id/Dance-Dance-Roverbot-Build-a-Light-Activated-Danc/step8/The-Voltage-Regulator/

vov35 (author)KRA5H2012-02-10

The 7805 is a voltage regulator, I'm trying to get you to buy some power transistors for switching reasons. :p

MOSFETs have electrically insulated gates so you won't damage your microcontroller, and they will allow you to control a significant amount of electrical power using a very small voltage and almost no current.

I know they look the same as far as plastic package/ three pins goes, but they're completely different solid state devices.

To help you understand, here's a sample circuit from the wikipedia page https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Mosfet_n-ch_circuit.svg/220px-Mosfet_n-ch_circuit.svg.png
I'll leave you to your own devices for research from there.

pu55ydestroyer101 (author)2011-12-16

Enter your question hereEnter your question hereEnter your question hereEnter your question hereEnter your question hereEnter your question hereEnter your question hereEnter your question hereEnter your questio

myfcr (author)2011-12-13

have you tried using an optocoupler?

freeza36 (author)2011-12-13

Where is the foam in this instructable?

KRA5H (author)freeza362011-12-13

The foam darts taht the missile launcher fires.

freeza36 (author)KRA5H2011-12-13

cool instructable by the way

freeza36 (author)KRA5H2011-12-13

Oh ok i see now

mikeasaurus (author)2011-12-13

Mobile platform for all kinds of awesome!
(Also, you should enter this into the foam challenge!)

About This Instructable

7,483views

25favorites

License:

Bio: You can try my projects AT YOUR OWN RISK. There's infinite ways to damage or destroy persons and property. I can't think of ... More »
More by KRA5H:Laser Tyndall EffectDiscover Electronics With Snap Circuits Arcade (A Review)Variable Speed Fan With Snap Circuits, Kano Computer
Add instructable to: