Author Topic: First Tinkering Project  (Read 10151 times)

0 Members and 2 Guests are viewing this topic.

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
First Tinkering Project
« on: January 07, 2013, 05:57:00 am »
Hi all,
    Definitely a young player here (at least to this EE stuff).  I have never been in the industry and have never even taken any classes on the subject (yet).  Been watching the blog videos on YouTube and thought I'd finally make my first post.  This is my first real attempt at doing anything remotely interesting, but I've hit a snag and I have a hypothesis as to why I'm running into issues.  I hope this will be a good way to introduce myself to the community and ask my first question!  :)

But first a short description:
It's a little Arduino powered serial over laser setup.  I'm not trying to create the world's fastest fiber transceiver, I just wanted to test a silly idea for open air transmission and thought it would be neat if it worked.  I am using an Arduino Uno to drive the laser diode at the transmitter, and a smaller Nano at the receiver.  I bought a 128x64 OLED display from Adafruit and slapped it onto the Nano over SPI.

The goal:
Trying to see if it is feasible to get a collimated beam of light to carry some kind of serial over it at any reasonable speed that could be useful for occasional burst transmissions from sensors, what have you.

The technique:
Just for testing purposes I am essentially only sending a clock (I use this term very loosely) at some static, predefined frequency that the receiver is pre-configured to receive.  The only thing the receiver does is attempt to perform a sort of clock recovery and error-detection.  The speed is horrible and the recovery errors are worse, but it does work.  Kind of...  Here are some pictures:

 

 

The scope is hooked up to the receiving Nano at two points: The input to the ADC from the photoresistor (for detecting the light) [in yellow on the scope], and just a curious tap I had on the other side of the filter cap [in blue] (which made a big difference, but I still have little bits of occasional noise, as you can see remaining on the input).  Also the "Error %" on the display is incorrect by two orders of magnitude.  I'd be tickled with .1% error.  Forgot to multiply it out in code oops.  At least the receiver has one nice feature I built in that dynamically adjusts to ambient light and kind of does this pseudo-differential comparison, so it works even in a lit room.  I just turned out the lights for additional "wank factor".

The Problem:
The pictures above show the setup working at pretty much maximum rate (200 cycles/sec) which is slow, but I cannot increase it because the signal becomes indistinguishable, looses amplitude, and generally falls apart at the receiver.  I've checked the specs on the Arduinos and I know I'm still far out from approaching the delay of the AnalogRead() sampling, so it's not that.  Also the transmitter voltage transitions look clean too.  I have tried playing with different values of the components on the receiver but I can't seem to get the signal any better.

My naive hypothesis:
I'm using a standard photoresistor from radio shack (yeah I know  :--) and I wouldn't be the least bit surprised if there's some sort of residual resistance characteristic at these higher frequencies.  That the diode maybe doesn't stop conducting very quickly as the light suddenly goes out, I dunno.  But then after thinking, maybe it isn't just the photoresistor.  Perhaps it is the cheapo laser diode failing to shut down entirely in the trough time of the 'clock' and the fading effect of the laser turning off is going to be my limit here.  Are these suspicions valid?  I'm trying to learn how electronics work and what kinds of things could be affecting my setup.  I'm working in my apartment and not a real lab or anything, so yeah yeah I need mats and stuff but in the meantime, any feedback is appreciated!
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 10520
  • Country: nz
Re: First Tinkering Project
« Reply #1 on: January 07, 2013, 06:04:43 am »
Are you driving the laser diode directly? or pulsing a laser diode module (with its own internal electronics)?

Also, i'd use a phototransistor instead of a photodiode (only because they're easier to play around with the gain)

« Last Edit: January 07, 2013, 06:09:55 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #2 on: January 07, 2013, 06:09:38 am »
Are you driving the laser diode directly? or pulsing a "laser diode module" with its own internal electronics?
Direct.  The Arduino Uno can drive it directly without a significant voltage drop, and the transitions from 0v to 5v look good on the transmitter.  Though that doesnt guarantee that the laser is not still glowing when the supply is suddenly dropped.  That would explain the behavior I've noticed of the "cooldown" being more an issue than the "warmup" of the laser, which correspond to the rising and falling edges on the ADC input respectively.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16388
  • Country: za
