Using spin to send data on a 38kHz carrier
morris4019
Posts: 145
I'm taking advice, in that i will be using a microcontroller to control an IR·beacon, instead of·just a 555·timer.·That way i can transmit actual data signals rather than just 38kHz that could be anything. I can create the 38kHz carrier but have not had good luck finding any information on sending signals and recieving signals through IR. I can manually create pause in between pulses, but I still won't be able to send high and low bits in between pauses.
Does anyone know where i can find the information i need?
-Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
Does anyone know where i can find the information i need?
-Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Say Beacon 1 ID = REST.0.0.0.1.REST
Beacon 2 ID = REST.0.0.1.1.REST
Beacon 3 ID = REST.0.0.1.0.REST.... and so on.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
-Phil
Check out the Square Wave PE Kit Lab:
http://forums.parallax.com/forums/default.aspx?f=25&m=343747
They have an example of a sony remote control signal half way down the page.
Hope this helps,
Doug
I'm sure SPIN is fast enough, as your bit rate will need to be much slower than 38KHz. This assumes you use a timer to generate the carrier.
Ken
I really liked the Square Wave object introduced in the Lab. The quality of the Labs is exceptional.
Andy, are you listening? You need to ask for a raise .
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
Now Phil, i'm interested in what you were saying. From going through this Lab in the link above, it seems that it works almost like what you are talking about, except it is not using the FullDuplexSerial obj. Bascially i would have to manually configure high time, low time (ie .6ms = 0, 1.2ms = 1 for SONY configuration that is) possibly just using constants as reference. That way i could have a bin number, say 0101, then using my constants a method would either send out a 0 (.6ms) or a 1 (1.2ms) respectively. Now, the FullDuplexSerial i thought was used directly to send information to the serial terminal on a pc. Your saying that i can actually switch that to output to a pin, and in this case the same pin as the output to the IRED, right? And, being that I am holding that pin high, when the serial data gets ORed together with the frequency data, i'm left with the serial representation inside the carrier frequency? Is that right?
-Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
Post Edited (JonnyMac) : 5/26/2009 6:24:23 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
Post Edited (morris4019) : 5/26/2009 9:07:40 PM GMT
Your LED is backwards.
_____________
morris4019,
Your A15 pin should be set as an output always. Otherwise the counter will not output to it, nor will your serial output.
-Phil
http://forums.parallax.com/forums/default.aspx?f=25&m=343747
this is the lab i was told to get my information from and it is showing that in fig 4 & 5 the circuit is hooked us as i've said. Cathode to the microcontroller and annode toward 3.3v through resistor. I also thought it might be a coding problem when i noticed something. In the lab on the link above, it shows using the SquareWave object, using the Freq() method as Freq(pin, module, freqency) whereas in my copy of SquareWave.spin it shows (module, pin, frequency). Is there 2 different SquareWave.spin objects? I copied and pasted the code (for squarewave.spin) from the PE Labs fundametals pdf.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
Post Edited (morris4019) : 5/26/2009 10:09:47 PM GMT
I'm not sure about your timing. Your comments indicate timing in clock ticks, but the timing itself is done by incrementing in a loop without reference to the clock. Also, I'm a little concerned that if you do mean clock ticks, your data rate is much too fast for a 38KHz carrier. For example, a 600-tick low bit, is only 7.5us long at 80MHz. That's shorter than one period of your carrier.
Can you also show your transmit program?
-Phil
I hope i'm not completely wrong.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
There are two main problems that I see with the receive program:
1. You're not measuring pulses in terms of absolute time, but in terms of cycles through a Spin loop. You need to involve cnt in these measurements to get the actual time.
2. You are checking for absolute equality in your comparisons between the measured times and the required times for each different kind of pulse. True equality will almost never hold. What you need to do is compare each against a range of values. If it's within the range, then it's that kind of pulse.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
-Phil
Thanks again!
-Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
Good news: it works great up to 2400 baud. This is not fast by anyone's standard but probably faster than manually decoding in Spin and allows you to use simple_serial or fullduplexserial on the receiver side of your project.
[noparse][[/noparse]Edit] Since the IR baud rate is so low I added a version (not buffered, using code from simple_serial) that doesn't require another cog.
Post Edited (JonnyMac) : 5/28/2009 12:08:43 AM GMT
The top houses 4 IR Emitters, later on the other 4 sides IR Detectors will be mounted so that it can send and recieve. 2 Buttons, 1 to cycle through the beacon ID it transmitss, and 1 to start and stop the transmission. Also, there is a toggle switch mounted on back to turn the whole system on and off. The pictures are with the top removed.
Thanks everyone for all of your help.
-Mike
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
======
······ I'll try everything once [noparse]:)[/noparse]
Post Edited (morris4019) : 6/9/2009 2:46:17 AM GMT
The LEDs seem to have a low duty cycle that keeps them from burning out from
going way over the rated drive current of the LEDs. (you can see the flashes in a camcorder viewfinder, they look pretty bright)
But if you keep the duty cycle low enough to massively overdrive your IR LEDs for
greater range you would need to keep the data rate low...but that would be OK if
you don't need to send data really fast. If the rate was low enough you could probably
put several amps through the LEDs and not destroy them. If your code burped and the
LEDs stayed on more than a fraction of a second though they would probably make
smoke I'm not sure how long the pulse would have to be to get through to your IR
receiver because it probably needs a 38khz pulse long enough to make it through
a narrow filter centered on 38khz....I just don't know if this would effect detection of
very short pulses.
You could slowly modulate an LED by switching on/off a carrier at 38khz and sending
1 VERY short burst for 0 and two closely spaced bursts for 1. I just tried this with an
ultrabright white LED keyed by a pulse generator. The amount of light was astounding..like
a strobe light at a club. The LED did not seem to suffer damage. The calculated drive power was well over an amp.
duration of the pulse was approx 1ms....using an old board I made last year using an Atmega168
that drives a dc motor using pwm.... I just twiddled the code to give 1ms single and double pulses
and cranked up the drive voltage to the transistor.