traffic light project

Hi everyone,
I apologize if my English will not be good, and if something is not understandable just let me know, I'll try to explain better.
I should start a little project for a laboratory course, but I never used Arduino before, and I am here to ask about feasibility:
the project is to build the model of an "intelligent" traffic light that switches from red to green in the different road lanes depending on the amount of vehicles waiting.

My idea is to simulate the waiting time of vehicles with a switch that would enable an integrator of voltage indicating the amount of time that a vehicle is stopped at the traffic light, more vehicles would activate more integrators.
The traffic light should give priority to the lane where the sum of those voltages is higher (with some sensible criterion above it, for example minimum green time required or something like that).

Here it is when Arduino comes: it should take all these voltages, and do some elaboration, like sum voltages representing cars from the same lane, and then compare the resulting voltages of the different lanes, to decide which one is higher and switch green a traffic light and red the others with a voltage output on some leds.

Is Arduino able to do these tasks?

Also the tricky part I suppose will be the one about setting integrators, do you see any difficulty that might come up and I have not seen perhaps?

Thanks for your attention to anyone who will answer

So you want to simulate vehicles arriving?

I'm not sure about your integrators. Why isn't it sufficient to remember the time of the first arrival of a vehicle at a (red) light, and then count the number of further vehicles in that chain. Then the elapsed time multiplied by the number of waiting vehicles will give the "weight" of that chain, for use in switching the traffic lights.

To make the scenario more random, you can add a pot for each light, indicating the arrival frequency of vehicles on that road. Then use random() to determine the time of the next arrival and, after that time has elapsed, increment the number of waiting vehicles.

First of all thank you for answering