Re: First Tinkering Project
« Reply #3 on: January 07, 2013, 06:18:13 am »
If you suspect the laser diode then drive it by shorting out the actual diode itself with a transistor, depending on the drive will determine what transistor type to use.  Photodiodes work better at higher voltage into a constant current sink, preferably with a filter to remove unwanted light. You might want to try using a IR LED as both transmitter and receiver photodiodes. No visible light though, but they do switch fast.
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: First Tinkering Project
« Reply #4 on: January 07, 2013, 10:13:23 am »
Allow me to suspect the photoresistor. Without knowing what chemistry exactly applies here, it is hard to be precise. Still, some photoresistors of the CdS type can have time constants as slow as 100 ms and some, such as the PbSe type, as fast as 2 us. The reliably fastest (easy) detector would consist of a phototransistor driving the base of a normal NPN transistor so that the phototransistor is between base and ground and a bias resistor supplies the NPN transistor base current. This way the phototransistor Miller capacitance is only charged to Vbe of the NPN transistor and the circuit is reasonably fast. You can get even faster by biasing the phototransistor to its linear operating point (assuming its base lead is brought out) and then using a comparator circuit to detect the variations caused by changes in illumination ( of the transmitter that is. You also need to account for changes in the ambient illumination level on the interesting wavelengths).
« Last Edit: January 07, 2013, 10:16:06 am by Kremmen »
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline dave_birdi

  • Contributor
  • Posts: 29
Re: First Tinkering Project
« Reply #5 on: January 07, 2013, 12:26:25 pm »
I agree with this original hypothesis:

My naive hypothesis:
I'm using a standard photoresistor from radio shack (yeah I know  :--) and I wouldn't be the least bit surprised if there's some sort of residual resistance characteristic at these higher frequencies

I remember doing something like this a while back but with an infra-red transmitter and diode and was able to transmit and decode without much issues from a distance of ~ 1 m. Read here:

http://arduino.cc/forum/index.php/topic,10555.0.html *This guy claims more like ~ 15 m but meh, I don't think so.

I personally don't think you'll have much success with this for actually sending serial data, but keep on experimenting :D.

I seriously recommend playing around with infra red.

 

Offline ptricks

  • Frequent Contributor
  • **
  • Posts: 672
  • Country: us
Re: First Tinkering Project
« Reply #6 on: January 07, 2013, 02:04:19 pm »
It is definitely possible with a laser source. I did this and can get speeds of 10Mbit over 100 meters with basic hardware. You need to modulate the signal and use a carrier frequency, without that the data will always be corrupted.

http://en.wikipedia.org/wiki/Modulation

For receivers you can use what you have but a photo-transistor is much better idea. You can also use a standard 5mm LED. You should use an opamp as a buffer between the receiver and the mcu.

using lasers for communcations:
http://www.markettechinc.net/pdf/Diode%20Laser%20Application%20Note.pdf
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #7 on: January 07, 2013, 02:14:04 pm »
If you suspect the laser diode then drive it by shorting out the actual diode itself with a transistor, depending on the drive will determine what transistor type to use.  Photodiodes work better at higher voltage into a constant current sink[...]

Can you explain the purpose of using a transistor on the laser in this case?  I'm new but wouldn't that simply let me turn the laser on and off?  I am already doing this buy sourcing the laser from a digital output pin on the arduino, which is still a distinguishable square wave. It seems to be handling it alright and the pattern on the diode's input looks pretty clean, or at least a lot cleaner than the receiver.
 

Offline ptricks

  • Frequent Contributor
  • **
  • Posts: 672
  • Country: us
