- Ozeki 10
- Analog Sensor
- DC Motor
- Arduino Mega
- Arduino Nano
- Arduino Uno
- Ozeki Matrix
- Raspberry PI
- Chat Control
- DHT Sensor
- ID Manager
- IR Transceiver
- 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
- Network speed calculate
- Bulk Messenger
- Cluster Software
- Developer tools
How to use Arduino DC motors
In this guide, you will be able to get some information about the Arduino DC motors. The DC motor is the most basic of electric motors and is used in all types of hobby electronics. This guide provides you some basic information about the DC motors, how you can connect it to your Arduino, and how you can use it with Ozeki 10. The document also includes diagrams and videos to help you to understand the concept behind DC motors. So, let's get started.
What is an Arduino DC motor?
A DC motor (Direct Current motor) is the most common type of motor. DC motors normally have just two leads, one positive and one negative. If you connect these two leads directly to a battery, the motor will rotate. If you switch the leads, the motor will rotate in the opposite direction.
How to use an Arduino DC motor?
To operate with DC motors, you need to connect three pins as the wiring diagram shows it (Figure 1). One needs to be connected to the ground (Gnd), the other from the motor to the 5V pin. The third pins have to be connected to the PWM pin on your Arduino. With the connected DC motor, now you will be able to control it. You can adjust the rotation speed of the motor between the range of 0 and 255.
Arduino DC motor wiring diagram
How to use Arduino DC motors in Ozeki
DC motor controller connects your DC motors to your Ozeki software. You can move up to two DC motors through any L298N motor driver chip. This chip is integrated in the LM298 DC Motor Controller Board and also in the Ozeki DC Motor Driver. You can change motor movement direction and speed for both motors by using Ozeki. The motors should be powered from an outside power source with maximum of 36V. To use the DC motor 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 DC motor 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 DC motor code to Arduino Uno
Upload the DC motor code to Arduino Mega 2560
Upload the DC motor code to Arduino Nano
Upload the DC motor code to Ozeki Matrix
Upload the DC motor code to Raspberry Pi
The arduino motors and Ozeki will communicate over the USB port using the Ozeki DC motor protocol. This protocol makes it possible for you to use the motor directly on your PC. You will be able to control this motor 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 motor 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 motor.
- Wire your DC motor to the Arduino
- Plug the Arduino board into your PC
- Check the COM ports to see if your Arduino is connected
- Upload the example code to the Arduino
- Open https://localhost:9515 in your browser
- Select the connection of your DC motor
- Set up the attributes of the DC motor
- Click 'Update' to test your DC motor
The system we suggest consits of a DC motor, 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
- 1 or 2 small DC motor
- Ozeki 10 installed on your computer
- Programmable board (Arduino Mega/Nano/Uno, Ozeki DC Motor Driver or Raspberry Pi)
- If you do not use an Ozeki DC Motor Driver than an LM298 DC Motor controller board is required
- USB cable is needed between Arduino Mega/Nano/Uno, Ozeki DC Motor Driver and your computer
Step 1 - Wire the DC motors to your Arduino
You can see how to wire the DC motors 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 DC motors
Step 4 - Configure your DC motors in Ozeki 10
To be able to configure your DC motors (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 DC motors protocol
The DC Motor Controller can communicate with Ozeki through the following protocol.