Shooting Gallery Advice

Hi everyone,

I'm building a shooting gallery game that uses IR to trigger different props. There would be various targets setup in the scene, each with an IR sensor, which would trigger something to control a prop. I'm hoping to make it flexible so I could utilize different methods, such as pneumatic valves, DC motors, servos, etc... Also, I would like to have a different sound clips played when each target is hit (to match the prop).

I have built a prototype gun and target, which has been working great. But, I'm having a hard time figuring out how to scale this beyond the one test target I made.

I thought about using an Arduino Mega, but I would have so many wires to run since each target would have an IR sensor and red LED and would need to be connected to the Mega. Each prop motor would need to be connected as well, so that's more wires to run.

Should I consider using a Nano in each trigger? That could read the IR then trigger the prop, but I'm not sure what to do about sound effects. I'd like to have one central sound system to play all the game sounds.

I do have a Raspberry Pi I could use in the game too, if that would help.

If anyone has any thoughts on how I can pull this off, I would really appreciate it. Thank you!

Is there ever likely to be more than one gun? If not, the targets only need to signal their identity to a central controller whenever they get hit.

An IR receiver will turn on whenever it gets hit with a modulated beam. Something as simple as a 555 timer could send a pulse to the central controller. All targets would use the same wire and the pulse length would identify which target was hit. The central controller could then trigger actions and sounds based on the identity of the target that was hit.

For more complex signaling it might be necessary to have a small processor (ATtiny?) at each target.

Thanks for the advice.

There will actually be more than one gun. I'm planning on 2 - 3 guns for the gallery.

I also should mention that I am very new to Arduino and electronics in general (besides making basic LED circuits). I've read several books on Arduino, done lots of exercises, watched videos, etc... But I definitely feel like I don't have the experience yet to connect all the dots for this project. So even advice on what topics to research would be helpful as well. Thanks! ;)

I have been building something like this for years (on and off).

I have setteled with a Arduino in every Target and i use Ethernet Patchcables for Power+RS485 signaling. One "master arduino" controls all the others on the RS485 Network.

Before that is used a bunch of shift registers and input expanders (again with ethernet cables) with a single microcontroller. I have got a very old video here: https://www.youtube.com/watch?v=R4g7xwekpLc

I am using home made shock sensors and airguns though, but the principle is the same.

With multiple guns and lots of targets the task gets more complex. For keeping score the central controller needs to know which gun hit which target. If the guns are free-firing there is a good chance that two targets will be hit simultaneously.

Are the guns mobile or on wires? If they are on wires the central controller could enable them round-robin so that whatever target is hit can be attributed to the currently enabled gun. Since the speed of light is fast this could allow the guns to appear to shoot simultaneously.

If the IR senders in the guns are bright enough and concentrated enough to be easily separated from ambient light it should then be sufficient to detect a bright light. That would simplify the targets. You would need a IR phototransistor, a resistor and capacitor for integrating the ambient light, and a comparator to detect light well above ambient.

For getting the signal from the target to the central controller you will need wires. They are typically subject to picking up noise so using differential drivers over twisted pairs would be good. Cat5 Ethernet cable has four twisted pairs so you could use one cable for each group of four targets. At the central end you would put differential receivers and shift registers. If you make modules with two Ethernet jacks, eight receivers and a shift register you can daisy-chain them to add targets in groups of eight. The SPI interface can read all the shift registers at almost 8 megabits per second.

For each gun: enable the gun (Light the IR-LED if the trigger is down) read the target inputs with SPI disable the gun Act on the target, if any that detected the light.

A small Arduino can do the receiving and send Gun/Target pairs to a nearby Master Controller over I2C. That would allow the guns to be responsive and give the Master Controller lots of time for controlling effects and keeping score.

Thanks so much PeterFW and johnwasser for your replies! Very helpful and pointed out new areas to research that I wasn’t aware of.

