LANC control
David Betz
Posts: 14,516
My son wants me to make a LANC control for his camcorder and of course I want to do it with a Propeller (maybe the new Propeller Mini). I found some information on this on the web but it's for a 5V AVR chip. Here is the circuit diagram they suggest. How would I modify this to work with the 3.3V Propeller? I assume I'd need to change the zener diode and probably some of the resistors as well.
Comments
-Phil
LANC expects open-collector devices connected to it; the Propeller should float its TX pin to release the buss (idle, 1 bits), or pull it low (start, 0 bits). LANC is pretty easy; I built an little SX-based camcorder controller about six years ago.
No, that's a PNP; you'll want an NPN to pull the line low. You could use a small N-channel MOSFET, too.
You *may* be able to do this. I tried this with an SX chip about six years ago and it worked fine, until I gave the command to turn off the camera. A few seconds later, the camera would come back on. It turns out that leakage through the pin circuitry was the culprit and would cause the camera to wake back up. I ended up buying the Sony SIRCS spec document and using the recommended circuit. It seems a bit overkill, but did work in the application which allowed the SX to be powered from the camera.
In the attached schematic there is a net called WAKE -- pull this to ground through a normally-open button to wake a sleeping device.
Please see post #15 for circuit, and post #20 for LANC object for the Propeller.
Might not be the best way but a very simple way.
Here's a rough example.....
// Start Reading Byte 0
pinMode(lancPin, INPUT);
delayMicroseconds(94);
for (int i=0; i < 8; i++) {
recValLo <<= 1;
if (digitalRead(lancPin) == LOW)
{
recValLo |= 1;
}
delayMicroseconds(bitDuration);
}
pinMode(lancPin, OUTPUT); // Send Stop
digitalWrite(lancPin, HIGH);
delayMicroseconds(10);
The object is able to detect the presence of a LANC stream and, if lost (e.g., camera is unplugged or goes to sleep) reports that. A sleeping camera can be restarted with the wake_up() method, but this requires the Propeller to have its own power (i.e., not be powered from the camera 5v line which also goes off when the camera sleeps).
This is working in my friend's project but I'll hold-off posting in in ObEx until we've really wrung it out. The interface between the Propeller and the LANC port is a simple 3.3v-5v level shifter that is typically used in I2C lines.
[ Edit ] Updated schematic for clarity. This is the circuit deployed in my friend's project. Code removed for updating.
The attached archive has the updated object and a demo program that I've used to control two different cameras (Sony and Canon). Some may note that the LANC codes in my demo are differeent than what one finds on the 'net. I determined these codes by connecting two off-the-shelf LANC controllers (Monfrotto and VariZoom) to my circuit -- this is possible because the LANC buss is open-collector/drain; the Propeller becomes a buss sniffer. Note, too, that I'm using FullDuplexSerial in the sniffer to eliminate any errors in my on LANC RX and TX code.
Would love to know what others find.
[ Edit ] D'oh! The codes I'm reading with the sniffer are different from what's published because I'm using a non-inverting interface -- other LANC interfaces invert the data in an out. I've pulled the code for a moment so that I can do software inversion; this will let others use commands from the Sony manual and from projects that use traditional UARTs (hence require a more complex interface).
Thanks!
David
I jut figured out why may LANC commands are different from the Sony manual and everything one finds on the 'net: everyone else is using an inverted interface -- the circuit I'm using is a non-inverting level-shifter. D'oh! I was wondering about this as I was scrambling all week trying to get my friend's project ready for NAB (on top of doing my day job). I'm going to update the driver so that one can use command bytes that one finds in other projects. I'm also going to put a link to my schematic so that others have it.
I've been wanting to do this for a long time -- my friend's project forced me into it. Now I'm going to explore extracting timecode and other relevant information from the LANC stream.
I have one Sony camera left to do some transfers, and this may help.
Jim
Hmmm... this may be worth a Nuts & Volts article.
-- http://www.boehmel.de/lanc.htm
... I was able to extract status and timecode information from the LANC stream.