photoelectric counter sensor to increase/decrease speed code??

Hi,

I'm new to using arduino and electronics for that matter. I am hoping to employ the arduino in my sculptures to create movement. Here's what I'm hoping to get it to do, and maybe someone might point me in the right direction to find or write a code.

I want to use a photoelectric sensor to create incrementing values and decrementing values (through counting) to control the speed of a DC motor.

when the first sensor is tripped on entrance by a person into the room, the value would increase (+) which would speed up the motor (20 people is = max speed, after 20 it continues at max)

when second sensor is tripped by a person on exit of the room, the value will decrease (-) the speed of the motor ( everyone leaves the motors stop)

I will be using 2 standard 12V motors (max I'd like to run them is around 8 volts)
I'll be running them off of L293D Secret motor driver and an arduino uno.
not quite sure what sensor I will be using quite yet.

any suggestions?

thanks!

First, you need to describe the entrances to and exits from the room. Counting the number of people in a room is not a simple project. If people can enter and exit through the same opening, it becomes nearly impossible.

Second, this really isn't a programming issue. It belongs in project guidance.

Third,

I will be using 2 standard 12V motors (max I'd like to run them is around 8 volts)

Why? Motors are specified as requiring a certain voltage. Running them with higher or lower voltage is not a good idea, generally.

Fourth,

I'll be running them off of L293D Secret motor driver and an arduino uno.

These probably support variable speed, but, depending on what the motors are doing, you may or may not be able to drive them at 20 discrete speeds. There may be a minimum setting required to get them to begin moving, and the remaining range from just moving to full speed may not lend itself to 20 observable different speeds, especially if you are under-powering the motors as you suggest.

You'll need to provide more details if you want help.

To answer your questions...

  1. The entrance will be gated. one-way door in, and one-way door out. one sensor to count the incoming people, and one sensor to gather the outcoming info.

  2. what do you mean by project guidance? I know there are a lot of variables I haven't considered quite yet, but the hardest part is setting up a code to operate my object. The rest I'm hoping to configure when the time comes.

  3. You're right about the voltage issue, as long as I can control the speed, it should be running at its intended voltage for maximum efficiency.

  4. I didn't consider the amount V necessary to actuate the motor.

The motors will be tuning a cam system, which in turn will be pushing rods. cables are attached from my sculpture to the rods to create push/pull of the wire to create movement. I can always gear the cam system down or up depending of the output of the motor. If 20 speeds is not reasonable, I will work with what I've got to get them to do what they are capable of doing. I can always change the rhythm, for every 3 people it speeds up eventually reaching its max even if that is only 5 increments.

What else would you need to know?

Thanks for your suggestions and help!

  1. The entrance will be gated. one-way door in, and one-way door out. one sensor to count the incoming people, and one sensor to gather the outcoming info.

Still not quite enough information. Is this a turnstile type entrance that only admits one person at a time? Is there any possibility of a person starting to enter, therefore registering a count, and then not actually entering? Is there a possibility for two people to enter together, and only register one enter?

Same on leaving.

  1. what do you mean by project guidance? I know there are a lot of variables I haven't considered quite yet, but the hardest part is setting up a code to operate my object. The rest I'm hoping to configure when the time comes.

How can you be writing code when you haven't even chosen an appropriate sensor/mechanism to count people going in or out? Choosing an appropriate sensor is not a programming question. It is a Project Guidance question, and there is a forum section for that. Plenty of people there will have good ideas on how to accomplish your objectives. Once you know what hardware you are going to use, and how it will be set up, then you are welcome to come here for help with the programming.

If 20 speeds is not reasonable, I will work with what I've got to get them to do what they are capable of doing.

Good to be realistic and flexible.

What else would you need to know?

Assuming that the entry and exit portals only allow one person at a time through, and there is no possibility of a miscount, will you actually be able to add sensors to the structure to count people going in an out? How far apart are the entry and exit portals? How will you run wires from the entry and exit portals to the Arduino?

None of these questions are meant to discourage you. They are simply an attempt to get you to think about, and perhaps communicate to us, the complete picture.