Re: First Tinkering Project
« Reply #8 on: January 07, 2013, 02:24:19 pm »
[Can you explain the purpose of using a transistor on the laser in this case?  I'm new but wouldn't that simply let me turn the laser on and off?

The laser diode typically needs 30ma of current to perform best. When you power it with less current it may show an output but the output can contain a lot of , for lack of a better word, noise. Arduino are not capable of sourcing that much current reliably.

http://talkingelectronics.com/pay/BEC-3/Page53.html
« Last Edit: January 07, 2013, 02:26:10 pm by ptricks »
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #9 on: January 07, 2013, 02:46:52 pm »
I remember doing something like this a while back but with an infra-red transmitter and diode and was able to transmit and decode without much issues from a distance of ~ 1 m. Read here:

http://arduino.cc/forum/index.php/topic,10555.0.html *This guy claims more like ~ 15 m but meh, I don't think so.

I personally don't think you'll have much success with this for actually sending serial data, but keep on experimenting :D.
I have range tested my receiver and it seems to work just as well when its 10 meters away  as it does when it is point-blank.  The errors don't seem to creep up too much as a function of distance, not at this scale anyway.  Thanks for the link!

I seriously recommend playing around with infra red.
Ooh i do have an IR diode and detector pair... I might just go ahead and plug those in, but I am looking for straight line range, highly directional transmission.
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #10 on: January 07, 2013, 02:52:26 pm »
The laser diode typically needs 30ma of current to perform best. When you power it with less current it may show an output but the output can contain a lot of , for lack of a better word, noise. Arduino are not capable of sourcing that much current reliably.


Oh I see.  I figured the ardie would be good for 30-35mA but if that's not the case I definitely do need to change things a bit.  How would I source the current then?  Could I use just an LM7805 on the collector of the transistor, which is hooked up to a separate supply like a 9volt?   (at only 35mA I think the head generated by the regulator would be nominal)
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #11 on: January 07, 2013, 02:58:47 pm »
It is definitely possible with a laser source. I did this and can get speeds of 10Mbit over 100 meters with basic hardware. You need to modulate the signal and use a carrier frequency, without that the data will always be corrupted.
[...]
using lasers for communcations:
http://www.markettechinc.net/pdf/Diode%20Laser%20Application%20Note.pdf
I'm big into radio so I am very familiar with the concepts of modulation, but I just don't know how to implement those mechanics in electronic design yet.  That laser communication PDF is very helpful, thank you!  :-+
 

Offline Colfaxmingo

  • Contributor
  • Posts: 26
  • Two of me would be to much
Re: First Tinkering Project
« Reply #12 on: January 07, 2013, 03:36:30 pm »
What happens exactly when you roll the frequency up?  Does the amplitude drop 3db per decade?  I'm wondering if you don't have a parasitic low pass filter due to the sensor.
Rare Medium Well Done
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #13 on: January 07, 2013, 04:20:18 pm »
What happens exactly when you roll the frequency up?  Does the amplitude drop 3db per decade?  I'm wondering if you don't have a parasitic low pass filter due to the sensor.
Not sure about the exact attenuation per decade but it does attenuate.  I'm inclined to think it's more to do with the photodiode/laser and here's why: at lower frequencies, the roll-off of from the waveform is the same, so after it settles high and plateus, on the falling edge it still decays at the same rate as when at higher frequencies.  Could this still be the case in the event of a parasitic low pass filter? 

Actually I think what you say could be true as well, since a low pass filter would just kill clock edges (I think?).   I want a spectrum analyzer now so I can test the frequency response of my detector circuit :(
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5332
  • Country: nl
Re: First Tinkering Project
« Reply #14 on: January 07, 2013, 09:28:51 pm »
Actually I think what you say could be true as well, since a low pass filter would just kill clock edges (I think?).   I want a spectrum analyzer now so I can test the frequency response of my detector circuit :(

Seeing the yellow trace on your scope it looks like a triangle, it should look much more like a square wave if you want to up the frequency. So yes, there is some serious R/C stuff going on, can you post the schematics of the detector upto the ADC input?

If you doubt the transmitting side, maybe you can just power the laser and put a rotating fan in front of it?  :)
Keyboard error: Press F1 to continue.
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #15 on: January 07, 2013, 09:34:31 pm »
Allow me to suspect the photoresistor. Without knowing what chemistry exactly applies here, it is hard to be precise. Still, some photoresistors of the CdS type can have time constants as slow as 100 ms and some, such as the PbSe type, as fast as 2 us. The reliably fastest (easy) detector would consist of a phototransistor driving the base of a normal NPN transistor so that the phototransistor is between base and ground and a bias resistor supplies the NPN transistor base current. This way the phototransistor Miller capacitance is only charged to Vbe of the NPN transistor and the circuit is reasonably fast. You can get even faster by biasing the phototransistor to its linear operating point (assuming its base lead is brought out) and then using a comparator circuit to detect the variations caused by changes in illumination ( of the transmitter that is. You also need to account for changes in the ambient illumination level on the interesting wavelengths).

Thanks for the awesome reply!  I've got to do some wikipedia reading on some of that, but you've provided me learning material and a way forward!  :)  One question though about bias:  I don't quite understand what it is.  I've tried reading about it but I'm not quite grasping the concept though I see it in all sorts of IC applications.
« Last Edit: January 07, 2013, 10:30:40 pm by selkathguy »
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 10520
  • Country: nz
Re: First Tinkering Project
« Reply #16 on: January 08, 2013, 01:06:48 am »
Laser diodes behave like an LED up until you hit their lasing threshold. They also take some time to begin lasing.

From memory i think you're supposed to modulated them between just above their lasing threshold and full current.
Turning them completely off and on has a disadvanced. (probably speed related although i cant remember exactly)
« Last Edit: January 08, 2013, 01:08:37 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #17 on: January 08, 2013, 02:03:27 am »
From memory i think you're supposed to modulated them between just above their lasing threshold and full current.
Super useful info!  I will need to tweak my transmitter then to kill some of the lasing transition time.  Perhaps modulate by keeping it just above threshold and using the digital output of the pin to instead switch in and out an additional load resistor via a transistor?  This would change the current without dropping the voltage as far as I understand, and might work!

An Update: I've captured the difference between having the laser hit off-center of the photodiode and dead-center on it.  It actually performs much worse at the center, as shown below.  I think this points to the fact that photodiodes are just terrible for this kind of application, which probably isn't surprising.



Yellow is TX voltage on the laser.
Blue is RX ADC input.  Theres a lot of noise on the receive end, but I think most of it is out of band from what AnalogRead() will pick up.  I still need to work on cleaning it up though.  Also note the tiny variations I'm having to work with on the receive side (mV/Div on the Y axis).  I will definitely be moving to a phototransitor setup but first I just want to attempt that IR substitute that was suggested.

P.S.:  I notice there's a momentary drop in voltage on the TX after the laser actually kicks on (barely visible in the GIF, right after TX goes high).  It's small and it doesn't seem to be affecting the errors on the receiver as I have a holdoff period in place so it cant even detect new edges that soon on the RX side.
« Last Edit: January 08, 2013, 02:05:17 am by selkathguy »
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 10520
  • Country: nz
Re: First Tinkering Project
« Reply #18 on: January 08, 2013, 11:14:50 am »
Yeah, something is very wrong, the signal should be much better than you're getting.
A different sensor would be the first thing i'd try.

actually, It almost looks like the laser is lasing for a split second and then falling below threshold.
Are you sure this laser diode is ok, they're easy to damage and a damaged laser might do that.

If it's damaged you might get a short laser pulse at power-on that visually looks like a continuous beam because of your repeated pulsing.
Try run the laser at 100% continuous and see if you get a normal laser beam/dot to confirm its ok.
« Last Edit: January 08, 2013, 11:24:59 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #19 on: January 08, 2013, 01:46:45 pm »
The laser is continuously on with a DC supply.  Doesn't seem to be showing fluctuations.  Could it be that when the input goes to 5v, the laser takes just a tiny amount of time to turn on?  Because what I am thinking is that when the laser first goes above its threshold it is drawing a lot more than its nominal runtime current, and it's causing it to drop out a little bit cause the ardie can only source so much.  It comes up to speed super quickly though, and it does indeed appear to be on 50% of the time.  Even did the "wave it against a wall really fast" test.  I will try the IR though when I get home from work.  It just might take me a bit  of rework because my emitter takes 1.5-1.8v max and the ardie gives 3.3 minimum. (I'm trying to get a LM317 to do what I want and help me out here, but I think I am doing it wrong).
« Last Edit: January 08, 2013, 01:49:22 pm by selkathguy »
 

Offline Colfaxmingo

  • Contributor
  • Posts: 26
  • Two of me would be to much
Re: First Tinkering Project
« Reply #20 on: January 08, 2013, 02:59:57 pm »
I think you should be operating your receiver like a Class A amplifier.

You want it conducting all the time and modulate it so that it swings between the rails but doesn't distort.
Rare Medium Well Done
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #21 on: January 10, 2013, 10:05:24 pm »
You might want to try using a IR LED as both transmitter and receiver photodiodes. No visible light though, but they do switch fast.
Bingo.  Infrared diodes.  Thank you.  Changed the code a tiny bit and had to lower the TX output voltage (thank you LM317) didn't touch anything else with the circuit.  Didn't change the R/C characteristics or anything.

Yellow: Transmitter Diode voltage
Blue: Receiver ADC input.
Compare this with the image a couple posts above...

« Last Edit: January 10, 2013, 10:59:42 pm by selkathguy »
 

Offline selkathguyTopic starter

  • Supporter
  • ****
  • Posts: 88
  • Country: us
Re: First Tinkering Project
« Reply #22 on: January 10, 2013, 10:55:17 pm »
Didn't quite like that startup on the transmitter, it was causing the IR diode to have a <40% duty cycle which was messing with recovery at the receiver.  So I removed the electrolytic from the LM317's adjust -> output, and the regulator no longer suffers the significant startup time and the duty cycle has returned to 50%.



Furthermore, the receiver now reports less than 0.2% error in recovery.  Problem is I've now lost the benefit of range that the laser had.  Hmm.
« Last Edit: January 10, 2013, 10:59:40 pm by selkathguy »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf