element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Documents Tutorial FRDM-KL25Z & ARDUINO: Zumo Line Following with Freescale Freedom Board
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Arduino requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: FreescaleTools_and_Software
  • Date Created: 11 Feb 2013 3:59 PM Date Created
  • Last Updated Last Updated: 8 Oct 2021 5:27 AM
  • Views 863 views
  • Likes 0 likes
  • Comments 0 comments
Related
Recommended

Tutorial FRDM-KL25Z & ARDUINO: Zumo Line Following with Freescale Freedom Board

This tutorial was extracted from Erich Styger blog http://mcuoneclipse.wordpress.com with his agreement.

image image

  

  

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

 

   

:idea: 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.

  

:idea: 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 A0 as this pin is available on the connector and I have not used it otherwise:

 

   

D4 Sensor Rerouting to A0

D4 Sensor Rerouting to A0

 

 

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 :-)

  • avr
  • microchip
  • zumo
  • cortex-m0+
  • kl25
  • freescale
  • Cortex-M
  • robot
  • cortex
  • frdm-kl25z
  • stm32
  • kinetis-l
  • line_following
  • cortex-m0
  • nxp
  • st
  • arm
  • arduino
  • freedom
  • pic
  • atmel
  • lpc
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube