Shop OBEX P1 Docs P2 Docs Learn Events
Want to trigger your Nikon with your Propeller? (IR) — Parallax Forums

Want to trigger your Nikon with your Propeller? (IR)

Stephen MoracoStephen Moraco Posts: 316
edited 2008-09-02 06:05 in Propeller 1
My son comes to me and asks if he can auto trigger his new Nikon D80.
This is one of a number of models from Nikon which support infrared
remote triggering.·· I see a·an opportunity for both of us to·learn·more
about·how Infrared remotes work. Long story short, this post reports
on our findings·from this Fun Learning weekend.

Armed with the information herein, a Nikon camera which has infrared
remote triggering·(models D40, D60, D80, D90 or D40x) and a
couple parts from Radio Shack (or your other favorite electronics
stores.) you too can programmatically trigger your Nikon from your
propeller!·· I've attached code and waveforms, but I'm getting ahead of
our story...

Hmmm... how do we lurk on IR traffic from remotes?· We downloaded
the IR_Kit from the Propeller Object exchange (Thank you Bob Belleville!)
which gives us good background and speaks to how we can do this.

Next we hook up an IR Receiver Module (Parallax has them, so you may
already have one)·We used the·Radio Shack Part #276-640 and simply
powered it from the Demo board 3.3v which proved nicely simple to hook
up and begin using.· The fun aspect of using this part is that the 38KHz is
removed and you simply get 0's and 1's from the part.

It turns out that like most of your IR remotes at home the Nikon
ML-L3 remote which comes with the camera sends bursts of
38KHz pulses.· This means I can decode my DirecTV remotes and the
ML-L3 remote...· this is going to be fun!

By playing with the IR_Kit code examples we are able to prove that
our propeller is seeing the traffic from both our remotes.· I'm decoding
traffic from the DirecTV remote and yes also from the ML-L3 remote.
However, there is no real understanding of the ML-L3 decode.· After
playing around and reading about _many_ IR protocols and revising a
couple of the decoder examples, it dawns on us that we don't have
to understand what codes the remote is sending, or who's protocol
is being used, etc.· All we have to do is faithfully mimic it!

So, you may know from my other posts that I'm a developer with a large
test equipment company. In fact I work on large logic analyzers, their·software,
for my day job.· Can you guess what test instrument we next used?· ;-)

Yep, we hooked up the logic analyzer and captured the traffic as
reported by the IR Receiver Module to the propeller.· There are three
.jpg images attached to this post.· Take a look at ML-L3-incomingBoth.jpg
and you see what we saw.· Two·repeated sequences·of pulses.· So,
programming mimicry of this pattern should be easy...

Um, now how do we send IR traffic?· Now we need to hook up just
a few more parts to our demo board.· Yes, they too are avail. from
Parallax or Radio Shack or your favorite Store.

So we hook up the IR transmitter LED (see details in the .spin source
code, attached to this post.)· and then we code up this sequence.
I capture it with the logic analyzer and WOW it came up fast.· But,
hey the camera doesn't seem to see it!· What's wrong?

Do you see it coming?· tongue.gif··· Yep, our IR Receiver is so good at stripping
the 38KHz pulses from the data that we forgot to encode the data
over the 38KHz pulses!· The camera didn't recognize anything we sent
because it's looking for the stream of 38KHz pulses!

Ok, so we dig out the Propeller docs for how to configure the counters
to generate the fixed 38KHz and then we can simply modulate the
signal with our pulse train.· We first decided on setting the pin direction
(who looks at the examples, when we are on a roll?) as the means
to encode our data.· For a pulse we set the direction to output
and the 38KHz is sent for the duration we need and then we turn
the direction to Input and nothing is sent.· Just what we need.

Sure enough our Nikon snaps a picture and we both jump!··Did it
work?· We try again and sure enough it triggers when we want
it too!

Now that it is basically working we had to figure out the limits
of the triggering?· Why are there two bursts?· Are they both
needed?· How fast can we trigger the camera?· How slowly
can we trigger it? The list goes on...· After a bit of time working
to get these answers, we've finally got a stable triggering
code base!

Now·what ensues is a site to behold (or·maybe to be embarassed
about ;-)· It's now 3AM, we're both kind of giddy and we are taking
large numbers of frames·without touching the camera·and my son is
making all manner of movement in the field of view.· Late night/early
morning·fun with·time-lapse·photography...·In all, great fun!

Along the way to getting this working we discovered a couple of
other fun things.· (1) The IR transmitters/detectors are good enough that
when we bounce off the ceiling (vertical) or bounce off furniture
(horizontally) we acutally see the round trip times varying.· We've
proven that we can really use this for distance measurement as well!
Additionally, (2) we've seen (and you can see somewhat by using the
attached code) that it is almost trivial, given the examples from the
Object Exchange, to add an IR receiver to your project and control
it with simple (cheap!) TV remotes.

Now we have an inexpensive·NEW learning·remote just waiting to be
incorporated into our next project!

We hope you find this post useful.· We certainly had a·great time
learning how to do this.··

73 (Regards),
Stephen, KZ0Q and Steve, KD0BIM
--

