Author Topic: RaspCORE - Raspberry PI Lasertag-System (my ideas)  (Read 20075 times)

nuclearsummer

  • Developer
  • Newbie
  • ***
  • Posts: 6
    • View Profile
    • Email
RaspCORE - Raspberry PI Lasertag-System (my ideas)
« on: April 26, 2012, 03:04:13 AM »
Hey guys,

in the last months I have heared a lot of interesting news about the Raspberry Pi platform (http://www.raspberrypi.org/faqs).
So why dont use it as a mainboard in a Laser gun?

It is very cheap (25$ - 35$) and linux run on it.
You dont ne a complex Linux distribution like Fedora or Debian, an optimized Arch-Linux would be more suitable.

Pros:
+ a lot computing power (700MHz)
+ cheap and tested
+ energy efficient (25$ -> 2.5W; 35$ -> 3.5W)
+ run with batteries
+ sound support and audio out
+ sd card can store soundfiles
+ GPIO Port to control LEDs, display or react with switches
+ USB Support: so you can run a 5$ BlueTooth adapter to communicate with other devices
+ maybe easier developing and testing

Cons:
- Linux brings more complexity
- maybe it is impossible that Raspberry Pi bring 1.5A direct to the IR-LED, so a small second PCB is needed.
   An idea is that the Raspberry Pi create the MilesTag-Datagram, send it to the second PCB and this fire it out.
- maybe more power consumption than an arduino/MilesTag-System
   
This is just the result of my brainstorm.
I am really interested in comments from the MilesTag-community  :)

thanks

howdy!
« Last Edit: April 26, 2012, 10:57:02 AM by nuclearsummer »

berk

  • Veteran
  • *****
  • Posts: 387
    • View Profile
    • funwithelectrons.blogspot.com
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #1 on: April 26, 2012, 04:17:49 AM »
You'd have to write a Linux kernel module to get the 600uS pulse timings accurate. If someone could do that, I do not see any reason why it could not be done.

nuclearsummer

  • Developer
  • Newbie
  • ***
  • Posts: 6
    • View Profile
    • Email
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #2 on: April 27, 2012, 04:38:25 AM »
Hey berk,

why should my code in a kernel-module?
That the 600us-clock-process get a higher priority?

In my view that is not needed.

The RaspCORE have reduced set of processes. No gui, few system-programms, optimized Kernel.
In combination with a highest priority (nice = -20) of my programm will react very fast.

The detection of the 600us is no problem, linux (time.h) can return the systemtime in nanosecounds.
So I meter permanent the time and if 600us are over, a new event is happend.

BTW: Some Rasp Pi distributions have a config file where it is possible to change cpu frequency and current, disable 3d acceleration ...  ... these optimizion can increase the runtime with batteries.

sorry about my bad english :)

howdy

berk

  • Veteran
  • *****
  • Posts: 387
    • View Profile
    • funwithelectrons.blogspot.com
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #3 on: April 27, 2012, 07:19:32 AM »
Hello howdy
  Time can be returned  in uS in Windows too, but the multi  tasking time slice resolution is at best 4mS, and that is not guaranteed.

It is the same with Linux, your process will not be granted an equal amount of CPU time for every time slice, so code like:

Code: [Select]
while(1)
{
if( time_now > time_last + 600uS)
{
   CheckIrInput()
   time_last = time_now
}
}

will not work as any interrupts or processes with higher priority might interrupt your code at any time. It might be 60uS, 600uS or 1200uS before the next thread time slice, and with an asynchronous protocol, once you start to drift you will never re-synchrnoise.

I've written software based timed receivers like this on PICs, but on those I am guaranteed how long each step of the program will take as I control all of the interrupts, and there is only one process: me!

I am not saying it cannot be made to work, but my experience in this field tells me you will need more than a simple process to monitor the data stream.

Tony

Delrick

  • Developer
  • Newbie
  • ***
  • Posts: 9
    • View Profile
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #4 on: July 25, 2012, 03:59:55 PM »

I quite agree about the time slice problem but take a look at Mike Cook's Magic Wand at http://www.raspberrypi.org/archives/1663, of particular interest is the way he gets the timing:-
 
" the BCM2835 chip has an ARM peripheral that can help. It is a free running counter, that means it keeps on going while the operating system steals some time off you. "

Another option would be to use a simple PIC circuit to do the decode and pass characters from a circular buffer to the Raspi with SPI, PIC's are 50p for the smaller ones. I am particularly interested in using a RasPi for a scoring system. It's HDMI and analogue Video outputs means it could use a TV as display, and with all the other i/o available and the Linux core printers etc are no problem.

cjsoftuk

  • Developer
  • Full Member
  • ***
  • Posts: 98
    • View Profile
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #5 on: July 26, 2012, 01:13:31 AM »
Del, My latest set of projects has exactly that kind of application in mind.....

I'll post more when I'm not working 8AM-8PM.

berk

  • Veteran
  • *****
  • Posts: 387
    • View Profile
    • funwithelectrons.blogspot.com
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #6 on: July 26, 2012, 06:05:35 AM »
Magic wand is interesting, but it is still polling a timer to determine time periods. Any inaccuracies in timing in this application will simple be missed by the human eye.

Milestag packets have a min. pulse with of 600uS. To parse these with a poll you need to be running at least 2x that speed, and ideally at a 4x. That means you need your software to be looking at a pin every 150uS.

To get this kind of accuracy you really need interrupts, as any drift caused by a task switch will result in missed packets.
Del has the best idea for a slave pic to do the accurate timings, and pass the validated packets onto the Pi for processing.