I am now leaning towards the idea of having an Arduino in each target. If each gun sends unique IR pulses, then the target would know which gun triggered it and could report back to the main controller. Each gun would be wired to an Arduino that would handle sending the IR signal, as well as keep track of the shots taken and play a gunshot sound.

Would I2C allow me to connect each target to a main Arduino? I saw examples of Arduinos daisy chained together, but I would quickly run into problems with the chain being too long. That made me wonder if I could run a wire between each target and the main (the max distance away would probably be around 4m). But I am not sure if it is even possible to have 10-15 targets connected to one Arduino.

RS485 also looks like the a good way to have the communicate back to the central controller without the limitations that I would run into with I2C. However, as a beginner, I am a little worried about finding enough information that make that work (whereas Arduino has the built in Wire library for I2C).

No, I2C would not be suitable for this task, RS485 is what you want and would be completely effective - use CAT5 cable with one data pair and others for power distribution (at 9V, locally regulated at each node).

I do not recall what libraries are available, but what you are looking at is a “packet” protocol where a device monitors the common line, and given that nothing is happening at a given moment, enables the transmitter function and sends a serial “packet” containing a synchronising character, the address of the device it is sending this to, its own address, the length of the packet and the data to be conveyed followed by a checksum. It then anticipates a reply and re-sends the packet if necessary to ensure receipt.

Also consider something like NRF24L01+ as a means of communicating bact to the center. = cheap & good.

For more inspiration check out the ideas on the laser tag forum here (all IR based) http://www.lasertagparts.com/forum/

To minimise conflicts between targets etc, : - use TSAL6100 which has a narrow beam angle - some method of making the beam directional like a small narrow pipe or heat-shrink tubing over the IR LED - reduce the current going thru the IR LED to just above the minimum required at maximum range - sunlight,plasma TV, etc are not your friends (=interference). So make sure you use coded signals and not just uncoded modulated IR. - It is also posssible to use (more) directinal IR receivers and to put in some physical obstruction mechanism to restrict activation (rx) to a particular area(angle)

I've been continuing work on the shooting gallery, but I can't decide how to handle communication with the targets.

All the targets (15-20 of them) will be connected to a main controller Arduino. I am planning to use RS-485 modules for the communication. Since it requires a master/slave setup, the main would have to poll each target for a status. Would that cause too much of a delay while it is looping through the targets? I wouldn't want the system to miss a hit on a target.

I'm also considering NRF24L01+ modules, but I wasn't sure if having 20 of those running would cause interference issues. Is that something I would need to be worried about?

Ideally, I'd like to have the target send data directly to the main when a hit is registered (rather than the main controller polling them all).

If anyone has advice and can point me in the right direction, I would really appreciate it. Thank you!

let the targets be leds in an array, as you only need one led at a time you can put them direct on the outputs. in the gun a simple receiver ir or visible. set led1 on check if receiver sees the pulse, next led and check if you see the change there us a hit.

It will be a lot simpler if you cluster multiple targets into each arduino.

Presumably only one target is hit at the same time.

Either of your approaches should work.

What is the scale...distance to and between targets?

goosta: Since it requires a master/slave setup, the main would have to poll each target for a status. Would that cause too much of a delay while it is looping through the targets? I wouldn't want the system to miss a hit on a target.

If the individual "nodes" each contain an Arduino-type controller, they cannot miss a hit - they will wait until polled to report it.

goosta: I'm also considering NRF24L01+ modules, but I wasn't sure if having 20 of those running would cause interference issues. Is that something I would need to be worried about?

Not a great deal. Not sure what sort of receivers they have, but interference would generally only be caused by other transmitters, and if polled, you avoid that. So whether you use RS-485 or Wireless, you will be polling.

goosta: Ideally, I'd like to have the target send data directly to the main when a hit is registered (rather than the main controller polling them all).

If you do not poll, you have to manage collisions - that potentially puts your timing out.

At 9600 baud, 960 characters per second, six characters per poll, you will be polling about 80 stations per second.

I'll leave you to figure the consequences.

couple of thoughts.

