Arduino 101 - The Complete Guide to Engines • HWzone
ComputersGuides

Arduino 101 - The Complete Guide to Engines

Everything you need to know about using engines based on controllers One detailed guide

This is the second part of the Arduino 101 series which is going to contain everything related to engines combined with Arduino, for those who have not followed, In the previous section Which deals with all matters of setting up a development environment for Arduino and for those who are completely new to the business Guide Arduino from A to Z Which explains (almost) everything you need to know in order to get a good starting point.

As I wrote above, motors are indeed an integral part of the robotics world and they actually allow us to bridge the code world with the mechanical world. So what exactly is an "engine"? Why is he turning? And how does it even work? We went out to check.

In order for mechanical movement to occur following electrical activity, the electromechanical effect is activated, a process that is transmitted by a long (very) thread wrapped around Metallic and thereby creating magnetic-mechanical energy. This tool is called an electromagnet. The whole issue of electric propulsion is based on this principle and it is important to understand it before continuing to learn about
Engines (for a little more thorough understanding you can read the value this From Wikipedia.

Now that we understand what an electromagnet is we will continue to define a motor. The engine consists of two parts, the first part stator (static language - not moving) and indeed it is the outside of the engine which remains in place. The stator usually contains two magnets / electromagnets and the other part is the rotor, the motor core, the rotor is basically an electromagnet which, due to a change of polarity, moves on the different sides of the stator. Below we will see engines that do not meet the exact definition of the original term but each engine has a rotor and stator, some in reverse (for example, the rotor is actually around the stator) and so on.

Get started - DC motor

DC motors or "direct current" motors are by far the simplest and most basic motors, containing only about two electric poles (plus and minus) which makes it incredibly simple. In terms of advantages and disadvantages, DC engines do not have certain characteristics that make them superior to other solutions besides simplicity of use, today they can be found mainly as vibration engines (cell phones etc.). Their big disadvantage is that they are not "smart". That is, the user has no way of getting information directly about their mechanical data (given speed, current angle, etc.).

However, it is possible to use certain sensors that will give such feedback. But in the end, if you want a project beyond the engine that just turns around, probably to investigate other motors first (as there is later in the manual).

Now that we understand how the engine works, let's move on to a small demonstration. To build the circle, use the following components:

  • DC 5V motor (can be removed from an old toy, for example)
  • Chip type L293
  • Breadboard
  • Wires for business wiring
  • Power source (12V transformer / 9V battery)

First, we will drill the circuit according to the chart above (there is also a link containing all the files and charts at the end of the manual), note that it is very important to connect the battery / transformer otherwise the engine will not get enough current and the whole circuit will not work. After that we will upload the following code to the clipboard:

int motor1PIN2 = 12;    // pin 7 on L293D conected to arduino 12 degital pin
int motor1PIN1 = 11;    // pin 2 on L293D conected to arduino 11 degital pin
int enablePin = 10;     // pin 1 on L293D conected to arduino 10 degital pin

void setup() {
  pinMode(motor1PIN1, OUTPUT);
  
  pinMode(motor1PIN2, OUTPUT);
  
  pinMode(enablePin, OUTPUT);
  
  digitalWrite(enablePin, HIGH); }


void loop() {
 digitalWrite(motor1PIN1, LOW);      // set pin 2 on L293D low
 digitalWrite(motor1PIN2, HIGH);    // set pin 7 on L293D high
delay(1000); // the motor turn right for 1 secend (1000ms = 1s)
 digitalWrite(motor1PIN1, HIGH);    // set pin 2 on L293D high
 digitalWrite(motor1PIN2, LOW);      // set pin 7 on L293D low
delay(1000); // the motor turn left for 1 secend  
 digitalWrite(motor1PIN1, LOW);    // set pin 2 on L293D low
 digitalWrite(motor1PIN2, LOW);      // set pin 7 on L293D low 
delay(1000);  // the motor stop for 1 secend

}

You can see that the L293 is connected to the Arduino by three digital pins, one pin is the Chip's Enable. That is, as long as it is not directed at 1 logical (HIGH) then the chip will not work, there is no importance to this feature in this guide so you can also connect it to 5V equally. In addition, there are two more pins that are directly attached to the engine and according to their position is determined by the rotation of the motor. As shown in the code, when the 7 pin works on the logical 1 and the 2 pin works on the logical 0, the motor rotates in a specific direction (depending on the wiring to the chip) and when the 7 pin on the logical 0 and the 2 pin on the logical 1 the motor replaces the direction. Finally, when both the 7 pin and the 2 pin are working on the logical 0, the motor stops. More about activating the chip, you can look at its specification that is in the list of components above.

1 2 3Next page
Tags

2 תגובות

  1. Adding information about more serious engines?
    I would love to read about more serious engines with much more power, more about how to choose which engine is right for my project, torque calculation and transmission selection.

  2. LM293 this piece ***
    This is an outdated driver based on bipolar transistors. This means 2 things:
    If a maximum voltage drop of nearly 3 volts on the driver itself, any self-respecting motor would waste a lot of energy on the bridge itself, which would get very hot.
    2. Incorporating such a driver into a battery-based circuit is a wasteful waste of battery power.

    The alternative is a FET-based driver with resistance measured in millimeters, which means a voltage drop of millivolts on each amperage current.

    For example http://www.pololu.com/catalog/product/2135
    This driver has a total resistance of 0.3 ohms which means it will waste 0.3V in the current of 1A.

Leave a Reply

Back to top button
Close
Close