NXP-Linefollower
README.md

NXP Cup Line Follower - Complete Documentation

NXP Cup Shield

๐Ÿ“‹ Overview

This repository contains comprehensive documentation for building and programming a line follower robot for the NXP Cup competition using the FRDM-MCXN947 development board.

The project includes:

  • Hardware assembly guides (shield PCB and complete car)
  • Programming tutorials (MCUXpresso IDE setup and firmware development)
  • Component lists with purchase links

๐ŸŽฏ Project Components

Main Hardware

  • FRDM-MCXN947 - NXP Freedom development board (Arm Cortex-M33)
  • NXPCUP-Shield-FRDM-MCXN947 - Custom shield PCB for motor drivers and sensors
  • 8x Line Sensors - Infrared reflective sensors with LM339 comparators
  • 2x DC Motors (25GA-370) - Rear wheel drive
  • 2x DRV8833 - Dual H-bridge motor drivers
  • LiPo Battery - 7.4V 2200mAh with XT60 connector

Software

  • MCUXpresso IDE - Development environment
  • MCUXpresso Config Tools - Pin and peripheral configuration
  • SDK for MCXN947 - Hardware abstraction layer

๐Ÿ“š Documentation Structure

๐Ÿ“– Main Tutorial

Start here for the complete assembly and programming guide.

Detailed Guides

  1. Component List

    • Complete bill of materials
    • Purchase links
    • Required tools
  2. Shield Electronic Components

    • Detailed component specifications
    • Resistors, capacitors, ICs, connectors
    • Polarized component warnings
  3. Shield Assembly Guide

    • Step-by-step soldering instructions
    • 19 detailed assembly steps with images
    • Quality checks and verification
    • PCB cleaning
  4. Car Assembly Guide

    • Mechanical assembly (chassis, motors, wheels)
    • Electrical connections (motors, sensors, battery)
    • 15 detailed steps with safety checks
    • First power-on test
  5. Programming Guide

    • MCUXpresso IDE installation
    • SDK setup
    • LED blinky demo
    • Project import
    • Sensor reading functions
    • Motor control functions

๐Ÿš€ Quick Start

1. Gather Components

Review the component list and order all required parts.

2. Assemble the Shield

Follow the shield assembly guide to solder all electronic components onto the PCB.

Key steps:

  • Solder resistors, capacitors, diode
  • Solder IC sockets and connectors
  • Mount DC-DC converter and motor drivers
  • Insert LM339 ICs
  • Verify with multimeter

3. Assemble the Car

Follow the car assembly guide to build the complete robot.

Key steps:

  • Mount motors and wheels
  • Install ball caster
  • Mount FRDM-MCXN947 board
  • Connect shield
  • Mount line sensors
  • Install battery
  • First power-on test

4. Setup Programming Environment

Follow the programming guide to install and configure the development tools.

Key steps:

  • Create NXP account
  • Download and install MCUXpresso IDE
  • Install SDK for MCXN947
  • Install Config Tools
  • Test with LED blinky demo

5. Import and Run Project

  • Import the provided line follower project
  • Build and download to board
  • Test sensor reading and motor control

6. Implement Your Algorithm

Use the provided sensor and motor functions to create your own line following algorithm!


๐Ÿ› ๏ธ Key Features

Hardware

  • โœ… 8 line sensors with digital output (via LM339 comparators)
  • โœ… Differential drive control (2 independent DC motors)
  • โœ… DRV8833 motor drivers with PWM speed control
  • โœ… 5V regulated power from 7.4V LiPo battery (MP1584EN)
  • โœ… Modular design with stackable shield
  • โœ… Easy debugging via USB (MCU-LINK)

Software

  • โœ… Pre-configured project with sensor and motor drivers
  • โœ… Simple API for sensor reading and motor control
  • โœ… CTIMER PWM for smooth motor speed control
  • โœ… GPIO digital input for fast sensor reading
  • โœ… Flexible configuration via macros

๐Ÿ“ Technical Specifications

FRDM-MCXN947

  • MCU: MCX N947 (Arm Cortex-M33)
  • Flash: 2MB
  • RAM: 512KB
  • Clock: Up to 150 MHz
  • Peripherals: CTIMER, GPIO, UART, I2C, SPI

Motors

  • Type: DC geared motors (25GA-370)
  • Voltage: 6-12V
  • Speed: ~1000 RPM at 12V
  • Control: PWM (0-100%) + direction (2 GPIO pins per motor)

Sensors

  • Type: Infrared reflective (8 sensors)
  • Output: Digital (0/1 via LM339 comparators)
  • Detection range: 3-5mm optimal
  • Interface: GPIO digital input

Power

  • Battery: 7.4V 2S LiPo, 2200mAh
  • Regulation: 5V @ 3A (MP1584EN step-down)
  • Connector: XT60

โš ๏ธ Safety Warnings

LiPo Battery Safety

  • โš ๏ธ Never short circuit battery terminals
  • โš ๏ธ Never charge unattended
  • โš ๏ธ Always use LiPo-specific charger
  • โš ๏ธ Always store in fireproof bag
  • โš ๏ธ Check polarity before connecting (XT60 connector)

Soldering Safety

  • โš ๏ธ Wear safety glasses
  • โš ๏ธ Work in well-ventilated area
  • โš ๏ธ Avoid touching hot soldering iron
  • โš ๏ธ Wash hands after handling solder

Electrical Safety

  • โš ๏ธ Verify polarity before connecting battery
  • โš ๏ธ Check for short circuits with multimeter
  • โš ๏ธ Turn off power before making connections
  • โš ๏ธ Keep liquids away from electronics

๐ŸŽ“ Educational Objectives

This project teaches:

  • Electronics: PCB assembly, soldering, component identification
  • Embedded systems: Microcontroller programming, peripheral configuration
  • Control systems: PWM, GPIO, sensor interfacing
  • Robotics: Differential drive, line following algorithms
  • Debugging: Multimeter usage, troubleshooting hardware/software

๐Ÿค Contributing

This is an educational project for the NXP Cup competition. Contributions are welcome!

How to contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/improvement)
  3. Commit your changes (git commit -m 'Add improvement')
  4. Push to the branch (git push origin feature/improvement)
  5. Open a Pull Request

Areas for contribution:

  • Additional assembly photos
  • Code examples
  • Algorithm improvements
  • Translations

๐Ÿ“„ License

This project is open source and available under the following licenses:

  • Hardware (PCB, schematics): CERN Open Hardware Licence v2 - Strongly Reciprocal (CERN-OHL-S-2.0)
  • Documentation (markdown, images): Creative Commons Attribution-ShareAlike 4.0 (CC BY-SA 4.0)
  • Software (firmware, code examples): MIT License

See LICENSE for details.


๐Ÿ”— Resources

Official Documentation

Datasheets

Community


๐Ÿ“ง Support

For questions or issues:

  • Search existing GitHub Issues
  • Open a new issue with detailed description

๐Ÿ† Acknowledgments

  • NXP Semiconductors - for the FRDM-MCXN947 platform and NXP Cup competition
  • Contributors - everyone who helped improve this documentation
  • Students - who will build amazing line followers with this guide!

Shield Front Shield Back
Complete Car Front Complete Car Side

Ready to build your line follower? Start with the Main Tutorial! ๐Ÿš—๐Ÿ’จ


Made with โค๏ธ for NXP Cup