The product is currently Out-of-Stock. Enter your email address below and we will notify you as soon as the product is available.







Based on microcontroller ATMEGA32U4, this module is capable of driving two DC motors or one stepper motor. The power supply for the DC motors can be comprised between 3 and 15 Vdc with an output current of 1.4 A (2.5 A peak) for the motor. It provides protection overcurrent and overtemperature. Can replace the driver mounted on 3Drag, thanks to pin-strip pitch compatible.
Features
  • It can control two DC motors or one stepper motor
  • Motor Voltage: from 3 to 15 Volt
  • Control Logic Voltage: from 3 to 5 Volts (selectable internal or external)
  • Output Current: 1.4 A continuous (2.5 A peak) for motor
  • Three possible ways of interface: USB, Serial and I2C
  • Compatible inputs 3.3V and 5V
Management via Serial
If we want to manage the controller via an Arduino board should use a software serial, using a single digital line to be connected to the RX line, so the serial port hardware will remain free to communicate with the PC. Sketching example is shown in Listing 4. This example shows how to build the control byte (byte2) starting on the settings of individual bits of direction and braking. It will be the line of code int mode = (modeM2 << 3) + (modem1 << 2) + (dirM2 << 1) + dirM1 to reconstruct the complete byte shifting and summing the individual bits. We will use subsequently four commands Serial.write to send the individual bytes containing the start character and the three bytes of data.
Management via I²C
If you want to control the module OMC21 (Open Motor Control) through port TWI Arduino not need to do is connect the two lines SDA and SCL of both ports to each other and connect the GND of both cards. Do not need the pull-up resistors for the simple reason that they are already inside of Arduino UNO is that of 32U4 and enabled automatically as soon as the function is called Wire.begin ().
For the sketch to use on Arduino UNO to command the controller to refer to Listing 5, which is very similar to the previous listings. But there is an important difference with the way we communicate via serial regarding the addressing system of the devices. While in a serial communication data exchange takes place point to point, ie only two devices communicating with each other, in the I2C BUS there can exist up to 127 devices to a slave type all in communication with the only master. The master in this case is Arduino UNO (or control logic) while slaves are tabs Open Motor Control; The obvious advantage is that you can use multiple controllers and therefore more engines, all managed by a single Arduino board using only one port TWI. Recall that in the Arduino port TWI uses fledged I2C protocol but is owner of Philips, who invented it.
In Listing 5 it is in fact present the line of code const int OMC21address = 4 that has the purpose to specify to which slave communication takes place; obviously BUS TWI will not necessarily coessistere other slave controller OMC21 engines. In the sketch OMC21.ino was specified as the default device address value 4 at will but this can be changed if youre use on a BUS perifierica that has already this address. If you use multiple controllers OMC21 will require that each has a unique address, then you will have to load on each controller a sketch in which you specified a different address. During program control then you will have to take into account different addresses assigned, to ensure the smooth transit of data.
Listing 1

if(Serial.available() > 0)
{
char inByte[maxinByte];
int numByte = Serial.readBytes(inByte, maxinByte) ;
//reads until maxinByte are reads or if TimeOut is occurred
byte extraByte; // clear the buffer if extra bytes is arrived
while (Serial.available())
extraByte = Serial.read();
//if data starting with '$' and lenght is correct...
if (inByte[0]=='$' && numByte==maxinByte)
{
dirM1 = inByte[1];
dirM1 = dirM1 & 0x01;
dirM2 = inByte[1];
dirM2 = (dirM2 & 0x02)>>1;
modeM1 = inByte[1];
modeM1 = (modeM1 & 0x04)>>2;
modeM2 = inByte[1];
modeM2 = (modeM2 & 0x08)>>3;
speedM1 = inByte[2];
speedM2 = inByte[3];
setMotor();
byte readVM = inByte[1];
readVM = (readVM & 0x10)>>4;
if (readVM==1)
{
int VM = analogRead(VM_pin)*36;
VM = VM>>6;
Serial.println(VM); //VM*10 [volt] (0-255)
}
}
}

Listing 2

void I2CreceiveEvent(int byteIn)
{
while( Wire.available()>0) // loop until available byte on wire
{
char acknowledge = Wire.read();
if (acknowledge=='$')
{
char mode = Wire.read(); // read mode byte
speedM1 = Wire.read(); // read speed byte
speedM2 = Wire.read(); // read speed byte
dirM1 = mode;
dirM1 = dirM1 & 0x01;
dirM2 = mode;
dirM2 = (dirM2 & 0x02)>>1;
modeM1 = mode;
modeM1 = (modeM1 & 0x04)>>2;
modeM2 = mode;
modeM2 = (modeM2 & 0x08)>>3;
setMotor();
}
}
}

Listing 3
// OpenMotorControl21
// Example to use Processing for control OMC21 USB

import processing.serial.*;

Serial myPort; // Create object from Serial class

void setup()
{
size(200,200);
background(0);
String portName = Serial.list()[0]; //change the 0 to a 1 or 2 etc.
println("portName: ", portName);
myPort = new Serial(this, portName, 9600);
}

void draw()
{
}

void mouseClicked() // if click on background
{
int dirM1 = 0; // set direction for Motor1 0=forward 1=reverse
int dirM2 = 0; // set direction for Motor2 0=forward 1=reverse
int modeM1 = 0; // set mode for Motor1 0=brake 1=standby
int modeM2 = 0; // set mode for Motor2 0=brake 1=standby
int mode = (modeM2<<3) + (modeM1<<2) + (dirM2<<1) + dirM1;
char modedir=char(mode); // convert integer to char
char speedM1=128; // set speed for Motor1 at 50%
char speedM2=128; // set speed for Motor2 at 50%
myPort.write('$'); // write start char
myPort.write(modedir); // write mode-dir byte
myPort.write(speedM1);
myPort.write(speedM2);
}

Listing 4

// OpenMotorControl21
// Example to use Arduino for control OMC21 Softserial Serial

#include <SoftwareSerial.h>
SoftwareSerial OMCSerial(2, 3); // RX, TX

void setup()
{
Serial.begin(9600); //use Hardware Serial to communicate with PC
OMCSerial.begin(9600); //use software serial to communicate with OMC21
}

void loop()
{
byte dirM1 = 0; // set direction for Motor1 0=forward 1=reverse
byte dirM2 = 0; // set direction for Motor2 0=forward 1=reverse
byte modeM1 = 0; // set mode for Motor1 0=brake 1=standby
byte modeM2 = 0; // set mode for Motor2 0=brake 1=standby
byte mode = (modeM2<<3) + (modeM1<<2) + (dirM2<<1) + dirM1;
mode = mode+16; //if request Motor voltage
char speedM1=128; // set speed for Motor1 at 50%
char speedM2=128; // set speed for Motor2 at 50%
OMCSerial.write('$');
OMCSerial.write(mode);
OMCSerial.write(speedM1);
OMCSerial.write(speedM2);
delay(1000);
}

Listing 5

// OpenMotorControl21
// Example to use Arduino for control OMC21 I2C

#include <Wire.h>
const int OMC21address=4; //address of OMC21

void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
}

void loop()
{
byte dirM1 = 0; // set direction for Motor1 0=forward 1=reverse
byte dirM2 = 0; // set direction for Motor2 0=forward 1=reverse
byte modeM1 = 0; // set mode for Motor1 0=brake 1=standby
byte modeM2 = 0; // set mode for Motor2 0=brake 1=standby
byte mode = (modeM2<<3) + (modeM1<<2) + (dirM2<<1) + dirM1;
char speedM1=128; // set speed for Motor1 at 50%
char speedM2=128; // set speed for Motor2 at 50%
Wire.beginTransmission(OMC21address); // transmit to OMC21
Wire.write('$');
Wire.write(mode);
Wire.write(speedM1);
Wire.write(speedM2);
Wire.endTransmission(); // stop transmitting

delay(1000);
}

Write a review

Please login or register to review

Open Motor Control - mounted

  • Price: 28.00€


Tags: open motor control - mounted, 7100-ft1173m, futura group srl, diy kits

The product is currently Out-of-Stock. Enter your email address below and we will notify you as soon as the product is available.