MC40SE is designed as advance mobile robot controller. With the rich features, it helps beginner to get start in building mobile robot, yet reserving the feature to expand the capabilities of the controller. User may start in no time with powering up the controller and use it for build their own robot. SmartDrive40 is one of the latest smart series motor drivers designed to drive medium to high power brushed DC motor with current capacity up to 80A peak and 40A continuously. MOSFETs are switched at 16 KHz to ensure quiet operation and no annoying whining sound. Besides, it also equipped with a micro-controller unit to provide some smart features such as multiple input mode, current limiting and thermal protection. SmartDrive40 can also be hooked up with another similar unit and operates in pair. This make driving a robot with differential drive a truly plug and play experience. This SmartDrive40 is also suitable to use in Combat Robot because it is able to drive starter motor and operate in RC mode. Let see what it can do here. Let start our project .
• MC40SE x1
• MOTOR x2
• WHEEL x1
• BATTERY x3
• SKPS x1
• PS2 CONTROLLER x1
• PICKIT 2
1. So the chassis I use is like the picture below. You can self build any chassis you like. This is just my demo project.
2. Motor I use is starter motor and it’s already being modify to run if DWI-direction. What had done is the body terminal has been cut off and been replace so that it had become a normal 2-wire connection motor.
3. Now, I would like to talk about the example program that had been done. So let look at below and I will explain 1 by 1 of it and talk about the problem you may meet later on.
Read first before you start doing the project. The project maybe harmful!!!
1. Check all the positive and negative terminal else you will get shock circuit.
2. Check the battery connection
3. PLEASE LIFT YOUR ROBOT BEFORE YOU ON ANY POWER
4. DONT SWITCH THE CONTROLLER BEFORE YOU SWITCH OFF THE MOTORDRIVER
5. Please note that there where no kid beside.
Example1: Signed Magnitude
So we should set the mode to signed magnitude so that it indicate that. In Signed Magnitude mode, IN1 is to control the PWM(speed) and IN2 is to control the direction(left or right)
So For the connection is like the below picture.
this is the clearer version to be looking too(the microcontroller is MC40SE
In this code, we can change speed and direction use only 2 joystick in the middle.
Example2: Locked Antiphase
So we should set the mode to Locked Antiphase as indicate below. In locked antiphase mode, IN1 is to control the PWM(speed) and IN2 is to control the direction. Each motor driver receive its own signal.
The connection of the wire is like below:
So, this part I have to change the pwm immediately to 512 to stop the motor to turn after I initialize the port of the motor. If not the motor will run everytime reset.
This is the sample code:
Example3: Mix mode
So we should set the mode to Mix mode as indicate below. In Mix mode, both IN1 and IN2 share the same signal of PWM for the both controller. But the MotorDriver will automatically detect the signal and with the mode set it will self determine the direction that it should turn.
PROBLEM MAY OCCUR
1. PWM MODE: to understand video got illustrate the pwm signal.
The PWM that we use is 10bits PWM. So, when we set the PWM value using the function given, the maximum value that can be use is 1024bits instated of 256bits. So, if we give the wring value to the controller PWM to instruct it to do something. Since the value goes wrong, that mean the robot will definitely do something that we unsuspected. Please note that we are using 10bits PWM. So, if you want see the pulse of the PWM you can refer to the video below.
2. MOTOR MISDIRECTION
Electrical DC motor usually runs on direct current. It’s often used to run machinery. It can move once there are electricity move directly to it. So DC motor does not have polarity (this mean no +ve or -ve area. Just insert the power and it will run. When you find the motor are in inverse direction of what you want. You can either check at mode that you set is wrong or correct, else just switch polarity of the motor wire if in wrong direction.
3. MOTOR WILL RUNS WHEN:(IMPORTANT SAFETY MEASUREMENT!!!)
Please note that the power for the motor driver and the controller are different. When in some mode the motor will turn when you shut off the power supply of the controller. This is cause by the ground signal when controller is shutting down. The the PWM signal will receive 0 and turn at full speed. So we are highly recommend that please jack-up your robot before you start doing anything for SAFETY PURPOSE!!!
Video to view:
Sample Source Code: