DSCF5810.jpg

MC40SE, Controller for Line Following Robot

Last month I talk about Remote Controlled Mobile Robot using MC40SE, this month I want to use it for simple line following robot.

MC40SE, Advance Mobile Robot Controller

There are questions about MC40SE, whether it is compatible with AR40B (Enhanced Autonomous Robot Control Board). It is not fully compatible if you want  to compare apple to apple, but I would say it is still 85% compatible with AR40B. Why? Because:

  • Support Brushless motor, LINIX or Vexta, same as AR40B.
  • Support MD30B, MD10B, MD10C, actually MDS40A also.
  • Support PIC16F877A, the ZIF socket compatible, but MC40SE come with newer PIC, PIC16F887.
  • Rotary encoder input, AR40B come with 2 ports, but MC40SE come with 1 port for rotary encoder, and you can select the operating voltage.
  • 8 digital ports, MC40SE allow user to select operating voltage for sensor, 5V or 12V.
  • 1 or 2 battery for operation.

Now, what has been added to MC40SE? What is the improvement?

  • As mentioned, the board come with PIC16F887 instead of PIC16F877A because 16F887 come with internal oscillator of 8MHz 🙂 Yet, if you don like 887, you can still replace it with PIC16F877A. Not to forget PIC18F such as PIC18F4520, you can also use it on MC40SE.
  • 2×8 parallel LCD for message display. You can use it for sensor status display, as menu navigation, instruction for user, etc. Is very useful.
  • Add in buzzer which is parallel with at LED indicator, it can provide you the sound indication.
  • Better polarity protection at battery input for motor and logic.
  • Reduce the ADC port  to 1 and offer voltage selection for analog sensor, 3,3V, 5V and 12V.
  • Provide UART port for UC00A connection or connection to external board such as SC08A for RC servo controller.
  • Come with socket for SKPS, SKXBee, SKKCA for various wireless connection. SKPS will offer user to create PS2 controlled which has been shown here.
  • Reduce the Relays to 4 which can support 2 brush motors. However, user is able to add external relay as the extra pin is extended out.
  • Come with UIC00B’s ICSP box header for user to load program using UIC00B.

To use the MC40SE, please refer to the User’s Manual 🙂 Never start using a development board without going through the User’s Manual, we do not take care/warranty for any misuse by user. Wrong voltage, wrong polarity, wrong connectors…..etc. So please please go through the User’s Manual.

Hardware Setup

It is always important to ensure hardware is correctly mounted, wiring is correct, sensor is assigned correctly, left and right motor, gear ratio etc are correct. I am sure, if your robot does not move as shown in the video, it is due to hardware 🙂 I will be using the same motor as I use in Remote Controlled Robot, the LINIX Brushless Motor, 10W, gear ratio 15:1 (45ZWN10-15G) together with the 4” Nylon wheel. Again, you need to make sure the left and right motor is connected correctly to the MC40SE board as wrong connection will lead to weird locomotion when the robot start. I am not going to use SKPS + PS2 controller, we will leave that because now is about line following robot. Instead, I will add 4 fiber optic sensors. I am using Hokuyo fiber optic sensor, we don carry that, but it is similar to SICK fiber optic sensor.

For those taking part in ROBOCON 2012, we notice that the game field consist of Red zone, Blue zone and also green zone. Using the Red light source sensor will confuse the sensor when the robot enter Red zone, same happen to Blue light source when robot enter Blue zone. Anyway from the test we carry out the Green light source fiber optic sensor have very good method to differentiate all the color include green and white :), please do use it together with the fiber optic cable.

The list of hardware needed:

  1. 1 x MC40SE board (PIC16F887).
  2. 2 x LINIX Brushless Motor, 10W, 15:1 gear ratio (45ZWN10-15G) with BLD04A driver.
  3. 2 x 4” Nylon wheel, ensure the coupling size is for Linix 10W motor.
  4. 2 x 12V battery, you can use Sealed Lead Acid (SLA) or Li-Po. Extra battery is needed if you like to control brush motor for mechanism.
  5. 4 x fiber optic sensor, you can choose from here.
  6. A robot base which mounted with castor and Brushless motor properly.
  7. UIC00B which I think most of people already have it.

1st, power up your MC40SE with proper power supply and ensure the connection is CORRECT! Since this example uses Brushless motor and it require 24V, I will need to use two 12V battery. I will use Seal Lead Acid, 12V, 7Ah. Please DONOT Share 1 battery, you will need 2 separated battery to get 24V, also do not series it externally, MC40SE will do the series connection on board. MC40SE battery connector is using Dean-T, you should have the female connector and please solder it properly and correctly with shrinking tube to protect it. Connect both battery to MC40SE board, should be at the left top corner. Switch on the “Main SW”, you should hear buzzer sound and LCD should display some message and you can start playing with the test code. Some of the tests can be done with device on MC40SE such as LED and buzzer, but most of the tests require external device such as sensor, encoder, brushless motor, etc. So you might want to skip that.

