Ozeki 10
Analog Sensor Analog Sensor | Arduino Mega Arduino Mega

How to use an Arduino Button

This document is about to give you an introduction to Arduino Button. You will be able to see how it works, how you can integrate into your project, and how you can manage the button from your computer using Ozeki 10. The guide consists some basic definitions about the Arduino Button and a step by step guide with videos about how you can use it with Ozeki 10. Let's start with the basic definitions.

What is an Arduino Button?

The button is a basic component and widely used in many Arduino projects. It is simple to use. The Arduino buttons connect two points in a circuit when you press them.

How to use an Arduino Button?

Connect three wires to the board. The first two, red and black, connect to the two long vertical rows on the side of the breadboard to provide access to the 5 volt supply and ground. The third wire goes from digital pin 2 to one leg of the pushbutton. That same leg of the button connects through a pull-down resistor (here 10K ohm) to ground. The other leg of the button connects to the 5 volt supply.

When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton, so the pin is connected to ground (through the pull-down resistor) and we read a LOW. When the button is closed (pressed), it makes a connection between its two legs, connecting the pin to 5 volts, so that we read a HIGH.

You can also wire this circuit the opposite way, with a pullup resistor keeping the input HIGH, and going LOW when the button is pressed. If so, the behavior of the sketch will be reversed, with the LED normally on and turning off when you press the button.

Arduino Button wiring diagram

wiring diagram of arduino button
Figure 1 - Wiring diagram of Arduino Button

How to use an Arduino Button in Ozeki

Any button can be connected to your microcontroller which will be able to read the button status using Ozeki protocols. If you follow this guide, you will be able to see how easy you can run Ozeki software on your PC and build applications that can easily check if a button is pressed or released. To use the Arduino Button in Ozeki, you first need to download Ozeki Robot Developer. Ozeki Robot Developer will install the Arduino libraries needed to use this sensor efficiently.

Download Ozeki Robot Developer

Download Ozeki Robot Developer

After Ozeki Robot developer is installed, you need to upload the Button 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.

Upload the Button code to Arduino Uno
Upload the Button code to Arduino Mega 2560
Upload the Button code to Arduino Nano
Upload the Button code to Raspberry Pi

The Arduino Button and Ozeki will communicate over the USB port using the Ozeki Button protocol. This protocol makes it possible for you to use the button directly on your PC. You will be able to control this button 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.

How to communicate with the Arduino Button using chat

It is important to understand chat control, because when you build a robot, the way you wish to control this button 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 button.

Connection steps

  1. Connect the button to your Arduino following the wiring diagram
  2. Connect your Arduino to your computer
  3. Check the COM port in the Windows device list
  4. Open the Arduino application on your computer
  5. Upload example code to your Arduino board
  6. Type https://localhost:9515 in your browser to open Ozeki 10
  7. Select the connection of the Arduino button
  8. Press the Arduino button to test your solution

System overview

The system we suggest consists of a button, 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

setup button to pc using arduino
Figure 2 - System configuration of button connecting to PC using Arduino

Prerequisites

  • Digital input (e.g. button with an added 1 kΩ restistor)
  • 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 digital input to your Arduino

You can see how to wire the digital input (such as button) to any of the following boards:

After wiring, please plug the board to your computer!

Step 2 - Upload the code to the microcontroller

(Here is the code to upload)

Step 3 - Start Ozeki 10 to test digital input

Step 4 - Configure your button controller in Ozeki 10

In order to configure your button controller (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 button controller protocol

The Button Controller can communicate with Ozeki through the following protocol.

References:
https://www.arduino.cc

Copyright © 2000- - Ozeki Ltd | info@ozeki.hu
Home > Products > Ozeki 10 > Connections > Arduino > Button
Legal | Privacy | Terms of use | 2976
18.204.229.70 | 92.118.27.157 | Login