- Ozeki 10
- Analog Sensor
- DC Motor
- DHT Sensor
- ID Manager
- IR Transceiver
- Arduino Mega
- Arduino Nano
- Arduino Uno
- Chat Control
- LCD Display
- NFC Reader
- Optical Gate
- RF 433 MHz
- RF 2.4 GHz
- RGB LED
- RGB Sensor
- Rotary Encoder
- Servo Motors
- Stepper Motors
- Switch Controller
- Temperature Sensor
- PBX VoIP Phone
- Speech Engines
- Autoconnect to Serial
- Installation guide
- Terms and Definitions
- Ozeki 10 Guide
- HTTP API
- Bulk Messenger
- Cluster Software
- Developer tools
How to use an Arduino Joystick
In the following guide, you will learn about the Arduino Joystick. The Analog Joystick is similar to two potentiometers connected together, it can be very handy for retro gaming, robot control or RC cars. The guide contains some basic information about how an Arduino joystick works, then you will be able to see how you can work with a joystick connected to your Ozeki 10. First, let's start with the basics of Arduino joystick.
What is an Arduino Joystick?
The joystick in the picture is nothing but two potentiometers that allow us to messure the movement of the stick in 2-D. Potentiometers are variable resistors and, in a way, they act as sensors providing us with a variable voltage depending on the rotation of the device around its shaft.
How does an Arduino joystick work?
The joystick sends two analog values to the Arduino board. These values represent the position of the joystick on the X and Y axes from the range of 0 to 1023. This means, when the joystick is in the middle, these values are 511,511. If you turn the joystick on the horizontal line, the X value changes between the range and the Y value changes when you turn the joystick on the vertical line.
How to use an Arduino joystick?
To work with an Arduino joystick, you need to connect some wires to your Arduino as the wiring diagram (Figure 1) shows it. The GND pin from the joystick needs to be connected to the ground (Gnd). The +5V pin goes to the 5V pin of the Arduino. Then, the VRx and VRy pins go to two analog inputs and lastly, the SW pin connects to a digital input.
Arduino Joystick wiring diagram
How to use an analog joystick in Ozeki
Analog Joystick connections guarantee that all of the joystick interactions are forwarded to a selected connection in your Ozeki software. You can test your own joystick through the GUI as you can see in the 3rd video below. Most analog joystick has a top button as well which can be handled by this connection. To use the Arduino Joystick 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 Joystick 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 joystick and Ozeki will communicate over the USB port using the Ozeki Joystick protocol. This protocol makes it possible for you to use the joystick directly on your PC. You will be able to control this joystick 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 joystick 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 joystick.
- Follow the wiring diagram to wire the joystick to the Arduino
- Connect the Arduino to your computer using an USB data cable
- Check the COM ports in Windows device list
- Open the Arduino application on your computer
- Upload example code to the Arduino
- Open Ozeki 10 GUI in your browser
- Select the connection of Arduino joystick
- Move the joystick and check the movements in Ozeki 10
The system we suggest consists of a joystick, that is 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
- Analog joystick
- 1kΩ resistor
- Ozeki 10 installed on your computer
- Programmable board (Arduino Mega/Nano/Uno)
- USB cable between the board and your computer
Step 1 - Wire the analog joystick to your Arduino
You can see how to wire the analog joystick 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 joystick
Step 4 - Configure your joystick in Ozeki 10
In order to configure your joystick (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 jostick protocol
The Analog Joystick 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 a keyboard in arduino
- How to use an LCD display in arduino
- How to use an NFC Reader in arduino
- How to use an optical gate 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