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 🙂
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:
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:
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:
💡 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:
Software
The software is written with the help of Processor Expert components. It runs FreeRTOS as operating system:
It features a command line (shell) interface using the OpenSDA USB CDC connection:
The shell commands are manually control the motors, perform calibration of the sensors or inspect the state of the system:
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 🙂
Hi! Eric this an awesome and funny application. Would you share the CW project?
LikeLike
Hi Manuel, sure, I’ll send it to you. It is not published on GitHub in all details yet, as I do not want to give the students the solution upfront :-).
LikeLike
Pingback: Pololu Line Following Robot with Freedom Board | MCU on Eclipse
Pingback: Freedom Robot solves the Maze | MCU on Eclipse
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?
LikeLike
please!
LikeLike
Hi Josefph,
sure, the link should be in the article, but here again:
https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples
Enjoy!
LikeLike
Pingback: FRDM-KL25Z RevE Board arrived | MCU on Eclipse
Pingback: Adding Quadrature Encoder to the Zumo Chassis | MCU on Eclipse
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
LikeLike
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.
LikeLike
Pingback: Zumo Robots in Bucharest | MCU on Eclipse
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!
LikeLike
Hi Cyril,
– FRDM-KL25Z with headers
– 2 Pololu 1:75 micro metal DC motors
– 4 AA batteries
– Pololu S7V7F5 DC-DC converter
– Pololu Zumo chassis kit with blade and reflectance sensor
– cables and tools as needed
And don’t use the Raspy Pi for this, the FRDM-KL25Z is more than sufficient and allows you to do this in realtime without the Linux overhead.
LikeLike
Thanks a lot! Hopefully, I’d be able to follow the instructions on the zumo-line. But, I couldn’t find the project on github. Do you have the details for this project? I’m currently using a Kinetis Design Studio 3 IDE.
LikeLike
There is a project on GitHub for CodeWarrior here: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/CodeWarrior/FRDM-KL25Z/Freedom_Zumo
If you don’t have CodeWarrior installed, you simply can use the sources. If you have CodeWarrior installed, create a new project for the FRDM-KL25Z in KDS, open the CodeWarrior project with CodeWarrior and copy the components to the KDS project (see https://mcuoneclipse.com/2013/03/31/copy-of-processor-expert-components/).
LikeLike