# How to detect a short and long voltage pulse

#### mstrauch

Joined Nov 1, 2015
4
Good day all:

First time poster as I haven't even thought about electronics in a very long time. Well, then the girlfriend got me a drone and I wanted to do some modding, of course I have to go all out, right? Obviously after over 15 years of mental neglect I am suffering from a serious case of CRS (can't remember squat)

Here's what I am trying to figure out. I want to add LEDs to the copter for night flying, simple enough. But, what I want to do is utilize the signals from the TX for the camera controls so I can turn them on and off remotely. The camera has an SD card so I am not dealing with video signals, it just receives signals from the TX to either take a photo or turn on/off the video. I picked up some leads so I could plug into the camera port and test to see what the buttons do. At least I still have my old breadboard and boxes of components to get me started, that does help a lot.

There are 3 leads, power (powers camera), ground and camera (take photo / video on/off).

The camera lead also gets solid power (3.7v):
- When you hit the video button there is a long off pulse, about a second.
- When you hit the photo button there is a 'fast' off pulse. Well, fast relative to pulse for video.

By now I am sure you have figured out what I am trying to do. I want to detect those pulses so I can turn on and off 2 sets of lights.

I think I know what I have to do for everything except how to detect the pulses from the TX, and knowing which one was sent.

I first put it through a PNP so would swap the signal to always off with on pulses. Was thinking would put in caps and see which ones would charge... Honestly, that is about as far as my brain went. I mean things are coming back SLOWLY, but it has been so long I am not sure where to start on the math or even the concept to get me to where I even need the math.

Any thoughts, ideas, pointing in the right direction would be greatly appreciated!!

Mark

#### MikeML

Joined Oct 2, 2009
5,444
So you want to use 3.7V as a power supply? That lets out a lot of logic and NE555s.
...
- When you hit the video button there is a long off pulse, about a second.
- When you hit the photo button there is a 'fast' off pulse. Well, fast relative to pulse for video.
That is on the "camera" pin; Not an interruption of the "power" pin?

...I want to detect those pulses so I can turn on and off 2 sets of lights....
There is only enough information to turn on/off one set of lights. What do you mean by 2 sets?

#### mstrauch

Joined Nov 1, 2015
4
So you want to use 3.7V as a power supply? That lets out a lot of logic and NE555s.
Yes, I know but the drone runs on 3.7V not 5V so trying to work with what I have. Same reason I have to pick up some 4013 chips as the 7474s that I had on hand require 5V.
That is on the "camera" pin; Not an interruption of the "power" pin?
Yes, as I said, there are 3 separate wires - power, ground and the camera control. I can power the breadboard with power and ground as well as a test LED using camera and ground. The main power is separate and when I hit TX camera buttons, my test LED is where I can see that short and long pulse.
There is only enough information to turn on/off one set of lights. What do you mean by 2 sets?
No, the camera lead sends 2 different signals, either a long or a short off. One for a photo and one to turn the video on and off. That is why I am trying to figure out how I can detect the 2 different pulses, the camera does it so assuming there has to be a way. There are 2 buttons on the TX, the camera has 2 functions - so I figure I should be able to control 2 sets of lights.

#### MikeML

Joined Oct 2, 2009
5,444
...There are 2 buttons on the TX, the camera has 2 functions - so I figure I should be able to control 2 sets of lights.
Well, the simplest method is unary encoding, meaning you only have two functions; turn one thing on; turn one thing off.

Sounds like you are expecting each function to toggle its respective output?

The simplest way of doing this is an Arduino mini running on 3.3v, and about 30 lines of code.

Last edited:

#### Brownout

Joined Jan 10, 2012
2,390
Well, the simplest method is unary encoding, meaning you only have two functions; turn one thing on; turn one thing off.
He has four possibilities

1) funtion 1 is off, turn on
2) function 1 if on, turn off
3) function 2 is off, turn on
4 function 2 if on, turn off

By making each function's output an input, he can do all four operations.

