|
|
|
This example applxication
demonstrates how DC motors can be controlled wirelessly using an OOPic-R
connected to the Dual Channel PWM DC Motor Driver Board, WCM (Wireless
Control Module) and WHC (Wireless Handheld Controller). It has been
developed from the DC Motors with OOPic-R example.
In this example a 12V DC motor with sumo tyre and hub is connected
to one of the driver ports on the Motor Driver Board. The OOPic then
controls the motors direction, speed and brake status.
The OOPic-R, Driver Board and WCM are connected very simply using
the Dual DC Motor IO pins that are set-aside on the oopic board and
the PRG header. They are connected as follows: |
| |
| |
|
OOPic-R |
|
Driver Board
Pin |
| Dir.Right Motor |
- |
26 |
- |
36 |
| Brake Right Motor |
- |
24 |
- |
40 |
| Speed Right Motor |
- |
18 (PWM1) |
- |
29 |
| Dir.Left Motor |
- |
27 |
- |
34 |
| Brake Left Motor |
- |
25 |
- |
38 |
| Speed Left Motor |
- |
17 (PWM2) |
- |
27 |
| +5 Volts |
- |
+5v |
- |
21 or 22 |
| Ground |
- |
GND |
- |
23 or 24 |
| |
| |
|
OOPic-R |
|
WCM |
| I2C
Connector Cable |
- |
PRG Header (5
pin) |
- |
I2C Input (4
pin) |
| |
|
|
|
|
|
In this example the right motor is used.
Connect a 12-55v power supply (3A max) to the +12V and GND connections
on the X3 header in the middle of the motor driver board. The right
and left motors are isolated from each other but a single battery
can be used to power both sides as long as it can take the voltage
and current demands.
Do not take power from the OOPic to power the motors!
The 12v DC Motor should have a 0.1uf capacitor connected across
its two legs to smooth the signal and reduce electrical noise. The
two pins should then be connected to the Right motor connection
(the outer connectors). The middle one is used if your motor has
a ground wire connected to its casing.
When you are connected, power up the OOPic and download the program.
After a 2 second delay, the motors will move at full speed in one
direction. 3 seconds later it brakes and goes full speed in the
reverse direction again for 3 seconds. It brakes again then accelerates
and decelerates the motor.
At any time you can send a command from the WHC to the WCM, which
will override the autonomous program. To use the WHC do the following:
Set the WCM remote node to 2
To perform a manual override command, send 4 (green indicator).
The application is now under manual control. It can be controlled
in the following ways:
Select the Red Indicator.
Send 5 to move the motor forwards at full speed.
Send 6 to move the motor backwards at full speed.
Send 7 to accelerate the motor backwards.
Send 8 to accelerate the motor forwards.
Send 9 to stop the motor.
To return the motor back to autonomous control, do the following:
Select the Yellow Indicator.
Send 14 to exit manual mode.
The program will then continue in its autonomous mode until overridden
again.
Download
the code here. |
|