Motorshield V2 and Intel Edison

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Legendaire
 
Posts: 3
Joined: Wed Aug 05, 2015 6:40 pm

Motorshield V2 and Intel Edison

Post by Legendaire »

I am having trouble with the adafruit motorshield, product 1438, and the Intel Edison. I am unable to change the speed of the motors. They appear to run full out no matter what speed I set it to. The motors do go forward, reverse, and stop. The problem is specific to speed. Here is the Node.js example I am using. There is one spot which deviates from the example in that it changes the speed when going in reverse. It just reverses but at the same speed. I can change the speed to any value including 0 and it still goes full out. The values for MotorShield_lib.ADAFRUITMS1438_DEFAULT_I2C_ADDR and MotorShield_lib.ADAFRUITMS1438_I2C_BUS are 96 and 0 respectively. I found these using a console.log command. Here is the example:

Code: Select all

console.log("Exiting");  
 myMotorShield_obj = null;  
 if (MotorShield_lib)  
 {  
  MotorShield_lib.cleanUp();  
  MotorShield_lib = null;  
 }  
 process.exit(0);  
}  
var MotorShield_lib = require('jsupm_adafruitms1438');  
  
/* Import header values */  
var I2CBus = MotorShield_lib.ADAFRUITMS1438_I2C_BUS;  
var I2CAddr = MotorShield_lib.ADAFRUITMS1438_DEFAULT_I2C_ADDR;  
var M3motor = MotorShield_lib.AdafruitMS1438.MOTOR_M3;  
var MotorDirCW = MotorShield_lib.AdafruitMS1438.DIR_CW;  
var MotorDirCCW = MotorShield_lib.AdafruitMS1438.DIR_CCW;  
  
// Instantiate an Adafruit MS 1438 on I2C bus 0  
var myMotorShield_obj = new MotorShield_lib.AdafruitMS1438(I2CBus, I2CAddr);  
  
// Setup for use with a DC motor connected to the M3 port  
// set a PWM period of 50Hz  
myMotorShield_obj.setPWMPeriod(50);  
// disable first, to be safe  
myMotorShield_obj.disableMotor(M3motor);  
// set speed at 50%  
myMotorShield_obj.setMotorSpeed(M3motor, 50);  
myMotorShield_obj.setMotorDirection(M3motor, MotorDirCW);  
process.stdout.write("Spin M3 at half speed for 3 seconds, ");  
console.log("then reverse for 3 seconds.");  
myMotorShield_obj.enableMotor(M3motor);  
setTimeout(function()  
{  
 console.log("Reversing M3");  
 myMotorShield_obj.setMotorSpeed(M3motor, 10); // <******************************* Does not change speed  
 myMotorShield_obj.setMotorDirection(M3motor, MotorDirCCW);  
}, 3000);  
  
setTimeout(function()  
{  
 console.log("Stopping M3");  
 myMotorShield_obj.disableMotor(M3motor);  
 exit();  
}, 6000);  
process.on('SIGINT', function()  
{  
exit();  
});
Last edited by adafruit_support_bill on Wed Aug 12, 2015 7:33 am, edited 1 time in total.
Reason: Please use the '</>' button when posting code. Paste your code between the [code] tags.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motorshield V2 and Intel Edison

Post by adafruit_support_bill »

Intel maintains their own set of libraries for the Edison, so they should be help with library issues. One questionable thing I see in the code you posted is this bit here:

Code: Select all

// set a PWM period of 50Hz 
myMotorShield_obj.setPWMPeriod(50);  
50Hz is a pretty low PWM frequency for DC motor control. In the Adafruit version of the library, the default frequency for DC motors is 1.6KHz.

User avatar
Legendaire
 
Posts: 3
Joined: Wed Aug 05, 2015 6:40 pm

Re: Motorshield V2 and Intel Edison

Post by Legendaire »

Thank you for your reply. I changed the pwm frequency to 1600 but there was no change in the motors. Could you verify the bus and address for the shield and what operating voltage it runs at. I have not changed the solder jumpers. I2C is new to me so I do not know if the bus address is something particular to the shield or to the edison board. Would you be able to tell me if it is one or the other?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motorshield V2 and Intel Edison

Post by adafruit_support_bill »

The shield can run at either 3.3v or 5v. By default it is configured for 5v. If you are using it with a 3.3v processor, you need to solder the logic level jumpers for 3.3v.
I do not know if the bus address is something particular to the shield or to the edison board.
The i2c address is a property of the board. By default it is addressed to 0x60: https://learn.adafruit.com/adafruit-mot ... he-shields

User avatar
Legendaire
 
Posts: 3
Joined: Wed Aug 05, 2015 6:40 pm

Re: Motorshield V2 and Intel Edison

Post by Legendaire »

I got a hold of Intel. They discovered there was a bug in their library which will be fixed in the next version of UPM.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motorshield V2 and Intel Edison

Post by adafruit_support_bill »

Good to know! Thanks for the follow-up.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”