Andriod Driving DC Motors with using the AndroiDAQ Module Part 5

This is the final installation of our article series titled: Android Controlling DC Motors using the AndroiDAQ Module. In our previous articles, we explained a motor controller design and examined its schematic sections. We also provided to you a list of parts to enable you to build your own motor controller that is fully compatible with the AndroiDAQ module. In this article we will discuss connecting your newly built motor controller to the AndroiDAQ module and show you how to control it and your motors with the AndroiDAQ DEMO application.  

 

In the image below, we show our prototype motor controller circuit which is connected to our AndroiDAQ module. If you have been following this article series, you will notice that we utilized the AndroiDAQ motor controller that we mentioned in our last installment, though this motor controller circuit lacked one of the important circuits that we discussed in our last article;  the LM2907 frequency to voltage converter circuit, which is connected to the Pulse Width Modulation circuit, which if you recall, is adjustable to give us a 0 to 100-hertz, or 0 to 100 percent speed range for controlling our motor’s speed from no-speed to full-speed. 

AndroiDAQ Motor Controller Circuit 

 

To correct this discrepancy, we built the frequency to voltage convertor circuit (shown in the image below) on our breadboard next to our AndroiDAQ module, and made the appropriate connections per our schematic. You may also notice that we added an LED, which has a 100-ohm resistor in series with it, to limit the LED’s current draw. This LED circuit is connected between the 3.3-volt pin on the AndroiDAQ module and one of the AndroiDAQ module’s ground pins. This LED circuit will indicate to us when power is applied to the motor controller circuit. 

AndroiDAQ Motor Controller Circuit CloseUp

We also added our 12-volt DC input power connector and cable, which is used to power the system as a whole. Looking closer you will notice that we broke out two additional wires from the power connector, which will be used to power the separate motor controller board, as shown in the next image.

AndroiDAQ Motor Controller Circuit CloseUp #2

Using the motor controller schematic from our last article, we will now examine how easy it is to connect your motor controller to the AndroiDAQ module. For this article, we will use AndroiDAQ module channels 0, 1, and 2. Channel 0 will provide the varied output frequency from your Android device to control your motors’ speed, so channel 0 will be connected to the “Freq. AndroiDAQ” line on the schematic, which is the input line of the frequency to voltage convertor on your motor controller. Channels 1 and 2 will be used to control the motors’ direction state, so channel 1 will be connected to the “Direction A” input line on the schematic and on your motor controller, and channel 2 will be connected to the “Direction B” input line on the schematic and on your motor controller. Once you have all your connections made between your motor controller and AndroiDAQ module, and have your motor controller properly adjusted for the 100-hertz setting (as described in our last article), and also have your motors connected to your motor controller, you are ready to power up the AndroiDAQ motor controller system. If you haven’t already, please install the AndroiDAQ DEMO application (found on the microSD card that came with your AndroiDAQ module) on to your Android device and then open the AndroiDAQ DEMO application on your Android device. 

The images below show you the AndroiDAQ DEMO screens that we will use to control the motor controller. The first image shows the opening screen (Note: you may be prompted to turn on your Bluetooth radio before this screen is shown), which is titled “Setup I/O”. On this screen you will configure channels 0, 1, and 2 to outputs by clicking on the checkboxes to set the checkmark, indicating that the channel is an output. The rest of the channels will be left as inputs, or no checkmark. 

Setup I/O Screen

 

By using your finger to swipe across your Android device’s screen right to left, you enter the next AndroiDAQ DEMO configuration screen, which is titled “Input Settings”. Since we are only using output channels for motor controlling, we can skip this screen by swiping the screen right to left again, which will land us on the “Output Settings” screen, shown below. Here, we will configure channel 0 to be a pulse “Output Type” by clicking the “Pulse” radio button. When the “Pulse” radio button is highlighted, an input box with the end label of “Hz” is displayed. We will use this input box to enter the values, from 0 to 100, to control our motors’ speed. By default Channels 1 and 2 are set to digital “Output Types”, as shown below. These two channels will control the forward and reverse directions of our motors. 

