The schematic of the coin detector

In the following diagram, you can see the complete schematic for the circuit we will use in this example:

The schematic of the coin detector

The complete circuit for an optical coin detector

As you can see, from the optocoupler side, I have only added the two resistors I mentioned previously: a 10K to act as a load for the phototransistor and a 470 Ohms one to limit the current through the infrared LED.

There is just an additional consideration. If you take a closer look, you could notice that in this case, I have connected the LED that is going to be used as the output side of our project in a different way than in other examples in the book.

In this case, I haven't connected the LED from the Arduino pin to ground but just the opposite way, that is, from 5V to the Arduino pin, just to show you that you can also operate the LED in a negative way. This means that setting the Arduino pin to HIGH won't allow any current to flow through the LED, and setting the pin to LOW will allow approximately 10 mA to flow through the LED and into the Arduino board.

I've done it this way just to show you that it is not always necessary to provide current to output devices, but they can also can be powered from the V+ voltage source and use the Arduino pin as a virtual ground as long as the total current doesn't exceed the 20 mA limit of the total current capacity of any Arduino pin.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.186.92