Summary:
Dual MC33926 driver shield attached to Arduino Uno R3 (5v).
Both motor channels appear to work fine: PWM, direction, enable/disable all behave as expected.
But current sense for both (M1FB and M2FB) read extremely low; nowhere near 525mV/A.
Connections:
Motor shield connected to Arduino Uno R3 (as a shield).
Arduino connected to USB; no external power.
External 9v power supply to shield; “Arduino Vin” jumper removed.
Note that traces for pins 4 (D2*), 10 (M2PWM), and 12 (SF*) have been cut, with jumpers installed to reconnect D2* to pin 4 and M2PWM to pin 10; see below under “Target” for why.
There is continuity between header M2FB and Arduino pin A1, and between M1FB and Arduino pin A0.
Details:
A simple Arduino sketch to run a motor on M2 works fine (M1 too, but the following covers M2).
Duty cycle 100% (no PWM); duty cycle 50%; etc. all seem to work as expected.
Motor runs at different speeds, M2A/M2B signal on 'scope shows expected voltage and PWM duty cycle. Current draw (via ammeter) between 40 and 50 mA.
However, “AnalogRead” on M2FB returns 0 (no voltage); 'scope connected to M2FB (via Arduino pin A1) shows at/near 0 mV (hard to tell; there’s an awful lot of noise).
I’ve done the same thing with 1k resistors in parallel, instead of motor (to try to avoid noise). Ammeter shows expected current draw (e.g., 50 mA), but current sense voltage at/near 0 mV.
Loading the motor to draw approx 230 mA results in AnalogRead values between 1 and 5, mostly, with occasional readings down to 0 or up to 10. 'scope shows varying signal between 20 mV and 50 mV, averaging near the middle (about 30 mV). The voltage is consistent with the expected Arduino ADC output. By my math, that’s about 130mV/A; nowhere near the 525mV/A in the spec sheet.
I need to be able to detect 60mA draw (more specifically, an increased draw of 60mA), which does not register at all on the board I have with the setup I’m using.
Questions:
Is the current sensing expected to be linear at 525mV/A? Or is this low reading at low currents normal?
SF* remains unconnected. The board does not shut down, so SF* isn’t triggering (?). But could leaving it unconnected cause the low current readings?
Is this expected with a 9V power supply? (I have 12V and 14V, but motor won’t handle it).
Does this sound like an obvious/known problem that I have simply missed?
Yes, I know that I didn’t supply photos, schematics, sketches/programs, 'scope traces, or any of the other things suggested. I can. Just figured that a basic description might be enough, if it’s an easy problem; I can provide additional data in nauseating detail if it will help.
Target:
The purpose of this is to use the motor shield as a [model railroad] DCC controller via the “DCC++” Arduino library. This library uses the AVR timers to control pulse widths (through M1DIR and M2DIR, rather than M1PWM and M2PWM). The timers used conflict with the native shield pins (4, 10, 12), which is why those traces on the shield are cut, with jumpers for D2* and M2PWM installed to map to the timer pins.
Operationally, the motor shield and DCC++ library work fine: good signal waveform on M1 and M2; trains run; decoders are programmed. However, there is “no” current sensing. Which is a problem, because reading and verifying the decoder settings is done through increased current draw: I have to detect a 60mA increased draw to detect the decoder response. The low M2FB values make this impossible.