Saturday, March 19, 2011

How to Make a Decent Splice



Sometimes you need to shorten an existing cable by removing a section and reconnecting the two ends. Other times you might need to lengthen a cable by adding one or more sections. If you're doing this to a multi conductor cable, it's best to use the "Western Union" splice my grandfather taught me. This type of splice won't short-out (the condition in which conductors touch) if the insulation on your joint fails.

You will want to strip two to three times as much of the outer insulation as you normally would. On one end cut the red wire short, and the white wire long. On the other end cut the red wire long and the white wire short. Cut some heat-shrink tubing to go over the inner conductors. Also cut a larger piece to go over the whole thing, slide it over one or the other of the pieces of cable, and slide it well out of the way. Don't forget to do this, because after you've made the connection, you won't get be able to do get the heat-shrink onto the cable. Now cut some smaller heat-shrink tubing for the inner conductors and slide them over each of the longer wires. Make sure these are far away from the joint so the heat from soldering won't shrink them and prevent them from fitting over the joint.

Twist the wires together facing each other such that the joint isn't much thicker than the original wire. If you twist them facing the same direction (like a zipper), you might not be able to get the heat shrink over them, and if you do, the tubing will look like a python that's swallowed a pig. If the conductor is going to poke through the heat-shrink and cause a short, it's going to be where it's stretched thin over the big solder blob.

Like this:



Not like this:

Apply heat, then solder to the joints. After the joints have cooled, slide the heat shrink over them and apply heat. After that's cooled down, slide the large heat-shrink over the whole thing and apply heat to complete the job.

Sunday, March 13, 2011

Time Lapse Photography - Phase 1

The first step was to get the hardware ready.

To find the power, focus and shutter switches on this old camera, I disassembled it screw-by-screw. I only shocked myself once on the flash capacitor. I thought I'd never get the camera back together. It might have been better to have ground away the buttons with my Dremel tool. The nice thing about this camera is that when connected to and external 3.3 v power supply it never goes to sleep. This way it doesn't lose settings like "no flash" and the lens does not have to be extended for each frame. If make a 10 minute movie, that would be 18,000 frames. I'd guess that's pretty much the life of that mechanism. Now I wonder about the shutter and focus mechanism. How long will it last?

To use the camera, first touch the two "on" button wires together.
To focus, hold the brown and blue wire together.
To snap a frame, touch the white wire to the brown and blue.


This is the board with four relays that I made. It'll control the camera with one relay to spare. I made it generic as possible. I think the Arduino could probably have driven the relays, but I used some 2N2222 transistors anyway. The funny thing about these relays is that they have polarity. I thought maybe they had an internal protection diode, but when I ohmed it out, it was about 120 ohms both ways. I read up on this type of relay, and I think the armature may have a magnet on it to reduce the current requirement. The bad thing about that is if you wire it backwards, the armature is repelled, and the relay won't close. The other thing generic about this board is that I kept the PWM pins in reserve using only the pure digital I/O pins. The pin numbers are going to be numbered funny in the firmware, but this way all the analog outputs are available if needed.

Saturday, March 12, 2011

Taiko Synth - Phase 6 - Sensing the Bachi

I began with this simple code to detect the strikes, assuming that the start of the first negative slope signal the strongest part of the strikes.
void loop()
{
//polarity - white positive
amp = 0;
ampNew = 0;
don = false;
peak = false;
while(!don)
{
ampNew = analogRead(0);
if (ampNew > 25)
{
don = true;
while(!peak)
{
amp = ampNew;
ampNew = analogRead(0);
if ((ampNew + 1) < amp) // plus 10 for noise compensation
{
peak = true;
printSettings();
}
}
}
}



In the above code, I've had to replace all the "greater than" and "less than" symbols with equivalent HTML entity names, and that seems to work fine. I thought anything with in a code block shouldn't have needed that.

Anyway...

This "don detect" algorithm gave some strange results. The first strike didn't seem to even register. Later strikes weren't proportional to the intensity of the hit. To investigate, wrote new code to capture as much data as possible and send it to Putty via USB serial at 115200 bps.
void setup() {
Serial.begin(115200);
}

void loop() {
Serial.println(analogRead(0));
}



Here are 5 strikes growing in amplitude:







Here's a close-up of the 5th strike:









Some interesting observations can be made. I'm not quite sure of the frequency, because I'm not sure of the sample rate, but you can see that the wave form is a truncated decaying sine wave. That's what one might expect from striking a board with a stick. What's a little surprising is that the first peak is not necessarily the greatest. There is also some dc offset at the end of the strike. From this, the lesson is that I need to change the "don detect" algorithm take the first 15 or so points after a strike is detected. Then, use the greatest of those to determine the peak amplitude. This method may trade latency for accuracy so I may need to tweak the final code a little. It may be a good idea to write more test code to capture these points from within the taiko app to make sure sufficient data is gathered to determine the true peak amplitude. This is because the taiko app surely has a different sample rate than the app above. To address the DC offset, I think I need to make sure that the foam is cut away from beneath the piezo sensor.