Ouch! Won't this have the potential to be a dead short if both sensors detect a reflective media at the same time thus energizing both the forward and reverse relays at the same time? I think some code is needed to prevent that scenario. Also, relays are mechanical and are not instantaneous. One relay will be slower than the other to operate; therefore one may still have it's contacts closed (although the coil is no longer energized) when the other relay closes it's contacts , i.e., same same dead short scenario. Some delay is needed to ensure the previously energized relay has opened it's contacts before energizing the other relay.
I wouldn't call it a power loss; that suggests not having enough power. It would be a power waste in that the differential between input an output of a regulator is burned off as heat. e.g. for the 7812 the input is 19, the output 12 so 7 volts is 'burned off'. How much power is wasted can be determined by multiplying the voltage differential by the current going through the device. If your not energizing the solenoid ALOT, I wouldn't worry about it unless your running off a battery or battery pack; and I doubt that since 19 v would be an uncommon battery voltage. Same with the 7805. With your circuit you are only powering two ICs and the logic voltage they use is only for signals. The other way to go about it is to use switching regulators but they are significantly costlier.
Using a voltage divider for power is pretty much a no-no. In order not to have significant current flowing through the divider when connected across a potential, you've got to use some pretty high resistances. When you go to power a device with the divider, one or the other of those resistances will be in series with that load. A good amount of the voltage you need for your device will be dropped across the resistor.
Keep in mind that the 78xx series of regulators are only good for about an amp. They both have big brothers available in a TO3 package good for about 3 amps.
Found this: Properties of Pins Configured as INPUT Arduino (Atmega) pins default to inputs, so they don't need to be explicitly declared as inputs with pinMode(). Pins configured as inputs are said to be in a high-impedance state. One way of explaining this is that input pins make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 megohm in front of the pin. This means that it takes very little current to move the input pin from one state to another, and can make the pins useful for such tasks as implementing a capacitive touch sensor, reading an LED as a photodiode, or reading an analog sensor with a scheme such as RCTime.
on the Arduino site under Learning/Foundations/Microcontrollers/Digital Pins.
Why is a transistor needed? Couldn't the 10K resistor be in series with the photo-interrupter collector to 5V line and the emitter of the photo-interrupter tied to ground; the signal being read at the resistor-collector junction? - Scotty
Recently had an opportunity to work on a vehicle (Infiniti) that had an Idle Air Control valve with a stepper motor control. Perhaps some automotive devices would work. Not all automotive valves are just open/closed.
One way to program for that would be to use a variable to keep track of how many times the momentary switch was depressed and to use switch / case (http://arduino.cc/en/Reference/SwitchCase) to control (turn on/power up) your output pins. After the count of three and your outputs have been turned off, reset the variable to zero.
You will need to use debounce circuitry or code to eliminate any false counts due to contact bounce().
Only very small relays can be driven directly from an Arduino pin; otherwise you sill need circuitry to drive the relay. If the relay is small enough to be directly driven with an Arduino pin you will have to connect a diode across the relay coil to protect the Arduino.
I think that installing the photo sensor in a small length of tubing would eliminate any ill effects from ambient light. In the future a solution for that problem would be to use a modulated ir receiver and an ir led. A common use is a tv remote. Most use 38khz streams of ir light and the receiver is tuned to that frequeny and 'blind' to other light. There's a library available to generate the 38khz from the Arduino. - Scotty