200 inputs

Hey guys and gals,

I am starting a new project a friend and i are starting to design a laser maze, i have the hardware down, i know how i am going to build the laser modules, and the receiver modules, as well as how to hook them up to the arduino. so i am really not too worried about that portion of the build. im also taking a course on how to program arduino right now, so i should have the required knowledge in order to actually program the arduino.

We are currently in the planning and designing stage of some software to be able to interface with the arduino. we want it to pull out specific information from it. like say specifically we want to view how many times a laser has been tripped. there will be more information that we want to receive but this will be a start. it will be a multi player game and will also have multiple checkpoints that will all have to be sent from the arduino to the pc.

my question is what program or set of commands would i use? what would be the best way to actually pull out and retain this information. perhaps store it in a data base for a while.

i have been trying to research it on my own and i haven't really come up with much. (prolly because im not seraching the right terms)

i understand that i can use serial or ethernet (with a shield). we have found a program that is already built that we might be able to reverse engineer to make this happen and since my friend can program in different languages im sure that will be fairly easy but first we need to figure out how to get the information out of the duino and into that program.

i just bought a book called "Processing A Programming Handbook for Visual Designers and Artists.2 edition" as i read in forum that this would help me in my quest.

if some one could point me in the right direction i would really appreciate it.

thanks in advance for all your help with this.

What is a laser maze?

Where will the Arduino fit in?

You are making the common mistake of assuming that your readers (us) know all about your project when, in fact, we know nothing about it.

An Arduino can only be programmed in C/C++

...R

Ahh you are correct, i just assumed that you knew what it was that i was trying to do.
the easiest way to explain it is to show a picture, which i have attached.

i know that the parts needed are fairly easy to put together. the long and the sort of how i will be using the arduino is it will control all of the physical sensors.

one laser when activated will shine onto a photosensor, which when broken will indicate that it has indeed been "broken" . this will also control the power to the laser through a low voltage relay. as the minute it is broken i want the laser to turn off for a set amount of time (5-10 seconds for protection).

basically i will repeat this scenario for as many laser clusters as i need.

before a player joins the game they will be able to choose their difficulty. (easy,medium,hard, extreme) which they will need to choose before they enter. basically easy will be one set of lasers, medium will contain all of the easy lasers plus add another set, and so on and so forth.

the player will also be able to choose how many players it will be upwards of 4 players per game. or a solo game. so this will be another selection they will have to make. there will be 4 buttons at the beginning for multi player. a solo game will consist of 4 colored buttons that have to be pressed in a sequence. same as the other players. each payer will have to hit their buttons to be able to move on to the next button.

this will naturally be a timed event. so i would like a leader board, as well as how many lasers have been tripped.

im in the process right now of doing up a flowchart on how it will all work if that will be beneficial i will upload it as soon as i am finished

From your photo, it looks like your lasers are spread out over a substantial space, so I suppose this is not a hardwired application, but will involve wireless in some form.

If the primary data you want to gather is when a beam has been broken, you might obtain some little OOK transmitters. These are stone simple and dirt cheap. All they do is transmit a sine wave when a pin on them is held high.

So (based on what I think you're doing), put one of these at each photosensor, and rig a little 555 timer to activate each one for short time. Then build a master station with an arduino and a mated OOK receiver. If each of the transmitters send a signal of differing time length, you can use an arduino interrupt to note the start of a receipt, and time how long until it ends. (I've done something like this in a distributed sensor system.) That distinguishes the separate laser beams.

Turning the laser off for a few seconds again could be done with a timer: no Arduino needed.

If more than one person is going to be in the beams at the same time, the above would not work. You'd have to go to some sort of transmission acknowledgement system. That can still be done with these radios, but now you'd need more smarts at the transmitters, so you'd probably need to add an arduino to each transmitter.

Good luck. It sounds like fun.

Image from Reply #2 See Image Guide

...R

Hey thanks for your reply,

in a commercial setting which this one would be i've not really had much luck in the wireless realm, therefore i would prefer to keep everything hard wired.