This can be accomplished with a mixture of logic and analog components, or as suggested, a single controller.

#### MikeML

Joined Oct 2, 2009
5,444
He has four possibilities

1) funtion 1 is off, turn on
2) function 1 if on, turn off
3) function 2 is off, turn on
4 function 2 if on, turn off

By making each function's output an input, he can do all four operations.
Sounds like the toggle I mentioned above. You know, a DFF with Qbar tied to D...

#### Brownout

Joined Jan 10, 2012
2,390
I wasn't sure if you were saying he could only control one function.

#### mstrauch

Joined Nov 1, 2015
4
I wasn't sure if you were saying he could only control one function.
OK, it wasn't just me - that is what I thought he was saying as well and I was a bit confused.

Sounds like the toggle I mentioned above. You know, a DFF with Qbar tied to D...
Yes, the toggle part I have covered, the 4013 I have to order which is the DFF that works at 3V.

The simplest way of doing this is an Arduino mini running on 3.3v, and about 30 lines of code.
I have read about Arduino was hoping to not go that path as a little more of a learning curve that I don't really have the time for ATM, especially for a fun little side project. Basic analog and digital will eventually come back to me, Arduino use and programming is 100% new.

This can be accomplished with a mixture of logic and analog components, or as suggested, a single controller.
OK, this is what I was hoping to get a little assistance on. Without using a controller, not sure on the logic to check for the 2 signals, thus sending the correct toggle to the correct DFF. Am I making sense at all? I know what I am trying to ask, not sure if communicating that well enough.

#### Brownout

Joined Jan 10, 2012
2,390
OK, this is what I was hoping to get a little assistance on. Without using a controller, not sure on the logic to check for the 2 signals, thus sending the correct toggle to the correct DFF. Am I making sense at all? I know what I am trying to ask, not sure if communicating that well enough.
We're talking maybe 5 -6 chips. I fear it might end up being too big for your drone. But if you still want to proceed, I can try to make a general diagram of the idea

#### mstrauch

Joined Nov 1, 2015
4
We're talking maybe 5 -6 chips. I fear it might end up being too big for your drone. But if you still want to proceed, I can try to make a general diagram of the idea
If you have the opportunity to get me something to look at, would be greatly appreciated, but only if won't take you too much time. This is just a little side project on a toy after all.

Anything that might point me in the right direction and gets my head back into electronics mode is a good thing!

#### AnalogKid

Joined Aug 1, 2013
10,947
What you are describing is a form of a missing pulse detector. You stated the long pulse is 1 s. Lets assume the short pulse is 0.5 s. One way to do this is with a monostables set to 0.75 s.

When the pulse starts, it triggers the monostable. If the input pulse trailing edge happens before the monostable times out, it is routed to activate function #1 (set a ff). If the trailing edge happens after the monostable times out, it is routed to activate function #2 (reset a ff). With this plan there is no reason for a toggle ff.

Unless you want something different. Function #1 could be the clock input to a toggle FF. In this case, multiple short pulses in a row would toggle the lights on and off. Then function #2 could be the ff reset to force the lights off without knowing their current state.

or something like that.

ak

#### MikeML

Joined Oct 2, 2009
5,444
Use the original pulse train. See V(camera) in the plot. I guessed at the timing... For testing the logic, I happen to alternate short and long pulses, but that is not a requirement...

Use the down-edge of V(camera) to trigger a one shot whose period is halfway between short and long periods. See V(os).

A1 an A4 detect if the pulse was long or short, and clocks the respective toggle. See V(short) and V(long).

I am using the behavioral logic in LTSpice. It nominally operates on 1V, so you will have to use a CMOS family that will operate on 3.7V. I added some nominal propagation delays...

The take-away is that the short and long Flops toggle on short and long pulses, respectively.

#### Attachments

• 2.8 KB Views: 2
Last edited:

#### Brownout

Joined Jan 10, 2012
2,390
Well, Mike beat me to it, but here is my idea, very similar function: