-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trouble getting motor control to work with Pololu DRV8835 Arduino motor shield #34
Comments
Thanks for the report.
That's incorrect, libmraa0 supports PWM on 3, 5, 6 and 9, but not 10 and 11. |
@vrubiolo cool, keep me posted :) |
@rwaldron OK, I redid the setup and since libmraa0 supports PWM9, I only switched PWM 10 to PWM5. Here is the updated part of the code: // Pololu DRV8835, with PWM 10 -> 5
var m1 = new five.Motor({
pins: {
pwm: 9,
dir: 7
}
});
var m2 = new five.Motor({
pins: {
pwm: 5,
dir: 8
}
}); Motor 1 (connected to PWM9 and digital pin 7) correctly behaves but motor 2 (connected to PWM5 and digital pin 8) continuously goes forward. Actually, what I see is that M2 appears to follow the direction orders, it's just that it never stops:
I will not be able to touch this for a few weeks but if you guys have hints on what I could check, that'd be great. |
I will try to reproduce this from your explanations and report back! |
Hi there, A little bit more investigation on the setup using an oscilloscope. For the working motor, I can correctly see the PWM and direction signals. The PWM correctly adapts to the motor speed. For the non-working motor, the PWM signal (for pin 5) is constantly as if the speed was 255 (which maps to the behavior of the motor going full speed all the time). If I use it as a simple pin with the following code, I can see the correct PWM corresponding to the pin strobe: var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
io: new Edison()
});
board.on("ready", function() {
console.log ("J5 ready.");
var strobe = new five.Pin(5);
var state = 0x00;
this.loop(500, function() {
strobe.write(state ^= 0x01);
});
}); So it looks to me something might be wrong inbetween (maybe with the motor class init code?). |
Can you share the exact code you're using, along with the a photo of the exact hardware setup? Thanks!! |
@rwaldron : thanks for your reply. Let me gather that data and get back to you with the info you request. |
Hello back, I did some additional experimentations while gathering data to send you and actually found the source of the problem: the PWM swizzler. I had changed it during the Intel IoT roadshow to try to make the motor shield work on Arduino. I had left it in its current position since then. Once switched back to its default position, both motors worked fine. For the record, here is how we proceeded for the investigation:
That's it. I am thus closing the thread. Let me know if you have questions or observations otherwise. Thanks for all the useful help so far ! Vincent [1] At this point, I don't know why it did so. Because the issue eventually turned out to be a HW/jumper problem, it should have failed in both cases (i.e motor code and strobe code). I suspect this was a test issue on my side. |
Wow, thanks for the detailed follow-up :) Hopefully this will help somebody else in the future! |
[Apologies if this is the wrong place to post, please redirect me if needed]
Hi,
I am trying to use the Pololu DRV8835 Arduino motor shield with the Edison Arduino breakout board. This configuration (code+shield) works fine when it runs on Arduino with Firmata but when plugged into the Arduino headers of the Edison breakout board, it misbehaves. Namely, instead of my motors staying idle until I send the direction order, one starts going full throttle and I cannot stop it.
I have checked my pinouts and they look OK. I would need help investigating the problem here.
Here is the control code:
One important point worth noting is that the shield uses PWM9 which mandates the use of the PWM swizzler but this is unsupported by libmraa (only works with the Arduino IDE). For that reason, I am using jumper wires to route PWM9&10 to PWM5&6. As I said, this works fine with Arduino on Firmata.
Version info (johnny-five and edison-io/galileo-io installed via npm):
$ uname -a
Linux VincentR 3.10.17-poky-edison+ #1 SMP PREEMPT Wed Apr 29 03:54:01 CEST 2015 i686 GNU/Linux
$ cat /etc/opkg/mraa-upm.conf
src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic
$ opkg info libmraa0
Package: libmraa0
Version: 0.6.2
Provides: libmraa-dev, libmraa-dbg, libmraa-doc
Replaces: libmraa-dev, libmraa-dbg, libmraa-doc
Conflicts: libmraa-dev, libmraa-dbg, libmraa-doc
Status: install user installed
Section: libs
Architecture: i586
Maintainer: Intel IoT-Devkit
MD5Sum: 77c7285bd95f774b2b3b560a4480ad0f
Size: 266598
Filename: libmraa0_0.6.2_i586.ipk
Source: https://github.com/intel-iot-devkit/mraa
Description: mraa built using CMake
Installed-Time: 1433725304
$ node --version
v0.10.35
$ npm list |grep johnny-five
├─┬ johnny-five@0.8.77
$ npm list |grep -- -io
├── edison-io@0.8.14
├─┬ galileo-io@0.8.14
│ ├─┬ galileo-io@0.8.14
Note: I get the following when listing my npm packages, not sure if this is related :
npm ERR! extraneous: mraa@0.6.1-36-gbe4312e /home/root/node_modules/galileo-io/node_modules/mraa
npm ERR! not ok code 0
I could not find trace of a similar issue which is why I am posting here. Would anyone have suggestions on how to debug the problem?
Many thanks for your help!
Vincent
The text was updated successfully, but these errors were encountered: