How to use an Arduino optical gate
This guide is going to demonstrate how you can build an optical gate in Arduino by using some of its sensors. With an optical gate, you will be able to monitor for example, daily traffic in a store. The guide consists of some basic definitions and a step by step guide, which shows, how you can build your own optical gate with Ozeki 10 on your computer. Let's start right now.
What is an optical gate?
Optical gate is a gate with two states. One state is for when nothing blocks the sensors of the gate. The other state occurs when an object blocks a sensor and breaks the optical circuit.
How to use an Arduino optical gate?
To operate an Arduino optical gate, you need two sensors, an infrared and a photo sensor. You have to wire them to your Arduino as you can see it on the wiring diagram (Figure 1). When you finished with the wiring, now you have an optical circuit if you face the two sensors to each other and it is operating now as an optical gate.
Arduino optical gate wiring diagram
How to use an Arduino optical gate in Ozeki
Optical Gate Controller connections forward optical gate status information to a selected connection added to your Ozeki software. Optical gates are basicly an infra LED and photo sensor facing each other. If something blocks or unblocks the gate than Ozeki software will receive the changed status as you can see in the 3rd video, below. To use the Optical Gate in Ozeki, you first need to download Ozeki Robot Developer. Ozeki Robot Developer will install the Arduino libraries needed to use this sensor efficiently.
After Ozeki Robot developer is installed, you need to upload the Optical Gate control code to your Arduino. You can find the code and download instructions on the following pages. The upload process includes two steps: first you need to format the EEPROM of the arduino, then you need to upload the control code. The procedure is very simple, it only takes a few seconds.
The arduino sensors and Ozeki will communicate over the USB port using the Ozeki Optical Gate protocol. This protocol makes it possible for you to use the sensor directly on your PC. You will be able to control this sensor through the web based user interface or you will be able to communicate with it using Ozeki Chat. You can read more about chat control on the following page.
It is important to understand chat control, because when you build a robot, the way you wish to control this sensor is by sending and receiving messages. If you open the Ozeki Robot Developer app, you will see, who you can write a C#.Net program to work with this sensor.
- Use the wiring diagram to connect the optical gate to your Arduino
- Plug the Arduino board into your computer
- Check the COM ports to see if your Arduino is connected
- Open the Arduino application on your computer
- Upload example code to the Arduino
- Open https://localhost:9515 in your browser
- Choose the connection of Optical gate
- Test the optical gate by placing an item between its sensors
The system we suggest consists of an infrared and photo sensor, both wired to the analog port of your Arduino. The Arduino will be responsible for reading data from this device in real-time. The brain of the system will be running on a PC (Figure 2). On the PC, Ozeki 10 will be able to manage the communication. You can easily run Ozeki 10 using a webbrowser
- Optical gate
- 100Ω and 100kΩ resistor
- Ozeki 10 installed on your computer
- Programmable board (Arduino Mega/Nano/Uno or Raspberry Pi)
- USB cable is needed between Arduino Mega/Nano/Uno and your computer
Step 1 - Wire the optical gate to your Arduino
You can see how to wire the optical gate sensor to any of the following boards:
After wiring, please plug the board to your computer!
Step 2 - Upload code to the microcontroller
Step 3 - Start Ozeki 10 to try the optical gate
Step 4 - Configure your optical gate in Ozeki 10
To be able to configure your optical gate (attached to your Arduino) in Ozeki 10, that is installed on your computer, you need to open the graphical user interface (GUI) of Ozeki 10. You can open the GUI by entering the URL of the computer into your webbrowser. For example, if our PC has an IP address of 192.168.1.5, we would enter http://192.168.1.5:9513 into our webbrowser.
Step 5 - Understand the optical gate protocol
The Optical Gate Controller can communicate with Ozeki through the following protocol.
- Arduino sensors and actuators
- How to use an analog sensor in arduino
- How to use a button controller in arduino
- How to use a buzzer in arduino
- How to use dc motors in arduino
- How to use a dht sensor in arduino
- How to use an EEPROM Manager in arduino
- How to use a gyroscope sensor in arduino
- How to use id manager in arduino
- How to use IR transceiver in arduino
- How to use an analog joystick in arduino
- How to use a keyboard in arduino
- How to use an LCD display in arduino
- How to use an NFC Reader in arduino
- How to use a register in arduino
- How to use an RF 433 MHz transceiver
- How to use an RF 2.4 GHz transceiver
- How to use an RGB LED in arduino
- How to use an RGB sensor in arduino
- How to use a rotary encoder in arduino
- How to use a servo motor in arduino
- How to use a stepper motor in arduino
- How to use a switch in arduino
- How to use a temperature sensor in arduino
- How to use a timer in arduino
- How to use an ultrasonic sensor in arduino