A basic DC motor prototype

In this section, we will build a prototype where a DC motor will spin for a second every time a push button is pressed.

For building the distance measurement device, the following parts will be required:

  • Arduino Uno R3
  • USB connector
  • Four pieces 1.5V batteries
  • One battery holder (for 4 batteries)
  • One full sized breadboard
  • One push button
  • One piece 10K Ohms resistor
  • One small DC motor
  • One N2222 transistor
  • One IN4001/IN4007 diode
  • Two pieces 150 Ohms resistors
  • Some Jumper wires

Follow the schematic diagram shown below to build the DC motor circuit. In the following breadboard diagram, notice that an external battery-based power source has been used for powering the DC motor; whereas the Arduino board has been powered via the computer USB.

Using a separate power source for the DC motor is important, because the 5V pin of the Arduino board is not designed to provide the amount of current drawn by a DC motor for continuous usage. The next diagram depicts how to setup the breadboard circuit for our first DC motor prototype.

Figure 1: Button operated DC motor

Note how the breadboard has been used to keep the two power sources separate from one another.

The power rails of a full-sized breadboard are physically divided into a left and a right side circuit internally--each side having five sections. Make sure you understand how to use the breadboard. Just think of a full sized breadboard as two half sized breadboards, placed side by side together and it will become easy to understand.

In the preceding diagram, the push buttons are powered by the Arduino using the five sections on the left side of the breadboard power rails, while the DC motor circuit is powered from the battery by using the five sections on the right-hand side.

Fundamental - Common Grounding:
Also notice how the GND pin from the Arduino has been connected to the DC motor circuit on the right side of the breadboard. This has been done to achieve common grounding in a circuit that uses multiple power sources.

As shown in Figure 1, first the Arduino is powered from the computer USB, the Arduino in turn provides power to the push button via its five-volt pin. The second power source is provided from the battery; here four standard 1.5 volt batteries have been used. The battery is used to power the DC motor.

Caution:
Do not use the Arduino board pins to power the DC motor directly as the Arduino board and/or power supply pins might get damaged due to direct prolonged usage with a DC motor.

The example in this chapter should be used for prototyping and short-term usage only. Ideally, a motor driver circuit should be used for prolonged use. A professional motor driver circuit comes with in-built protection so that the Arduino or the micro-controller used to drive the motor does not get damaged.

Additionally, it must be noted that digital pin 3 from Arduino has been connected to the base of the transistor. When a PWM signal is received via pin 3 on the transistor base, the motor circuit gets closed and the motor starts rotating.

You might have noticed that a push button has been used with the Arduino board in the preceding circuit diagram. Note the three connections (5V, GND, and digital pin) for a push button. The push button in this example has been used as a pull-down resistor. It is a resistor used to connect an electronic signal point/pin to the negative terminal or GND of the circuit's power supply. Doing so keeps the logic level at LOW when the button is not pressed. As soon as the button gets pressed, the logic level changes to HIGH.

Similarly, a pull-up resistor is used to connect an electronic signal point/pin to the positive terminal of a power supply in circuit. Doing so keeps the logic level at HIGH when the button is not pressed. As soon as the button is pressed, the logic level changes to LOW.

The button is grounded (LOW) via 100 Ohms pull-down (because it connects to the ground pin) resistor. This technique is used to ensure that when the statement digitalRead(buttonPin) is executed, it will return a LOW (if the button is NOT pressed) and will return HIGH (if the button IS pressed).
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.84.155