Here are a few notes about using the Netduino with the MC1-HV motor controller from Robot Solutions. This is a monster H-Bridge controller that is no longer manufactured, and is capable of handling 400+ amps of power. It's based off of the Open Source Motor Controller (OSMC), and uses the same microcontroller interface.
A 10 pin port is used to communicate with the MC1. Looking at the MC1 documenation, doing some testing, and researching on the web, I believe the 10 pins are set up as:
There is a handy chart in the documentation that shows suggested input.
I used the suggested input waveforms according to the above chart. There are other ways to drive the MC1 that doesn't include braking when there is no PWM on ALI or BLI. Additionally, I may try using the Locked Antiphase method of driving the HBridge to avoid the skateboard "running away" from the user on a steep slope. At first blush, it doesn't appear that the Netduino is capable of generating "Complimentary PWM" signals withouth additional hardware. There are components out there that are designed to do this, but I have not explored this option in detail yet.
The Netduino has four pins that are capable of generating PWM signals, 5, 6, 9, and 10. The default rate for the PWM signal is 10khz, which seems to be an acceptable rate for the MC1. However, after reading up on the Magmotor, 8khz seemed more appropriate. A little extra code is required to use non-standard PWM rates, but it is possible on the Netduino.
Unbeknownst to me, the original MC1 I was using had something wrong with it, causing it to act erratically at specific duty cycles and PWM rates. After fighting it for several days, I swapped out to another MC1, and the problems went away.
Additionally, I found that Pin 3, which is shown as ground on the MC1 schematic does not work as expected. I found a few brief notes on the web stating that this pin could be used to monitor battery voltage. However, I couldn't find any specific directions on how to do this. Instead of using this as ground, I ended up using pin 9 instead, which worked as expected
By using the suggested control mechanism, the controller will brake when no motor output is specified. This isn't really good for a skateboard, as it would apply the brakes when the device is level. It seemed to me that if you were moving along at a good pace, then leveled out the skateboard you would potentially be thrown forward pretty quickly. So instead, when I detect that the skateboard is level, I tell the controller to coast.
There are a few ways to do this. My initial attempt was to set the Disable pin to high, to effectively turn off the controller. While this worked, I later read that re-enabling the controller takes a bit of time, and isn't the preferred method if you're going to be quickly enabling/disabling the controller. So I switched to setting AHI and BHI low when I needed to coast. This resulted in a noticeable difference in feel (for the better).