2nd, power off the MC40SE, is time to connect the brushless motor, left and right motor to drive the robot. I am using the previous project configuration, Left motor should be connected to port Brushless 1, while Right motor should be connected to Port Brushless 2 on MC40SE.

Brushless on MC40SE

  • Left Motor, the control wiring should be connect to “Brushless 1”
  • Right Motor, the control wiring should be connect to “Brushless 2”
  • Also, the power to Brushless motor, MC40SE is using white, bigger and better gripping connector for power. You need to connect and make sure the polarity is correct.
  • Power up the MC40SE (two separated battery is required), the BLD04A brushless motor driver should have green LED light up to indicator power is there.

3rd, line following will not work without line sensor 🙂 Now, you need to off the MC40SE’s power again, we need to connect fiber optic sensor. I will be using 3 fiber optic sensor for line following and another sensor for cross counting, so total 4 will be used.

DSCF5818

As you can see from the picture, four sensors are connected to MC40SE:

  • SEN1 is left sensor
  • SEN2 is middle sensor
  • SEN3 is right sensor
  • SEN4 is cross counting sensor.

Bare in mind, there is polarity for wiring on sensor port. Depends on the brand of sensor you use, please check the datasheet. “+” is to the power input of sensor, “-“ is the GND of sensor, “s” is the output of sensor. Do connect it properly, the connector and iron pin should come together with the MC40SE.

DSCF5817 Mount the sensors properly in front of the robot. I uses the proper sensor grill to mount the sensor. Make sure the distance of the light source to the floor is within 1.5cm to 2.5cm. Anyway, you should be using fiber optic cable to have better color sensing. I am out of fiber cable in my lab, so I have no choice to mount the sensor without fiber cable.

DSCF5814

Distance between sensors, ensure at least there is a sensor sensing the white line and don get them too near to utilize the sensing space. You need to calibrate the sensor until it can reliably sense the white line. How to teach the sensor, please refer the datasheet/instruction manual. It should come with the sensor.

DSCF5811 As for the cross line sensor, I mounted it at the back of brushless motor, you can put it either left or right motor. I notice it is better to mount it at the back 🙂 Again, you need to calibrate the sensor properly to detect the white line. This sensor should be connected to SEN4 on MC40SE.

DSCF5810

As you can see in the picture, three sensor are mounted in front and 1 sensor is mounted at the back of left brushless motor. MC40SE sit in the front of robot.

Program

The sample code can be downloaded here. It is a complete project folder for MPLAB IDE v8.63. The sample code is developed free and therefore we do not take any responsibility to ensure the working of code nor the modification to suit your project requirement. If you have problem, you are welcome to discuss in our technical forum. Download the project folder, unzipped it. Open MPLAB IDE (v8.63), Open Project, browse to the folder you just unzipped, you should see a file with MC40SE. Open it and and all the other necessary files should be included in to project windows. Again, feel free to modify the code as you like. If you want to try out, simple use UIC00B to load the hex code from the same folder, there is only 1 hex file 🙂 Remember the project code is written base on:

  • MC40SE, mobile robot controller board
  • PIC16F887, using internal oscillator, 8MHz. This PIC comes with MC40SE.
  • MPLAB IDE and compiled under HI-TECH C PRO for PIC10/12/16 v9.80 operating in LITE mode.
  • 4 sensors as connected on MC40SE and mounted as shown.
  • Linix Brushless Motor, 10W, gear ratio 15.

After you calibrate the sensor and place your robot on the white line, power up the MC40SE. You should see some message display on the LCD. Wait for a while, the LCD will display “ SW1 to Start!”. Now you can press SW1 on MC40SE to activate the line following program. The program is written for the robot to follow line and count cross. After 3 cross, it will stop and make a U turn, and continue to line following until 2 rounds 🙂

Summary

The program and project is just for reference, you are free to modify and improve it. Anyway if you have problem, you are welcome to discuss it in our technical forum. Here is the short video showing Mobile robot following line, enjoy it! Do share with us if you did a line following robot.

Buy

, , ,

Related Post

OUTPUT.jpg

LSA08 Line Follower with MC40SE

DSCF7572.jpg

Manual Robot with MC40SE and MDS40A

DSCF4231_thumb.jpg

Remote-Controlled Robot

ir-sensor-340-280x373

Line Following Robot?

One thought on “MC40SE, Controller for Line Following Robot

  1. hi,
    i have tried out the program, my robot can follow line but cannot make u turn, i’m also using hokuyo sensor, but i connect it using black, brown n blue wire instead of u connecting white wire, i’m using linix 30w gr 10, why cant i pivot? please help asap

Leave a Reply

Your email address will not be published. Required fields are marked *