Wednesday, August 17, 2011

VistaQuest VQ1005 Controlled by TI MSP430 LaunchPad

We show you how.

There are a lot of things about the TI MSP430 that I like. First of all, the price from TI is crazy cheap at $4.30!!! Hats off to TI for making their development kit so inexpensive that anyone who even wants to casually experiment with micro-controllers can do so. Even though it only cost $4.30, the MSP430 LaunchPad is a very capable micro-controller and the free SDK (Code Composer Studio) used to program the MSP430 is nice as well.

Long ago I broke open a VistaQuest VQ1005 and used a 555 timer to snap pics automatically. I wanted to replace the 555 timer with the TI MSP430 LaunchPad because 1) it would allow more programmable control over the delay between pics and 2) the additional I/O on the MSP430 would allow me to get around the VistaQuest VQ1005 wanting to go to sleep after 60 seconds on inactivity.

The integration of the VistaQuest VQ1005 to the MSP430 LaunchPad is one that is cheap and easy given some guidance. If you are looking for a uC project to get your feet wet, this hack is sure to work and will cost less than twenty bucks if you watch for deals on the VistaQuest VQ1005. By now almost every household has an old digital camera around, so it's easy to substitute an old 'free' camera for the VistaQuest VQ1005 if you want. The integration concept to the MSP430 LaunchPad is the same.

First, get a TI MSP430 LaunchPad from here and a VisaQuest VQ1005.

They will look like this:

If you don't know which is the MSP430 LaunchPad and which is the camera then you can stop reading now...

The first thing I did was solder header pins to the Vcc, GND, P1.5, and P1.7 "holes" on the MSP430 LauchPad. We are going to be connecting wires from the camera to those places. If you want, you can just solder the wires from the camera straight into the holes, but the header pins will allow you to unplug the camera from the MSP430 LaunchPad if you ever so desire.

Next open up the VistaQuest VQ1005. This is easy. You will remove four small screws on the outside case. Once inside you will see two PCB boards. The trigger board (the board that presses the button to take the pic) looks like this:

See the red circle labeled "T"? Solder a thin wire to that location. This is the trigger wire that will ultimately be connected to P1.5 on the MSP430 LaunchPad. We are going to use the MSP430 to bring this wire LOW (zero volts) to take a pic. Don't worry, the code to do this and more pics are below to help you with this.

Now we want to remove the VistaQuest VQ1005 "ON/OFF" control PCB. This is the same PCB that holds the camera lens and is attached with two small screws. Remove the screws and remove the PCB. See the red circle labeled "O" in the pic below? This is the "ON/OFF" control point. Solder a wire to that point. This wire will ultimately connect to P1.7 on the MSP430 LaunchPad. We are going to use the MSP430 to bring this wire LOW (zero volts) to make sure the camera is ON and ready to take a pic. Again; don't worry, the code to do this and more pics are below to help you with this.

Put the VistaQuest VQ1005 camera back together. It's as simple to put together as it was to take apart. Be careful not to pull off the wires you just soldered to the two PCBs. Depending on how you route your wires you may have to make a notch or two in the camera case.

We are almost done. See the pics below to guide you through how to connect up the VistaQuest VQ1005 to the MSP430. As you can see, I powered the whole operation with two AA batteries (3VDC). The one nice thing about the LaunchPad is that it has a USB port input that you could use to provide the power for the project. Basically, you would remove the two AAs and use your USB port to power the rig.

The pic below shows the (T)rigger wire from the VistaQuest VQ1005 attached to the MP430 LaunchPad P1.5 output pin. Also, the +3VDC power from the two AAs connected to the Vcc header pin we soldered to the MSP430 LaunchPad.
Below is a shot of the (O)n/(O)ff control wire from the VistaQuest VQ1005 attached to the MSP430 LaunchPad P1.7 output pin. You can also see the black wire that goes to the NEG terminal of the 3VDC AAs. Note that at the bottom right I have used the Vcc and GND header pins that were already on the MSP430 LaunchPad to power the VistaQuest VQ1005 camera. These wires simple go to the "+" and "-" place on the VistaQuest VQ1005 where the battery would connect. BTW, I know the VistaQuest VQ1005 uses one 1.5VDC battery to power it and we are pushing 3VDC into it. Don't worry about that, the VistaQuest VQ1005 has the smarts to handle this.

