Zumo Line Following with FRDM-KL25Z

With the Zumo I have a base platform for cool robotics applications. So why not build a line following robot with this? Especially as Pololu offers a reflectance sensor array for it. The result is: I have a line following robot 🙂

Line Following ZumoBot

Line Following ZumoBot

It turned out that things were not working out of the box with the FRDM-KL25Z board. So if you want to do the same thing, here are some tips how to make it working with the Freedom board.

5V Power for the Shield

The Freedom board does not generate 5V from the V_IN (Battery) supply voltage. The Zumo Arduino shield expects the 5V generated from the Arduino microcontroller board. To overcome this limitation, I’m using a tiny S7V7F5 DC-DC step up/down voltage converter which generates 5V from 2.7..11.8V. I have it soldered on a 3 pin header and placed it on the Zumo shield:

Voltage Converter

Voltage Converter

On the backside, I have the DC-DC converter connected to GND and V_IN on the shield headers, and wired the 5V output to the 5V pin:

DC-DC Converter Connection  Backside

DC-DC Converter Connection Backside

Reflectance Sensor Array Supply

The Reflectance Sensor Array is using 5V logic levels by default, as designed to work with 5V Arduino (or compatible) boards. While that works with 5V tolerant input pins, it is not ideal from a timing perspective to use it with 3.3V logic levels (charging and discharging the sensor capacitors). So I changed the supply voltage to 3.3V which is the logic level for the Freedom board. Unfortunately the sensor array connector does not offer a 3.3V option, so I have cut the 5V pin and wired it to the 3.3V on the shield:

3.3V Sensor Array Connection

3.3V Sensor Array Connection

3.3V Power Connection for Reflectance Array

3.3V Power Connection for Reflectance Array

💡 Pololu offers another sensor array which is designed for both 3.3V and 5V which could be used with the Zumo.

D4 and Kinetis NMI

The other issue with the original Pololu sensor module is that the leftmost sensor is connected to the Arduino shield data 4 (D4) pin. Unfortunately this pin is connected to the NMI (Non-Maskable Interrrupt) of the Kinetis Cortex-M4 on the Freedom Board. That way it happens that it creates an NMI interrupt.

💡 It is possible to disable the NMI functionality of that pin for the KL25Z. However, depending on the sensor state during startup/power-on of the microcontroller, this still very likely will raise an NMI, especially right after flashing/debugging the device. The problem can be avoided if debugging is done without powering the sensor array. That means that the battery supply voltage needs to be switched off during flashing and startup of the microcontroller. This worked for me, but was painful after a while.

The solution is to re-route the D4 sensor to another pin. For this a trace on the sensor board needs to be cut, and rerouted to another pin. I used A1 as this pin is available on the connector and I have not used it otherwise:

Connection of Sensor D4 to A1

Connection of Sensor D4 to A1

Software

The software is written with the help of Processor Expert components. It runs FreeRTOS as operating system:

Processor Expert Components

Processor Expert Components

It features a command line (shell) interface using the OpenSDA USB CDC connection:

Shell Commands

Shell Commands

The shell commands are manually control the motors, perform calibration of the sensors or inspect the state of the system:

System Status in Shell

System Status in Shell

ZumoBot in Action

The following video shows the ZumoBot following a line. After power-up, the sensors get calibrated with moving the sensors over the line, while the sounder is on. Another press of the button runs the line following (PD control loop) algorithm. If the robot does not detect a line any more, it stops:

Happy Line Following 🙂

16 thoughts on “Zumo Line Following with FRDM-KL25Z

  1. Pingback: Pololu Line Following Robot with Freedom Board | MCU on Eclipse

  2. Pingback: Freedom Robot solves the Maze | MCU on Eclipse

  3. It’s great, really amaizing i follow yoy tutorials, and thank you very much for doing that work, but i like try make that zumo line following, Would you share the CW project?

    Like

  4. Pingback: FRDM-KL25Z RevE Board arrived | MCU on Eclipse

  5. Pingback: Adding Quadrature Encoder to the Zumo Chassis | MCU on Eclipse

  6. Hi,

    I’m planing to build a Zumo robot based on your articles. I’d like to know if I’m right on the following matter:
    I’ve an FRDM-KL25Z Rev E board for this project.
    Based on your article: https://mcuoneclipse.com/2013/06/21/5v-generation-from-v_in-on-the-freedom-board-reve/
    I think that if I install the 5V regulator directly into the FRDM-KL25Z board it will provide the necessary supply to the sensor array without cutting pins, cross connecting wires.
    Am I right?
    Thanks,
    Zoltán

    Like

    • Hi Zoltán,
      Yes, you can put the 5V DC/DC converter on the RevE board, then you do not need to place it on the Zumo PCB. However, you still need to do that sensor array modification. Otherwise the sensor array is on 5V, but your FRDM board is on 3.3V. Not making that cutting pin and 3.3V supply will likely damage your FRDM board.
      So you absolutely want to make that sensor array modification.
      I hope this helps.

      Like

  7. Pingback: Zumo Robots in Bucharest | MCU on Eclipse

  8. Hello Erich,

    Could you give me the list materials needed for this project because I am planning to build a line follower using my FRDM KL25Z board. I’m just doing it for my hobby and I’d be joining a competition for speed racing competition. I also have a raspberry pi model 3 b. Thanks!

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.