Re: Attachments:·
ML-L3-incomingBoth.PNG - the two burst pattern emitted from the ML-L3
ML-L3-incoming.PNG - zoom in on one of the two bursts
ML-L3-outgoingAndIncoming.PNG - a similar burst but now gererated by the propeller (code attached) and seen by the IR Reciever as it is being sent
ir_view_ML_L3 - Archive· [noparse][[/noparse]Date 2008.08.31· Time 19.04].zip - the code project including two files (README and modified code) from the IR_kit object.



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • Shane De CataniaShane De Catania Posts: 67
    edited 2008-09-01 05:34
    Wow, thanks for that Stephen... funilly enough, only last nigh I was trying to convince my wife that I really need a new D90 when they arrive in the shops! Now I can tell her that I have already saved money by not needing a remote wink.gif
    Cheers,
    S

    Afterthought... are you working on the GPS module now?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    News Flash!... Energizer Bunny arrested and charged with battery.

    Post Edited (Shane De Catania) : 9/1/2008 5:42:08 AM GMT
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-09-01 06:05
    Hi Stephen,
    thanks for posting this. And I have a newbie question: is there any reason why I couldn't use an oscilloscope to extract the same kind of information as you did with your logic analyzer?

    thanks,
    Mark

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2008-09-01 16:00
    Or use the propeller as the analyzer and add a record mode [noparse]:)[/noparse]
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-09-01 17:53
    Yes Graham, I was wondering the same thing. How would such a recorder work? What would be the general approach?


    smile.gif
  • Stephen MoracoStephen Moraco Posts: 316
    edited 2008-09-01 22:02
    Hi Mark,

    ··· How much answer do you really want?· ;-)··

    ··· Actually, yes you can do most of what I did with an o'scope.· What you are asking turns
    ··· out to be likely more subjective than not.· A really experienced user with either piece of
    ··· gear will likely pull the O'scope when we care about the true signal waveform (noise on
    ··· the signal, ringing, real rise/fall times, cross-talk between signals, etc.) on the other
    ··· hand if all we are about is what the signal looks in terms of logic threshold crossings
    ··· and we care about this for one·to many channels at once (think up to hundreds), then
    ··· the LA (Logic Analyzer) is probably the tool of choice.··In this case I'm looking at data
    ··· carried by the signal or·general shape of the signal,·not·the·quality of the signal so I
    ··· choose the LA.·

    ··· We can't overlook the operational mode we·use however which is when we are really
    ··· comfortable with test gear we can and·should use which ever instrument which will
    ··· give us the answer we need in the shortest amount of time.· This aside, I'll still explain
    ··· a little further why I used the LA.

    ··· With the LA I have additional benefits appropriate to this task.··· When
    ··· I don't know the shape of what I'm capturing and I want to capture events
    ··· over long periods of time I can use the LA in a mode we call "Transitional Timining" which
    ··· is where the LA only stores·samples where an edge occurs on the channel(s) in which I'm
    ··· interested.· This means that for a given amount of storage (which can only store a fixed
    ··· amount of samples) that I can look at a signal over a very long period of time when I'm only
    ··· storing when the transitions occur.

    ··· I also really don't spend any time trying to locate the signal on the display or trying to set
    ··· a trigger threshold to position my display until after all the data is captured.· Once captured
    ··· I simply use my mouse to locate and zoom into my area of interest in the captured data to
    ··· study and learn from it.· Pulse widths to the capture accuracy are given for any pulse I hover
    ··· over or I can set markers at leading/trailing edges, etc.· So, I get really simple time/frequency
    ··· measurements by using this tool.· You can probably see that this is generally not how you do
    ··· things when you are using an O'scope.

    ··· An LA like an O'scope offers a _really_ accurate time base. The waveforms you see attached
    ··· to this post are actually captured at 5.0 nS resolution (much greater than I really needed)
    ··· so my·measurements are·nicely precise.·· (Actually, I'm using one of our low-end models, but
    ··· afterall how much overkill do we really need? ;-)

    ··· This help answer your question?··

    Regards,
    Stephen, KZ0Q

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    ·
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-09-02 02:05
    Hi Stephen,
    yes, this helps answer my question. I have no idea how one might watch dozens of signals all at once on an oscilloscope. And I'm sure a logic analyzer costs a heap of money, so I was wondering if I could use a simple oscilloscope for decoding just a single channel of IR or if there was something about it I had not thought of.

    thanks,
    Mark

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-09-02 05:08
    If you want cheap, there's the logic analyzer I wrote for the Propeller: http://forums.parallax.com/showthread.php?p=606048

    It certainly doesn't compare with what Stephen works on, but for 38kHz signal it should get you the information. If your looking for a better look and feel, check out Hanno's Viewport: http://mydancebot.com/viewport/·not free, but it give a more feature rich·(and faster) LSA using your Propeller, and you can try it out free for 45 days.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Nick McClickNick McClick Posts: 1,003
    edited 2008-09-02 05:12
    Awesome project, and a good learning project. I was thinking of working on this myself, except to trigger the CLS (Creative Lighting system) - My D50 will drive the $200 Wireless CLS commander, but doesn't have the commander built in. If I ever get to it, I'll reverse engineer it and put it up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Concentrate on understanding the problem, not applying the tool
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-09-02 06:05
    I'll have to look into this logic analyzer business. There's a purebred pitbull in my neighborhood who runs loose once in a while. He poops on my lawn, sometimes chases the neighbor's cat, and once he ran into my house when my young son had the door open. I tell the owner to keep him on a leash and away from my yard, but the owner just chuckles and says the dog is a big teddy bear and won't hurt anything. Funny thing is, the dog wears a radio-controlled shock collar which the owner uses all the time to control the dog since the dog refuses to listen to verbal commands. I'm sure the radio signal is coded somehow so.... can you guess where I'm going with this? devil.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
Sign In or Register to comment.