Main Site Documentation

Panda + 2A Motor Sheild + MOSFET = Golf Cart Controller


Hello FEZ users new here but thought I would present to you my plan to upgrade my old resistor type golf cart to a much more user and battery friendly setup. My plan is to use a POT to drive an analogue input based on voltage to set the PWM to drive the 2A motor controller which in turn will drive a high power MOSFET to deliver the needed 36V to the drive motor on the cart. I have my Panda and motor shield on the way and will start small by at first just getting everything working with a small 12V motor and go from there. Any input would be greatly appreciated as this will be my first project based on the NETMF platform I am sure I will have many questions along the way so I look forward to conversing with fellow FEZ users! 8)


How do you plan on isolating the FEZ?


As I said I am new to this but would think the motor shield would isolate the FEZ as the shield will be driving the MOSFET, I may however be mistaken and any input from the great minds on this forum is welcomed. It’s been well over 10 years since I messed around with programming PIC’s (not that the Panda is anything even compairable FEZ looks so easy) but I am interested in getting back into the scene! :wink:


I wonder what the stall current is on those puppies?


I’m not sure that using the motor shield to try and drive a larger mosfet will work. If you don’t get the mosfet turned all the way on or off it will over heat. My point about isolation was that generally when using a uC to control high voltages you want to isolate the uC from the high voltage section so if something goes wrong the uC does not get blown up (or catch fire.)

I can’t tell from reading this one. Wonder if your logic can be different supply then high volts here or if you need common gnd?


Thanks for all the input guy’s it gives me a lot to think about :o. I did receive my Panda in the mail yesterday and got a small program loaded and running that ramps up and down PWM on an LED ;D 8). Now I am going to look into what code I will need to control that LED with a POT. Any links to some example code would be much appreciated!

Thanks again everyone :wink:


@ budman. Not sure understand. tmk, controlling led current via a pot is no code, just add pot. Are you saying control current via mosfet and gate code?


Sorry should have been more specific, I would like to use the Panda to control the PWM output based on the input from the POT using an AO input. As of last night I have the code set to drive the LED at 50% until I press a button and then it changes the duty from 5% to 95% up and down until I release the button. I basically want to be able to adjust a pot and based on the voltage the uC sees be able to send out a PWM value.

Edit: I am just taking baby steps at first to try to get familiar with NETMF so that is why I am try ing to control the LED. After I get that worked out I will venture into the motor sheild and try to get a small 12V motor to be control by PWM based on the pot value. Then I will have to design some type of circuit that will let me control a high powered mosfet for my golf cart motor.


look for the potentiometer code on fezzer - or the driver from the GHI hardware potentiometer. It’s pretty simple, read the analog in to determine the relative value - then translate this to your PWM duty cycle.


Thanks Brett will do that now, also how would you translate the value to the PWM output in code?


you read a value between 0 and 1023 from an analog input. 0 meaning 0% and 1023 meaning 100%. You then do some maths to work out the percentage and set your PWM duty based on that. Simple huh!