Book Image

Arduino Essentials

Book Image

Arduino Essentials

Overview of this book

Table of Contents (17 chapters)
Arduino Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

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 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...