I thought to use the integrators because I wanted a way to get the physical signal of the numbers of car, like in a real implementation (that of course I guess would use other sensors and not integrators, but so far that's what my knowledge let me think).

If I understood instead you are suggesting to "simulate" the arrivals through software, so that I would have only Arduino and its output, without any input signal though, is it correct?

Also what does pot means? Potentiometer?

Yes, "pot" means potentiometer.

Going back to your Original Post, I don't understand how your system will detect when another car arrives in the queue. Indeed I'm not even sure if you will be using real model cars or whether the whole thing will just be a software simulation.

AFAIK existing traffic management systems assess the demand on each road by the rate at which vehicles pass the traffic signal sensor in the road when the light is green. I don't think they have any system for counting the number of cars waiting.

IMHO it would be much easier to do the simulation in a PC program and (if necessary) use the Arduino to operate the lights.

...R

Robin2:
Going back to your Original Post, I don't understand how your system will detect when another car arrives in the queue. Indeed I'm not even sure if you will be using real model cars or whether the whole thing will just be a software simulation.

The idea was to build a little model without real cars, just a simulation on a breadboard. My system should detect other cars arriving in the queue just by activating another integrator whose voltage value could be added by Arduino to other possible voltage values of other integrators associated to other cars in the same queue.

Robin2:
AFAIK existing traffic management systems assess the demand on each road by the rate at which vehicles pass the traffic signal sensor in the road when the light is green. I don't think they have any system for counting the number of cars waiting.

Yes, I am trying instead a model based on waiting cars instead of the rate at which they pass while it's green.

Robin2:
IMHO it would be much easier to do the simulation in a PC program and (if necessary) use the Arduino to operate the lights.

The fact is that I still wanted to simulate an external physical signal to input for Arduino, just like in real world a real physical signal should be detected by a sensor, to be sent to a traffic light controller.
I didn't want just to simulate via software the arrivals.
And the idea was to use a switch to activate the integrator when the "car" arrives (it could even be a weight that presses the switch in the simulation, for example, it is secondary now what will simulate the car as long as it is not a software, but something generating an analog signal to give Arduino)

So my question was if Arduino could do the following tasks: adding the values of input voltages, and control some leds (but I guess it can)
and more important if you see any particular difficulty in building this system with integrators, or even if you have any suggestion to substitute integrators with other sensors that would pass a signal to Arduino, providing it is an analog signal, not just a simulation via software.

Thank you so much for your patience

You should give more information about your course. What's the field of study, what knowledge do you want to teach, what should the students contribute to the experiment?

There is nothing like an integrating sensor, that tracks the waiting time of a vehicle. You can put a number of sensors into a road, telling whether a specific area is actually occupied by a vehicle. Such a sensor delivers either a digital (on/off) signal, or an analog signal telling e.g. the mass of vehicle(s) in the covered area. Any integration of such a signal can and should be done in software, as I already outlined before. Or you put a light barrier across the road, at some distance from the traffic light, telling the arrival of vehicles. And last not least you need means to activate the sensors, or your experiment can never start.

And yes, an Arduino can do all that very well. It also can send information to a PC, for a graphical or other representation of the state of the experiment.

well, I am a student, not a teacher and I have to do this project for a class contest, so it's a project I thought, not given by my professor (The course is a basic microelectronics laboratory course).
I talked about integrators because we haven't seen anything about sensor so far, so I know almost nothing about them, we have already seen integrators and I thought they could have been used this way.

I also like the idea of light barrier though, the fact is we can not go to set all this outside on a real road, I must do all this in a laboratory, this is why I can't use real cars. If I got this kind of sensor I could simply break the light barrier with any object so to activate the sensors and I could send these data to Arduino for elaboration and leds switching, right?

So at this point my questione becomes: Is this a good modification for my project? Which sensor would you suggest?

Two traffic light projects in one week, but not the same.

Here is the other, some of that might help you: How to control 28 LEDs with an Arduino - Project Guidance - Arduino Forum

In real traffic here the road sensors used are magnetic, buried under the surface and real expensive. But if per lane you put 1 at the light and 1 perhaps 50m back you should be able to tell how many vehicles are waiting how long.

For other sensors, see what weather, maintenance and run costs will do. They don't use expensive units where cheaper over time or only works 90% of the time would do.

In a simple setup you can use buttons to signal the arrival of a vehicle. Or you can use a light barrier and model cars. Or a capacitor and a resistor, for your integrating sensor. Or only simulate arrivals using the random() function. It's all up to you.

I'd suggest that you start with buttons. Later, if there is time left, you can replace the buttons by other sensors. And you can use LED strips to indicate waiting vehicles in a model of the crossroads. And so on, open end.

So which sensor would you suggest to buy? It just needs to cover 50 cm, because it will not be used in a real road, (we have limited budget) but I need both the sensor and the light emitter.

For easy use I'd suggest hall sensors and magnets under the model cars. Light barriers are quite expensive, if ready for use, or require much code before they are really usable. For demonstration purposes you could use laser pointer diodes, to implement light barriers with visible beams and simple code. Other demonstration effects can be accomplished by RFID readers and tags on the cars, more impressive than the magnet and hall sensor approach.

usernamer:
And the idea was to use a switch to activate the integrator when the "car" arrives (it could even be a weight that presses the switch in the simulation,

One way to do that would be to use a series of toggle switches to add or remove resistors from a resistor ladder. Adding or removing a resistor could change the voltage detected by the Arduino ADC. You will need to ensure that the max voltage does not exceed 5v.

...R

For laser pointer diode do you mean something like this? Optek OPV332 Optek OPV332 Fiber Optic Device Components | Octopart Electronic Components

Could it work if I pointed that diode on a photoresistor, (example this http://uk.rs-online.com/web/p/ldr-light-dependent-resistors/0651507/ ) so that when something passes between them the photoresistor varies its resistance causing a variation in the voltage too, that could be read by Arduino and be processed as input data?

May this solution be affected by environmental light disturbance?

Robin2:
One way to do that would be to use a series of toggle switches to add or remove resistors from a resistor ladder. Adding or removing a resistor could change the voltage detected by the Arduino ADC. You will need to ensure that the max voltage does not exceed 5v.

...R

That could be another idea too, but if I used some sensors it would be better so I could cover more part of the course

Red laser pointer diodes operate at 5V 20mA, and cost about 1$. Their concentrated beam is much brighter than ambience light, so that the beam can be received without much shielding and post-processing by a LDR or photo diode. The visible beam helps in directing the diode towards the receiver.

A series of LDR's set into the "ground" and facing upwards would detect a car "parked" over them as it would block out the light. Again, they could be wired as a resistor ladder.

...R

DrDiettrich:
Red laser pointer diodes operate at 5V 20mA, and cost about 1$. Their concentrated beam is much brighter than ambience light, so that the beam can be received without much shielding and post-processing by a LDR or photo diode. The visible beam helps in directing the diode towards the receiver.

Where can I find these products? I found this photodiode, could it be ok? http://uk.rs-online.com/web/p/photodiodes/6548154/
I couldn't find laser pointer diodes as cheap as you said, could you tell where I can find them please?

Robin2:
A series of LDR's set into the "ground" and facing upwards would detect a car "parked" over them as it would block out the light. Again, they could be wired as a resistor ladder.

...R

I like this idea too, so is environmental light sufficient to create a sensitive variation in resistance when blocked?
Would this LDR be good for my purpose? http://uk.rs-online.com/web/p/ldr-fotoresistenze/9146710/

A reflected laser can blind someone. Hope you've thought that through.

If you cut the view of the sensor, it will read a signal light better. You can put it at the back end of a tube or put a plate with aperture in front and either way narrow the view of the sensor to prevent unwanted light from reaching it. That is all the 'beam' you need.

PS what gets set into real road surfaces gets coated with oil, grease and dirt regularly.

I admit that it was not easy to find, but after all I found this offer. A resistor can be used to reduce the current and brightness, so that such diodes can be driven directly by Arduino output pins.

usernamer:
Would this LDR be good for my purpose? http://uk.rs-online.com/web/p/ldr-fotoresistenze/9146710/

They should be fine.

It might be an idea to have one LDR exposed to the ambient light and never covered to act as a point of reference - but I suspect that would not be necessary.

...R

GoForSmoke:
A reflected laser can blind someone. Hope you've thought that through.

If you cut the view of the sensor, it will read a signal light better. You can put it at the back end of a tube or put a plate with aperture in front and either way narrow the view of the sensor to prevent unwanted light from reaching it. That is all the 'beam' you need.

PS what gets set into real road surfaces gets coated with oil, grease and dirt regularly.

Yes of course we will have to deal with this fact, too.

Thank you very much to all of you, I will decide with my group how to procede and will let you know how it goes, I also expect I could have further questions in the near future, but again thank you very much