berk

  • Veteran
  • *****
  • Posts: 387
    • View Profile
    • funwithelectrons.blogspot.com
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #7 on: August 03, 2012, 12:17:30 PM »
There is now an Adafruit distro for Raspberry Pi which includes SPI and I2C. That would simplify communicating with a PIC.

http://learn.adafruit.com/adafruit-raspberry-pi-educational-linux-distro/

LordAkkrand

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #8 on: August 06, 2012, 08:44:20 PM »
I've got a rPi on order (only a few weeks, fingers crossed), and am thinking of doing a similar thing.
My plan was to get a usb->rs232 serial adapter (only ~$2 on eBay), and hook up the sensors to that, and have the lirc daemon do the timing and decoding for me.  I don't know if that will be CPU intensive or not, it's not like I'll be running much else in my python program.
I'm not 100% sure that will work, but the parts to test it out are only a few dollars, and I can begin testing on windows using winlirc whilst waiting for my pi to be delivered.
I'll post my findings when I have some.

cjsoftuk

  • Developer
  • Full Member
  • ***
  • Posts: 98
    • View Profile
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #9 on: August 07, 2012, 01:55:44 AM »
A cool idea to use lirc on the RPi.

Just watch out though:
1) lirc will need a config file written to cater for MT5.
2) lirc may have problems with multiple definitions (which you need for MT5).

Best of luck with it though, and if you get it working, please feed back (and ideally release the definition file).

MilesTag

  • www.MilesTag.com
  • Administrator
  • Veteran
  • *****
  • Posts: 334
    • View Profile
    • Laser Tag Parts
    • Email
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #10 on: August 08, 2012, 10:03:10 AM »
Watching with interest.  My Raspberry Pi has been on order for a few weeks now.  Still waiting...

bfisch1983

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #11 on: November 14, 2012, 01:02:12 PM »
You could so something similar to what I had planned for laser tag.  Which uses a central unit on the body or arm for the user input and output and then the guns and receivers are both run by MSP430F2012 (boards with this on them are $3 apiece.)
So the IR TX timing is handled by one MSP430 the receivers have another MSP430.  This way the conflict between shooting and getting hit is removed.  You can link the gun and receivers wirelessly like I planed or use the I2C or SPI interfaces.
This is my planned system architecture.
http://bfisch1983.com/lasertagpages/Architecture.gif
I like this setup because things like custom guns and grenades can be made pretty cheaply and you can have multiple guns per person in a game.
I may just switch the core unit to a raspberry pi because it has all the IO I need and will help me with playing audio.  It looks like you can use QT creator to develop on the pi and for a separate project I already have QT creator on windows reading an XBee over uart and playing sounds with IRRKlang.  Not sure it IRRKlang will port but FMOD might.  Still plenty to look into and think about, but its a good idea.

LordAkkrand

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #12 on: August 19, 2013, 08:35:42 PM »
So it's been a while, but I've started progressing on this again.

I found several problems with the rPi USB, such that hooking up an IR LED or receiver via a USB cable would result in the USB serial cable device being disconnected the moment I tried to use it.
So, I've started wiring the circuits myself, connected to the GPIO, because the lirc daemon has had gpio support added for the raspberry pi (god bless open source software!).

I used the circuit diagrams provided to me by raspberry pi forum member 'mba' from his blog:
http://www.datscharf.dk/amote/tutorials/lirc-on-raspberry-pi/
http://www.datscharf.dk/amote/hardware/diy-receiver/
http://www.datscharf.dk/amote/hardware/diy-transmitter/

Registering a switch (trigger) tripping is trivial, the circuit is tiny, as is one to power "muzzle flash" LEDs.
And I've got my circuits working, now I just have to fit it into a prototype tagger, whip up a bit of python to listen, and shoot one pi with the other.

I'll update again when I've got more.

Pingvin

  • Developer
  • Veteran
  • ***
  • Posts: 457
    • View Profile
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #13 on: August 23, 2013, 04:05:42 AM »
So it's been a while, but I've started progressing on this again.

I found several problems with the rPi USB, such that hooking up an IR LED or receiver via a USB cable would result in the USB serial cable device being disconnected the moment I tried to use it.
So, I've started wiring the circuits myself, connected to the GPIO, because the lirc daemon has had gpio support added for the raspberry pi (god bless open source software!).

I used the circuit diagrams provided to me by raspberry pi forum member 'mba' from his blog:
http://www.datscharf.dk/amote/tutorials/lirc-on-raspberry-pi/
http://www.datscharf.dk/amote/hardware/diy-receiver/
http://www.datscharf.dk/amote/hardware/diy-transmitter/

Registering a switch (trigger) tripping is trivial, the circuit is tiny, as is one to power "muzzle flash" LEDs.
And I've got my circuits working, now I just have to fit it into a prototype tagger, whip up a bit of python to listen, and shoot one pi with the other.

I'll update again when I've got more.



Great idea!
I find time, be sure to take part in the project (with your permission)!
After all, even video can be broadcast online via 3G modem!
Low-level interfaces - that's it!

TCAir

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: RaspCORE - Raspberry PI Lasertag-System (my ideas)
« Reply #14 on: December 03, 2015, 06:57:33 AM »
Ok,

So Raspberry Pi Zero is out for $5.  https://www.raspberrypi.org/blog/raspberry-pi-zero/

This makes the fully functional Raspberry Pi competitive with Ardunio for taggers and give alot more capability.

Time to resurrect this thread?