if you have a pulse, say an 8 digit value all start with 1010 end with xxxx that would offer 16 transmitters.

each pulse would have to be ‘seen’ 2-3 times in a row to count. that would prevent the trigger hold and just random movements. probably require the transmitter to only send x number of sequences per trigger pull.

if each target has a receiver that was dedicated for that target, it could output parallel values to a shift register. with 8 ports per target, all the information needed could be sent.

how long would it take to read the values of 20 shift registers ? 78mhz

I do not see the need for wireless. all the targets have to have power, have some sort of automation to do something, etc. there will be lines run to each target for other reasons. adding some wire would be simple. besides the arduino that would control the automation would need to be wired or connected to each target anyway.

this project seems to be in need of an operational schematic/flow chart or some such.

the trigger pull could start a sequence of 5 pulses, then with a hold, a sequence of battery level or some such. have a calibration target for reading the ‘other’ information.

just some thoughts.

Thanks so much for the replies - I really appreciate it!

The gallery will be setup within a 12' by 8' area, so that would be the maximum distance between targets.

I am using the IRremote library which limits the amount of IR receivers I can have hooked up (with modifications, it can handle 2 max I have read). So that's why I am planning to use a pro micro or nano for each target. I was thinking I could have the target Arduinos handle the prop triggering too (since it would be near the motor/valve/etc), but the only issue with that is sound. It would be cost prohibitive to buy a sound board for each target.

So now I am thinking maybe the best option is to use an Arduino/Raspberry Pi combination as the main controller. That way I could have it handle the prop triggering and sounds (through pygame in python for example). It sounds like polling is the route I should take, so the process becomes:

Target: Checks for IR pulses - If valid pulse, status = hit

Main: Polls each target, checking for hit status - If hit: disable target (turn off red status LED) trigger prop (i.e. turn on motor, move servo, open solenoid valve, etc..) add up player score (based on gun ID - each gun uses different IR pulse) re-enable target (turn on red status LED)

I am definitely having a difficult time figuring out how to integrate sound. It seems like it would be best to have a Raspberry Pi handle that because it needs to play sound clips asynchronously and simultaneously. If I could have an easy way to connect to it from all the Arduinos, then I could just have it call that during a prop trigger function for example. So say there is a tin can on a log, the trigger function for that sends a request to the Raspberry Pi to play a "plink" sound, while the Arduino tells the servo to move 180 degrees. There are also other game sounds - the gunshot for example when the trigger is pulled, start game, end game, etc...

Does it sound like a viable option then to connect an Arduino and Raspberry Pi, then use python to play sound clips?

I am using the IRremote library which limits the amount of IR receivers I can have hooked up (with modifications, it can handle 2 max I have read). So that’s why I am planning to use a pro micro or nano for each target. I was thinking I could have the target Arduinos handle the prop triggering too (since it would be near the motor/valve/etc), but the only issue with that is sound. It would be cost prohibitive to buy a sound board for each target.

Assuming there is only one shooter active at the same time & depending on your coding skills you could actually put all IR receivers into one Mega(or maybe 2 standard arduinos). But you would have to write some code using PCINTs (Pin change interrupts) to decode the signals. As you are only looking for one protocol (i.e. your own), it shouldn’t be too difficult. Using dicrete LOGIC ICs(OR gates / Flip Flops) could also help.

(For example, we have worked recently on a system with 8 IR receivers feeding into just one ATTiny - all receiving simultaneously…so it is possible)

You should only need one sound generator which gets activated by a signal from any of targets when hit!

The RPi sounds like a good choice, but also look at the Teensy3.1 which has some good sound stuff available and a very powerful MCU (circa $17 at OSHPARK). With a bit of thought (+ design) you could probably get it all working on a single Teensy 3.1. :slight_smile:

Remember you can have start up delays & corrupted SD cards on devices like RPi…microcontrollers generally give you more reliability/ instant on…etc

Hi Guys I wanted something like the youtube video but have no idea how to program can someone help?