i have seen this sort of thing done before. there was a guy who created an instructable for a halloween laser maze in 2012. im sort of following in his footsteps. i looked at purchasing an already made system but they range from 25-100 thousand dollars. i know for a fact that it doesn't cost any where near that in parts. and i've partnered with a guy to develop the software. were mutual in that i want one of these as does he, so were not charging each other for the our time.

all though the lasers are spread out over quite a distance, we will be using first surface mirrors to essentially "double" the beams.

i've done an initial calculation of how many physical sensors that i will need to control (sensors meaning photo diodes, buttons & laser control) and i am currently at 64. im going to build in extra so that if i wanted to expand later on than i would.

i understand that initially the arduino uno can only control 14 sensors, how ever if i upgrade my unit to the ATmega, it can control 54 i/os and i just discovered that i could use I2C to link 2 or more arduinos in a master/slave configuration.

the other option that i have come across is daisy chaining shift registers. i read an forum post the other day where a guy got 15 shift registers working which controlled upwards of 120 devices using the shiftout command.

so with that said i am currently trying to figure out what the longest distance i could transmit a signal to control a 5v relay, used to turn the individual lasers on and off. also will need to figure out the distance i could receive a signal from the photo resistor.

also once i get all of the hardware working, (i will be building a mocked up room for testing, and i have all of the circuit designed i will end up having a custom prototype board built so we can than sell the solution as an open source solution.

but first things first.

lets say for instance i have everything built according to how i have described. i have all of my sensors working back to the arduino, using say shift registers. once i have everything working in that respect how would i go about extracting the information that i require from the arduino.

would i export it to an excel spread sheet and pull the information off there? or what would be the best solution in this respect?

the arduino uno can only control 14 sensors

You do not control a sensor you read then. There are 20 pins on the Arduino that can be used as a digital input. The analogue inputs can be used as digital inputs as well.

The best expansion would be the 23S17 - you can use up to 8 of these and each one gives you 16 inputs. The best bit is that you can monitor all 16 inputs without having to read all the inputs by using the interrupt pin on it, this changes when there is a change of state on any input on that chip. This makes it easy and fast to use.

how would i go about extracting the information that i require from the arduino.

What information do you want to extract?

would i export it to an excel spread sheet and pull the information off there

This is possible but stupid.

Have the Arduino communicate with your computer and have a program written in Processing display your results in the form you want.

What information do you want to extract?

i want this information;

-how many times a laser was broken
-which laser was broken
-which buttons (inside the maze) have been pressed and which ones are still outstanding
-its a timed event, so it will have the cumulation clock (most likely programmed off the computer)
-which mode was selected (easy,medium,hard or extreme)
-which player mode was selected (1,2,3 or 4 player mode)

i actually just had a quite a big change that i think would make more sense to do, rather than leaving all of the heavy lifting for the arduino to do, what i think would make more sense, now after conversing with my buddy, is to write the program to interact specifically with the arduino.

so now the new question would be, how can i relay any of the information that is received by the arduino directly to the computer. instead of trying to fish out specific information. i want all of it.

i want the state of each laser, the state of each photo diode and the state of each button. basically any and all information that is located within the arduino network of sensors, i want that passed over to the pc. preferably over ethernet.

Last paragraph of my last post tells you.

You communicate with Processing through the USB serial port. Do not be tempted to use Firmata on the Arduino as that will not be able to cope with the port expanders you need to use.
You could also use an Ethernet shield on the Arduino.

Processing is free and is very much like C, only it is Java.

so with processing, we can just push all of the information directly from the arduino, to the pc via ethernet. this is perfect.

now i assume there will have to be some coding on the arduino that will allow all of this to seamlessly work together.

any chance you could point me to an article, or a tutorial or something that could point me in the correct direction?

i really appreciate all of your help thus far Grumpy_Mike, so far you dont seem THAT grumpy. maybe your just misunderstood

Get the example code that comes with your Ethernet shield and work forum there.

Go onto the Processing.org website for lots of tutorials on that side, look at the Ethernet libraries.

Grumpy? You don't want to see me when I'm angry. :wink:

Thanks mike,

I'm already one step ahead of you, I've found a bunch of tutorials online, I'm already 6 videos down!

As for the shield once I get my other Arduino in the mail I'll dig into it a little more.

Thanks again!

Hey guys and gals,

so I have been trying to do my research, but I continually come up with a dead end. What I'm looking to do is build a project that will require upwards of 200 inputs/outputs.

I have been considering running shift registers , as I read another post that suggested that I could indeed do this, but it would be very slow.

So what I have been searching for us an arduino compatable board that can monitor that many I/o's

The long and the short of it, I'm building a fun laser maze. The lasers will be powered seperatly through a relay, also the lasers will point to an LDR.

Essentially if the laser trips, the LDR will inform the duino which will deactivate the relay, turning the laser off for 5 seconds.

Also the duino will monitor the state of each LDR and relay that information to the PC via usb/serial monitor where I will have a program that can decipher what's going on.

I just read another post that suggested there would be other chips that would be more suitable.

The long term goal is to build a custom board and custom modules.

Thanks for letting me Pick your brains

What does it mean too slow? How fast do you need them to be?
Why not use multiple arduinos to run multiple shift register chains, then have them all communicate to a master device? That would offer a faster scan through all registers.

What other post, what other chip?

Hi,
I think this explains some things.

http://forum.arduino.cc/index.php?topic=377373.msg2601804#msg2601804

Tom.... :slight_smile:

I have asked the moderator to merge this with your other Thread on the same project so all the info is in one place.

...R

Threads merged. And BTW "Can i get some help please" is not a great thread title.

joehleonard:
I have been considering running shift registers , as I read another post that suggested that I could indeed do this, but it would be very slow.

SPI / I2C port expanders. E.g. MCP23S17 and MCP23017 respectively.

With I2C, you can use 8, so 128 IO pins at the cost of 2 Arduino pins.

With SPI, you should in theory not encounter a limit (with additional glue logic). Not practical but you can go to over a million IO pins :smiley: Slightly simpler is 8 chips times 16 IO pins equals (again) 128; making use of the CS lines and you can multiply that. 16 23S17s will give you 256 IO pins at the cost of 5 Arduino pins.

See e.g. Using Serial Peripheral Interface (SPI) Master and Slave with Atmel AVR Microcontroller. About halfway the page is a diagram for 8. Duplicate and use an additional CS line.

Inputs need to be polled but making use of the interrupt outputs might make this easier.

I don't have much practical experience but I read a lot so what I would do:
I would be afraid of EMI affecting long cables. It is said I2C is greatly affected by sources of EMI such as electromotors and wireless communication of others (player recieving SMS etc.) Long wires have (relatively) high capacitance which may make such communication impossible without any interference (quick Google search result).
Using more microcontrollers could make the situation much better. I would try to have one MCU per one room (or smaller sector?) gathering information from a few nearby sensors and sending information to others MCUs if needed. The communication between MCUs wouldn't be time critical (uploading results with one second lag is no problem) so it is possible to use some error detecting protocol and send data repeatedly until they arrive uncorrupted.

As the central MCU I would definitely use Arduino board since it has connection to computer via USB. The peripheral MCUs could be nearly anything with enough pins. With proper settings you can program standalone ATMegas via Arduino IDE (look here). As long as you can provide the ATMegas with stable power supply there is nothing on the Arduino board you really need so standalone chip is cheaper smaller and cleaner alternative but you can still use your skills from Arduino programming course :wink:
Sidenote: Arduino board uses 16 MHz crystal to clock the ATMega chip. Standalone chip can use internal clock with only up to 8 MHz which is less stable than the crystal. But I doubt it would matter.

TomGeorge:
Hi,
I think this explains some things.

http://forum.arduino.cc/index.php?topic=377373.msg2601804#msg2601804

Tom.... :slight_smile:

This link doesn't work.

Ill find the other post and post it here. Some one eluded to the point that other chips might work for what I want.

Using multiple Arduino's, wouldn't that mean multiple serial monitors? Or can I just input all of them into one?