Radar
Posts: 5
Joined: Mon Feb 04, 2013 6:49 pm

LaserTag

Mon Feb 04, 2013 7:12 pm

Ive got an idea for a LaserTag equipment but im stuck on figgering out how IR works on the raspberry Pi just want to send PWM data threw a IR led to a TSOP reciever so it shouldnt be much of a problem. the players stats will be sent to a remote mysql database so if i get the ir led and the TSOP reciever to send and get a binary signal the rest should be a cakewalk.

so if anyone has done this before it would be much appreciated if you could share some light on this subject.

PS: im programming in Python

User avatar
joan
Posts: 12738
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: LaserTag

Mon Feb 04, 2013 11:55 pm

You are more likely to find solutions in languages such as C.

Radar
Posts: 5
Joined: Mon Feb 04, 2013 6:49 pm

Re: LaserTag

Tue Feb 05, 2013 4:21 pm

does it come with c or do you have to get a compiler and library to run the GPIO pins sry for the noob question but ive only worked with arduino before and you only use the compiler that is already made for the arduino so i dont know how to get c properly working?

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4205
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: LaserTag

Tue Feb 05, 2013 4:25 pm

The compiler is already installed on raspbian, and is only an apt-get away on any other Linux OS.

Radar
Posts: 5
Joined: Mon Feb 04, 2013 6:49 pm

Re: LaserTag

Tue Feb 05, 2013 4:35 pm

whats the name of the compiler and how can i get connections to the GPIO pins? an example code would be awsome :)

User avatar
abishur
Posts: 4478
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: LaserTag

Tue Feb 05, 2013 4:58 pm

Gordon has made a top notch gpio interface utility for C/C++ check it out (with lots of examples either here on his site

https://projects.drogon.net/raspberry-pi/wiringpi/

or here on the github.

https://github.com/WiringPi/WiringPi/tree/master/gpio
Dear forum: Play nice ;-)

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: LaserTag

Wed Feb 06, 2013 3:48 pm

And the name of the compiler is gcc.
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

Radar
Posts: 5
Joined: Mon Feb 04, 2013 6:49 pm

Re: LaserTag

Wed Feb 06, 2013 4:07 pm

got the pwm to work for the ir led to send signals. just need a good tip for getting analog readings from my TSOP now ive tried this guide here:

http://www.raspberrypi-spy.co.uk/2012/0 ... -gpio-pin/

but it doesnt seem to work with my TSOP 4856 reciever and i dont know why? if i can get that to work all the electronics are done and i can move over to makeing some simple rules for the game and the project is done. :)

also it doesnt realy matter if it shows all the Infrared radiation as cause the rest i can manage with margins like having 1 be a 30ms and 0 to be 40ms duration,

SiriusHardware
Posts: 480
Joined: Thu Aug 02, 2012 9:09 pm
Location: UK

Re: LaserTag

Tue Feb 12, 2013 12:30 am

Radar wrote:got the pwm to work for the ir led to send signals. just need a good tip for getting analog readings from my TSOP now ive tried this guide here:

http://www.raspberrypi-spy.co.uk/2012/0 ... -gpio-pin/

but it doesnt seem to work with my TSOP 4856 reciever and i dont know why? if i can get that to work all the electronics are done and i can move over to makeing some simple rules for the game and the project is done. :)

also it doesnt realy matter if it shows all the Infrared radiation as cause the rest i can manage with margins like having 1 be a 30ms and 0 to be 40ms duration,
The article you've linked to shows the use of a light dependent resistor, which is good for sensing basic light there / not there situations but too slow to respond to data of any kind: Furthermore they tend to be most sensitive to visible yellow light. However, I see that the device you are actually using is an IR-receiver IC.

I don't know about your specific receiver but most of those little three-leg infrared receivers are hard-coded to expect the signal they are receiving to be pulsed on and off at a specific frequency during the led ON phases of the transmission.

A typical frequency might be 40khz, but you'd need to check the data sheet for your device to see what its 'tuned' frequency is.

So if your receiver responded to that frequency and your data consisted of 10ms on, 10ms off, 10ms on, that would need to be transmitted by the IR led as 10ms of led being flashed at 40Khz, 10ms of nothing, 10ms of led being flashed at 40Khz.

The 40Khz (or whatever) frequency is what makes the receiver take notice of your transmission. It is designed to ignore any signal which doesn't have the correct 'carrier' frequency.

The receiver itself removes the carrier frequency and outputs the data signal as 10ms on, 10ms off, 10ms on in the case of the example data above.

Edit: According to the specification here, the tuned carrier frequency for your device is 56Khz.

http://uk.farnell.com/vishay-semiconduc ... dp/1772592

Return to “Python”

Who is online

Users browsing this forum: No registered users and 20 guests