Output Settings Screen

You are almost ready to test your motor controller with the AndroiDAQ module, but first you need to pair up the AndroiDAQ Bluetooth module with your Android device. To do this, apply power to your AndroiDAQ motor controller circuitry and then press the menu button on your Android device. This will open the AndroiDAQ DEMO menu as shown below.

Menu of AndroiDAQ DEMO Screen

Press the “Connect a device” menu item. This will open a “select a device to connect” dialog window where you can press the “Scan for devices” button which will cause AndroiDAQ DEMO to scan and find your AndroiDAQ Bluetooth module. Please note: you must have the AndroiDAQ module powered on before the Bluetooth scanner will find it and that there is a one minute delay before your AndroiDAQ Bluetooth module can connect to any Android device. 

Bluetooth Devices Found Screen

 

Once the Bluetooth device scan is finished, the dialog window will list the Bluetooth devices that it has found, as shown below. Clicking on the “FireFly -XXXX” named device will connect your Android device to the AndroiDAQ Bluetooth module. A successful connection will be indicated in the upper right hand corner of the AndroiDAQ DEMO screen when it states: “connected: FireFly-XXXX”, as shown in the image below. 

Bluetooth Connected Screen

 

Now if you were to press the “Send Output Values to AndroiDAQ” nothing would appear to happen with your motor controller. Can you think why? If you guessed that the frequency output of channel 0 is zero, which causes the motor speed set to be zero, or stopped, you are correct. Now if you press the input box, which opens the on-screen keyboard, and type in say 50, what should happen if you press the “Send Output Values to AndroiDAQ” button? If you guessed that the motors should start spinning in some direction, at 50% of their top speed, you are correct, so let’s give that a try. Are your motors spinning? If so, congratulations; as you built a fine motor controller circuit and have interfaced it correctly with AndroiDAQ, and now have the ability to control DC motors with your Android device. Just think of the implications of this achievement and ability for a moment. If your motors are not spinning, then go back and check all your connections and wiring, and then try again. Remember, to stop your motors enter a zero setting into the channel 0 input box and then press the “Send Output Values to AndroiDAQ”. Now isn’t that easy? 

To control and change your motors spin directions, you simply need place or remove a checkmark in channel 1 and/or 2’s Output Setting checkbox. A checkmark present in the Output Setting of either channel sends a high output signal on that channel and no checkmark in the Output Setting of either channel sends a low output signal on that channel. Give this a try while your motors are running; place a checkmark in channel 2 and press the “Send Output Values to AndroiDAQ’ button. This should reverse one of your motors spin direction and this holds true for all other combinations in channels 1 and 2. Now please sit back and reflect on all that you can do with two motors, some sort of chassis to hold the motors, wheels, and your Android device. 

Of course the AndroiDAQ DEMO application is an over simplified application used for controlling the AndroiDAQ module. The DEMO application was written to ease development with the AndroiDAQ module and its operations. More advanced experimenters most likely modify the AndroiDAQ DEMO application source code to instill for example, a controller like game pad to ease their driving of the AndroiDAQ motor controller circuitry. The beauty of open-source is that you can share your new AndroiDAQ interfaces and we invite you to do so for the benefit of all AndroiDAQ fans. 

This series of articles has hopefully given you enough information to understand the theory of DC motors, the how and why of motor controllers, and a basic road map to build your own motor controller that can be used with your AndroiDAQ module or favorite microcontroller. We welcome any and all feedback regarding this series of articles and invite you to tell us what you are developing with your AndroiDAQ module. Below, we present a short video that shows you our AndroiDAQ motor controller setup and its operation. In the future, we will be constructing a platform to hold our two motors and create a four wheel driven chassis, which will be used for an Android…, but that is another story. 

We invite you to read more about the AndroiDAQ data acquisition module for Android, LabVIEW, JAVA, and Python: About the AndroiDAQ module.

 

AndroiDAQ with xBee WiFi module