Below is a pic of the two AAs that provide the 3VDC power. The battery pack is held onto the MSP430 LanchPad with Velcro.

In the end it should all look something like this:
We tested on location where our cats relax in the sun. We used the 1000+ images that the rig took and made this short video:

Let us know if you give this a try and what your results are. Good luck, have fun. Please reference www.WhiskeyTangoHotel.Com if you found this useful.

Oh, one more thing... The code below makes it all happen.

The code flashes the red LaunchPad LED during camera power up.
The code flashes the green LaunchPad LED when a pic is taken.
The code alternates flashing the green and red LED as it waits to take the next pic. The LEDs alternate more rapidly as the VistaQuest VQ1005 gets closer to taking the next pic.

Modify it if you want.

////////begin MSP430 Code//////////

// This program interfaces the MSP430 Laucnpad uC dev board
// to a VistaQuest VQ1005 Digital Keychain Camera.
// This allows to camera to take picutes at pre-defined intervals
// automatically without any manual interaction.

// Cost: MSP430 Launchpad: $4.30 from Texas Instruments
// VistaQuest VQ1005: $5-10 from Walmart, eBay, etc

// Developed at: / August 2011 / Open Source, use and modify

#include msp430g2231.h

void main(void)
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= BIT0; // Set Red LED (P1.0) to output direction
P1DIR |= BIT6; // Set Green LED (P1.6) to output direction
P1DIR |= BIT5; // Set Camera Trigger (P1.5) to output direction (Low is Take pic)
P1DIR |= BIT7; // Set Camera ON/OFF control (P1.7) to output direction (active LOW)

volatile long i; // General loop var
volatile long j; // General loop var

volatile long d; // d is delay between pics
d = 15000; // set the value of d per guidelines below
//d = 10000; about 15 secs between pics
//d = 15000; about 35 secs between pics
//d = 20000; about 60 secs between pics
//d = 40000; abput 4.5 mins between pic
//increase d for longer delay between pics

P1OUT |= BIT5; //need to start with tigger high (because LOW triggers camera

for (;;) // Start of Endless Loop

P1OUT &= ~(BIT0 + BIT6); // both LEDs off

P1OUT &= ~BIT7; // Force low to turn on camera
for (i=0; i<5 data-blogger-escaped-br="br" data-blogger-escaped-i="i"> { // Delay some while camera 'boots'
P1OUT ^= BIT0; // Flash/Toogle Red LED while 'booting'
for (j=0; j<2000 data-blogger-escaped-br="br" data-blogger-escaped-j="j"> } //

P1OUT |= BIT7; // Return camera control to High
for (i=0; i<5 data-blogger-escaped-br="br" data-blogger-escaped-i="i"> { // Delay some just 'because'....
P1OUT ^= BIT0; // Flash/Toogle Red LED while delaying
for (j=0; j<2000 data-blogger-escaped-br="br" data-blogger-escaped-j="j"> } //

P1OUT &= ~(BIT0 + BIT6); // both LEDs off

// Blink the Green LED to show a pic is being taken
// and allow some delay for disk write, etc.
P1OUT &= ~BIT5; // Drive Trigger signal low to take pic
for (i=0; i<100 data-blogger-escaped-br="br" data-blogger-escaped-card="card" data-blogger-escaped-delay="delay" data-blogger-escaped-etc.="etc." data-blogger-escaped-i="i" data-blogger-escaped-pic="pic" data-blogger-escaped-process="process" data-blogger-escaped-save="save" data-blogger-escaped-sd="sd" data-blogger-escaped-some="some" data-blogger-escaped-to="to"> {
P1OUT ^= BIT6; // Blink the Green LED
for (j=0; j<2000 data-blogger-escaped-br="br" data-blogger-escaped-j="j"> } // end Green Blink/delay for pic
P1OUT |= BIT5; // return tigger to high (because LOW triggers camera)

P1OUT &= ~BIT0; // Turn off Red LED and
P1OUT |= BIT6; // Green LED ON to set up for alternating Red/Green flash rountine below
// The loop below alternates the LaunchPad Green/Red LEDs; speeding up until pic is taken
// Time between pics is define by the value of "d" set above

for (j=1; j {
P1OUT ^= BIT0 + BIT6; // Toggle LEDs
for (i = 1; i<(d-j); i++); // A decreasing delay to make LEDs alternate faster until trigger
} //end loop that alternates the LaunchPad Green/Red LEDs

} // end of endless loop
} //main