View previous topic :: View next topic |
Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Tue Jan 03, 2023 8:36 am |
|
|
one possible method to capture a 'flashing light'....
1) determine the frequency of the 'flashing light', probably using an oscilloscope.
2)now cut code to 'sample' (read ) the signal at 4X faster and show the result
3) you should get high,high,low,low..... repeated forever
4)now cut code to 'sync' on this 'sequence of bits
5) when the program sees this 'sequence', you KNOW it's the 'flashing light'.
This method sounds good as I'm typing....it will require using a crystal/2 caps as you need accurate clock. You should use the CCP module. depending on the PIC and CCP version, it might be fairly easy to configure to automatically do this. The CCP would send an interrupt IF it sees the correct frequency( or period ).
just an idea... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Tue Jan 03, 2023 9:12 am |
|
|
Humberto has nailed it. This is why I talked about adding hardware
frequency filtering and modulating the source at a higher frequency than
the motor flash. This is what IR remotes do. The standard receiver chip
for this has hardware filtering at typically 38KHz, so that the receiver
ignores light from other sources. This is the approach you need to be looking
at. |
|
|
Sam_40
Joined: 07 Jan 2015 Posts: 127
|
|
Posted: Tue Jan 03, 2023 10:33 am |
|
|
I appreciate the inputs. I will try to use the oscilloscope to capture the high/low timing from the phototransistor. I will post the results.
My hardware filters the wavelength correctly. I tried using IR or other light sources higher or lower than 630 and both original or my project didn't respond to those sources even if I flash these lights sources. It only respond to sources that has 630nm wavelength. The only difference that I see between the original receiver and my hardware is the original receiver ability to capture the flashing sources and ignores direct or continuous lights.
Like I said, I will try to get the information from the phototransistor and will post the results so I can update the hardware in case you guys suggest specific oscillator so I can add.
Thank you |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Tue Jan 03, 2023 10:54 am |
|
|
The point is your receive circuit needs to be an AC coupled receive
that rejects frequencies below the modulation frequency. This then allows
it to reject slow changes (light levels etc.), and if the rejection is of
all frequencies other than the modulation frequency, then the output
becomes a waveform reflecting the pulse train of your flash pattern.
But it needs to be looking for a frequency well above your pulse train.
Something like 200kHz+. |
|
|
Sam_40
Joined: 07 Jan 2015 Posts: 127
|
|
Posted: Tue Jan 03, 2023 11:29 am |
|
|
I checked the signal from the phototransistor. When the laser is on, I have 10 square pulses ON per second, about 0.00028 second each. Or one square high 280us ON per 100ms and then off till the next cycle.
Ttelmah,
Would you please elaborate, I didn't understand your comment. Thank you |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Tue Jan 03, 2023 11:46 am |
|
|
Think about sonar. If the transducer here just turned on, and sat, you would
never be able to detect the reflection as distinct from the other noises in
the ocean. So instead it sends a 'tone'. The receiver then has filter to
look for that exact signal. Gain can then be thousands of times above
what could be used if you were looking just for the edge, You receive a
nice detectable 'beep' when the signal comes back. Your transmitter needs
to be modulating the light source at a high frequency. This also allows it
to be driven much harder and still be safe. If the source is only on for 25%
of the time it can be driven 4* 'brighter', and still not overload the LED,
and be just as safe to the eyes. Your receive circuit then has a narrowband
filter set to only pass this particular tone, and each time the beam passes
the detector, you receive a 'beep', instead of just an on/off signal. The
gain of the receiver can be very much higher and will ignore most other
signals. |
|
|
Sam_40
Joined: 07 Jan 2015 Posts: 127
|
|
Posted: Tue Jan 03, 2023 12:35 pm |
|
|
Ttelmah,
I appreciate the explanation. It make sense.
On the laser transmitter or the sender unit, I didn't detect any type of modulation. When the signal hit the phototransistor, it's On for that short time (roughly around 280uS then off every 100mS). The original receiver unit also respond to white flash light on flashing mode (this flash light is PWM driven for mid/high/flash I haven't check the duty cycle or time for ON/OFF. I was also able to trigger the receiver unit by spinning a fan to flicker or flash the direct sun light.
How can I change the code to make my processor filter any continuous lights and only respond to flashing or flickering light? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Tue Jan 03, 2023 1:53 pm |
|
|
The 280us (.25ms) ON, 99.75ms OFF is the 'modulation'. You need to create code that will detect this.
If you setup a CCP to start on a 'high', then determine the period, anything > .25ms is a bad reading. If it's less, it's a 'valid' pulse. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Jan 04, 2023 1:27 am |
|
|
It sounds as if you are using some sort of laser module. Probably with it's
own internal PSU from the supply. You need to look again, and find one
that supports modulation. There are many. These are green (as already
said these give better visual detection for a given power):
[url]
https://odicforce.com/Laser-Light-Show-Modules/Green-532nm-Laser-Modules-with-TTL-Modulation1
[/url]
All off the shelf laser levels modulate the laser. |
|
|
Sam_40
Joined: 07 Jan 2015 Posts: 127
|
|
Posted: Wed Jan 04, 2023 5:09 am |
|
|
Ttelmah,
I have two industrial, good quality self-leveling laser levels.
One of them is for indoor use, it has a visible red light, it has few operation modes (horizontal, vertical, both to generate cross and to use with receiver unit). this laser modulates as you describe. I am not building the receiver for this unit.
The unit I am trying to build receiver for, it is designed for outdoor, has long range (about 800m), it has motor that spinning a mirror to broadcast the laser 360 degrees horizontally. all my testing indicates the laser diode is on all the time (if it modulates, I can't see that on my oscilloscope) I only see one square pulse from the phototransistor like I explained earlier.
I tried to implement temtronic suggestion. I searched for examples and read the compiler manual. I tried to use timers, CCP to capture the inputs L-H-L, verify the signal then display the result on LEDs. No success so far.
Is this method possible to have the processor (PIC18F4685) monitor two input ports (16 inputs) and make it do what I want?
If yes, would you please provide an example using three inputs and three outputs.
Thank you |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Jan 04, 2023 7:04 am |
|
|
The point about modulating the signal, is that this is what allows the
receiver to discriminate that the light is from the required source, and
the circuit here to actually adjust to deal with a massive range of ambient
light.
You sound as if you are building a simple on/off detector generating a
logic output. Problem is if you set this up to work in low light, and then
the light level shifts the output will be permanently on. Or if you adjust
it to work in bright Sun, it won't be able to detect in low light levels.
The key point about using a modulated signal, is you can have an AGC
in the detector circuit, adjusted by only signals in the modulated range.
Result an ability to adjust to cope with all the different signal levels.
You then have the output from the tone filter fed into a envelope
detector, and suddenly you have your required pulses from the beam
as it passes. These you then use for your detection. |
|
|
Sam_40
Joined: 07 Jan 2015 Posts: 127
|
|
Posted: Wed Jan 04, 2023 7:37 am |
|
|
Ttelmah,
I disassembled the original receiver. The only hardware that I see are:
Something rectangle looks like LDR to capture the light. It has about 20 pins for power and outputs.
It feed to a processor ( I can't determine the type as it looks like an old watch processor that covered with black epoxy.
Five ceramic caps.
One capacitor.
Crystal of unknown speed.
Two transistor.
LCD to display the results
Resistors.
Buzzer.
Housing for two AA batteries.
The board.
Button to turn on/off.
Red optical filter.
It is simpler than you think.
Like I mentioned earlier, it respond to any type of flashing/modulation light sources with in 630nm.
Thank you |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Jan 04, 2023 7:43 am |
|
|
Almost certainly not!...
There are solid state filtered detectors for things like IR remotes that
have hardware frequency filtration and AGC's all built in. I'd suspect that
the receiver module is one of these. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Wed Jan 04, 2023 7:54 am |
|
|
hmm, curious...
The laser that has the spinning mirror...
If the mirror was stopped,then there should only be single ,very narrow beam of light ,say going 'north'. If that's true , then NO light from 'south', 'south-west', etc.
When the motor does spin, then at 'north' there will be a very brief time when there is no light.
say the laser spreads a 1*(degree) beam width. Then there'd be 359* without any light. You should be able to detect this
I can see you'd need a very,very fast response detector. One that doesn't get 'blinded' due to persistance ( sensor still sees the image,when NOT there ).
For sure you can't have ANY hardware 'filtering' of the signal.NO caps for 'smoothing ' the signal !
My 'gut' tells me you need to buffer the sensor's output with a quality opamp before sending to the PIC. You do need to 'see' the blip on a scope before you cut any code. |
|
|
Sam_40
Joined: 07 Jan 2015 Posts: 127
|
|
Posted: Wed Jan 04, 2023 8:27 am |
|
|
The sender unit is way bigger and more complicated than the receiver. It has motors for the gyroscope for the self leveling and calibration, also to spin the mirror. Several buttons to turn on, calibrate, slop settings ...etc.
The laser will not turn on until the mirror starts spinning.
The laser output is dim compared to the other indoor laser. Both 630nm wavelength. The indoor receiver has a lot of electrical hardware and I believe it is more precise as it only respond to the sender unit that it came with it. The indoor sender unit doesn't spin. It only broadcast 180 degrees or to one side.
My project receiver for the unit that spins 360 degrees. Like I mentioned, the original receiver for the unit that spins respond to any flashing light that has 630nm. I believe if I can come up with away to make the inputs for my project sense the fast on and longer off, I will be able to make it work.
Edit: If the mirror stop spinning and the laser is ON, it will only point at one point and the laser diode is ON all the time. No modulation, No laser will be available at the other 359 degrees. |
|
|
|