1
$\begingroup$

I purchased a Pololu Dual MC33926 Motor Driver Shield for Arduino, and for some reason I cannot read current from the motor controller. On the Serial.println() it just prints weird data (garbage), and when I use ROS (Robot Operating System) I only see -0.0 (minus zero) value for both motors.

All I've done is plug the shield on my Arduino UNO R3 model, and run the demo that comes with the sample library -- http://github.com/pololu/dual-mc33926-motor-shield .

How can I fix this issue?

$\endgroup$
  • $\begingroup$ Maybe a silly question: but do you have chosen the right baut-rate? In the example code they use 115200. Not the default 9600 $\endgroup$ – TobiasK Sep 18 '14 at 6:44
  • $\begingroup$ What do you see when you use a multimeter to measure the voltage at the holes labeled M1FB and M2FB relative to GND? $\endgroup$ – David Cary Sep 20 '14 at 19:13
  • $\begingroup$ Does the demo make your motors turn, or does running the demo have no visible effect? $\endgroup$ – David Cary Sep 20 '14 at 19:14
4
$\begingroup$

When there is miscommunications between the microcontroller and a chip, assuming the electronics are not damaged, there could be a couple of things that can go wrong. Of course, further diagnosis is required. Typical things that could go wrong are (generally, not just in your particular case):

  1. Connections: Is the chip connected to the correct power supply? Is it soldered correctly? Did you connect the right pins together?
    • A tester (multimeter) along with the datasheets are helpful to verify that the connections are alright.
  2. Bus requirements: Are all requirements of the bus fulfilled? Some buses (e.g. CAN) need terminating resistors. Some have limitations on the the length.
    • The microcontroller datasheets usually have information and even useful example pictures that show how the bus must be connected.
  3. Noise: Assuming no external noise, on high frequencies the bus has to meet other criteria. For example 90 degree bends cause reflection.
    • An oscilloscope helps here. If there are reflections, you would see noise over your signal. If the noise makes the signal go as far as reaching the middle voltage (between logical 0 and 1), there is a good chance the hardware would misread the bit. This is especially bad on the clock bus, if any.
  4. Configuration: Are the pins and peripherals of the microcontroller correctly configured?
    • Read the datasheets very carefully and pay attention to every single line. Don't take one line "notes" lightly, they often contain information that if missed would make the peripheral not work. Look at the errata of the microcontroller as well for possible hardware bugs.

Since your bus is UART, I'd say number 2 and 3 are likely not an issue. After checking the connections, I would verify that the configuration is ok. As kinkilla commented, it could very well be that you configured the wrong baud rate for your bus.

If you still cannot figure out what the problem is, it is best to attach an oscilloscope and see what signals are actually on the wires. There are very good oscilloscopes that are expensive (but you may have access to if your lab or work environment has one), but there are also very cheap ones that attach to the computer with USB and all the software runs there. The cheap ones cannot measure with as much detail as the expensive ones, but with UART speeds that is not at all an issue.

That said, you can check with oscilloscope what signal is on the wire. If the signal has a bad shape and is coming from a chip you didn't configure (so we can assume it should work correctly out of the box), it could be that the bus is shorted with another or the microcontroller is badly configured (so there are more than one person driving the bus. If the signal is coming from the microcontroller, there could be similar reasons as well as bad configuration. If the signal is ok, then you are receiving it badly. If the bus is correctly connected to the microcontroller, then the cause is most likely the configuration of the microcontroller.

$\endgroup$
0
$\begingroup$

Sensitivity of the sensor is approx. 525 mV/A. I was trying the same motor Driver - MC33926 and when there was a very low load of the motor, the 0 as the output was correct, because it was drawing very small current.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.