Android Controlling DC Motors using the AndroiDAQ Module Part 4

In our last article, we learned about the basic building blocks that make up a DC motor controller. These building blocks include circuits to turn the motor on and off, to control the direction of the motor, and to control the speed of the motor using a pulse width modulation circuit. In this article we will pull these building blocks together to make a complete motor controller circuit board, which will later be connected to your AndroiDAQ module, or micro-controller, to allow you to drive the two DC motors remotely with your Android device using the AndroiDAQ DEMO application.

 

Below is the circuit diagram, or schematic, of the complete AndroiDAQ Motor Controller circuit. A schematic is a diagram that uses industry accepted symbols to represent the physical electronic parts that are used to make up a circuit. The use of industry standard symbols in schematics allows people who are interested in the design to be able to quickly read and understand the design. In this schematic, you will notice that the basic op-amp pulse width modulation circuit and the frequency to voltage conversion circuit that we discussed in the last article are included. The schematic also contains the SN754410 H-bridge integrated circuit, or IC, motor driver that we discussed in the last article and some new circuitry, an input voltage regulation circuit which is used to convert the 12 or 9-volts from your battery, which is powering the AndroiDAQ module, to 5-volts and 3.3-volts. These two converted and regulated voltages are then distributed to various sections of the motor controller circuit.

 

 AndroiDAQ Motor Controller

 

The motor controller circuit utilizes what is called “glue logic” in the form of a 74HC14 Inverting Schmitt Trigger chip. In electronics, glue logic is the logic circuitry used to interface a number of off-the-shelf integrated circuits. The 74HC14 chip contains six individual Schmitt trigger inverters that, in a nut shell, changes the input signal level that the inverter is given to its opposite level; meaning, if the input signal is low, or zero volts, the output of the inverter will be high, or at the chip’s VCC level, or at 5-volts DC in this circuit’s case, and vice verse. VCC is a term you will come across many times in electronics and it typically references the supply voltage to an integrated circuit, though not long ago, before integrated circuits were use extensively, VCC referred to the collector voltage on a transistor, so voltage common collector or VCC was devised. 

We use two 74HC14 inverters in the motor direction control section of the motor controller circuitry, to invert the input signals of both the Direction A (for Motor 1) and Direction B (for Motor 2) signals, which come from the AndroiDAQ module. The motor direction control part of the circuitry tells the motor driver chip which way you desire to rotate each motor via the 1A and 2A inputs for Motor 1, and the 3A and 4A inputs for Motor 2, or pins 2, 7, 10, 15 of the SN754410 motor driver. To illustrate, say the AndroiDAQ module is sending a high or 3.3-volt level signal on the Direction A signal line. Pin 1A, or physical pin 2 of the SN754410 sees this direct and non-inverted signal and pin 2A, or physical pin 7, sees the output of the 74HC14, which is an inverted signal. Now according to the SN754410 data sheet’s “Function Table”, found on the front page of the data sheet, this causes the 1Y output pin, or M1A on the schematic or physical pin 3, to be high and 2Y, or M2A, or physical pin 6, to be low. The difference in voltage levels between 1Y and 2Y powers Motor 1 in one direction and vice verse if the signal from AndroiDAQ, on Direction A, is low, or zero volts. This holds true for the circuitry for Motor 2 as well which is controlled by the Direction B signal. Keep in mind that the high output level on 1Y, or M1A, in this instance, is the percentage of the 12-volts supplied to the motor as derived by the pulse width modulation circuitry, as discussed in our last article. 

Looking at the schematic again you will see that we use two more 74HC14 inverters, remember it has six inverters in one IC chip, which are each connected inline with each other, or in series, as to not invert the original input signal. This is done to remove noise and ensure a good clean digital signal from the output of the pulse width modulation (PWM) circuit, which if you remember controls the motor’s speed. The inverter filtered PWM output signal is connected to each motor’s SN754410 enable pins, which are the 1,2EN input pin, or physical pin 1, for Motor 1 and the 3,4EN input pin, or physical pin 9, for Motor 2. For more information about the 74HC14 IC and its uses please refer to: http://www.onsemi.com/pub_link/Collateral/74HC14.REV1.PDF. 

Now let’s examine the H-bridge motor driver circuit that is in the upper right hand corner of the schematic. Here you will notice that the output pins of the SN754410, pins 3, 6, 11, and 14, have 1N5819 diodes connected to the power and ground buses and connected to each connection of each motor. These diodes in the circuit are very important and are called clamping diodes. They are used to prevent voltage spikes and kickback voltages, which come from the motors, from destroying the output transistors of the SN754410. 

To explain further, when a DC motor rotates freely due to inertia or when it changes its rotation direction, the armature coils of wire inside the motor act as a generator that produces a voltage and current. This generated voltage is called a kickback voltage and the current produced is called a reverse current. The kickback voltage and reverse current travels back through the circuit to the output transistors of the SN754410 chip in the form of powerful voltage spikes. Now, because these output transistors only allow current to flow in one direction, the voltage spikes hit a bottle neck, or high resistance, as the transistor tries to stop this kickback voltage and reverse current. If the reverse current is particularly large, say when your reversing the direction of the motors, it will simply blow the driving transistors in the SN754410, destroying this chip in your motor controller circuit. The clamping diodes present less of a bottle neck, or less resistance, than the driving transistors, so the diodes route the kickback voltage and reverse current harmlessly back into the motor so that it won’t damage the rest of the circuit. 

Now let’s take a look at the frequency to voltage converter circuit and the pulse width modulation circuit section of the schematic. Here, you will note that the frequency to voltage converter circuit receives a frequency input signal from the AndroiDAQ module, or from your micro-controller. This input frequency signal is used to control the speed of your motors. In the frequency to voltage converter circuit we have a potentiometer, or adjustable resistor labeled VR1, which is much like the volume control in your music player. We use VR1 to adjust the sensitivity range of the frequency to voltage converter so that you can easily control the speed of your motors without knowing what exact frequency to send for which motor speed. For this, the frequency to voltage converter’s sensitivity will be tuned by adjusting VR1 so that the output voltage level of the frequency to voltage converter circuit measures exactly 3.3-volts DC when a 100-hertz signal is applied from the AndroiDAQ module, as explained on the note on the schematic. This sensitivity tuning will allow you to have a 0 to 100-hertz range, or better explained a 0 to 100 percent speed range for ease in controlling your motor’s speed from no-speed to full-speed. 

Extra Credit Point: You might have already deduced by looking at the schematic that if you used a second channel from the AndroiDAQ module to send a second frequency signal to the motor controller and then designed your motor controller circuit to have a second LM2907, frequency to voltage converter circuit, and then used the second section of the LM393, with the appropriate support electronics to create another PWM circuit, that you could control the speed of each motor independently using the two frequency signals sent by the AndroiDAQ module. This is a very viable deduction on your part and very useful depending on your application. 

You now have enough information and understanding to put together your own AndroiDAQ controlled motor controller following the schematic diagram. Below is a parts list for the parts used in the AndroiDAQ motor controller schematic. Of course we know that advanced users will have their own stash of electronic parts and motors, so they can use the parts that they have on hand for this project if they want to. You can purchase these parts at many of the electronics stores online such as Jameco Electronics and we have supplied the recommended Jameco part numbers in our list for your convenience. 

For the two motors used in this project, we specified two DC gear-head motors that turn at 110 revolutions per minute and have a gear ratio of 56:1, which will serve you well for most experimental applications. However, your application will change as you progress in your electronics training, so at some point you will want to select other motors and parts, though you do need keep in the back of your mind, during your motor selection process, that the SN754410 chip has a maximum output limit of 1 ampere. This limit seems daunting, though there is a whole world of motors for your picking pleasure that operate well under is current limit for many projects. 

You can mount your electronic components onto the included AndroiDAQ bread board, or build a more permanent circuit board using a perforated prototyping circuit board like the Jameco Part no. 263215 board, or you could etch your own printed circuit board if you’d like. There are many references on the Internet to help you with component placement and circuit board layout. We recommend that when you place your components on your board that you keep circuitry section groupings together by mounting the support components for the various IC chips as close to the IC chip as possible, using the schematic as a guide. Constructing your motor controller circuit like this will help to keep stray electronic noise, from sources like florescent lights, from hampering the circuit’s proper operation. 

In the last image of this article, we show an AndroiDAQ motor controller circuit that was built by one of our in-house engineers, who used a perforated circuit board for this motor controller. In this image, you can see how the support parts are mounted closely to their respective IC chips This particular motor controller circuit board was used to move a fairly large robotic system that had a full-up computer system, a 17-inch color touch screen monitor, the system’s batteries, and other support electronics and accessories, all onboard and carried by the robot. This system used the same motors that we specify below in our parts list, so you can see that these motors will move a lot of gear if need be. 

In the next and final article of this series, we will discuss connecting your newly built motor controller to the AndroiDAQ module and how to control it and your motors with the AndroiDAQ DEMO application.

 

AndroiDAQ Motor Controller Parts List                                                         

 

Item Quantity Reference Part Value Jameco Part #
1 3 C1,C8,C9 10uF 545641
2 3 C2,C10,C11  .1uF  25523
3 3 C3,C5,C6 100nF 544833
4 1 C4 100uF 93761
5 1 C7 1nF 332436
6 8 D1,D2,D3,D4, 1N5819 177965
    D5,D6,D7,D8    
7 1 M1 MOTOR 1 253489
8 1 M2 MOTOR 2 253489
9 3 R1,R3,R4 10K0 691104
10 2 R2,R5 1M  691585
11 1 U1  SN754410 1054684
12 1 U2 74HC14 45364
13 1 U3 LM2907 123625
14 1 U4 LM393 973531
15 1 U5 LM78M05CT 840974
16 1 U6 LM2937-3.3V 192524
17 1 VR1 100K0 241189 

 

Motor Controller Circuit Board