ECE 477: Digital Systems Senior Design                Last Modified: 09-10-22

Software Overview

Year: 2022        Semester: Fall        Team: 16         Project: Repeat Rover

Creation Date: 09-07-2022                Last Modified: 09-10-2022

Author:  Andres Barrera                Email: barrer10@purdue.edu

1.0 Software Overview

Repeat Rover is a remote-programmable R/C vehicle designed for resource delivery in repeated process environments such as manufacturing plants and product storage warehouses. As such, firmware has a critical role, reading data from peripherals and performing calculations to determine vehicle metrics. More specifically, the Repeat Rover firmware determines vehicle speed and distance traversed from the wheel speed sensors, vehicle bearing from the magnetometer, stores and retrieves data in a SD card, sends direction and speed information to the motor controller, and wirelessly receives vehicle instructions from bluetooth.

1.1 Basic Function

        With simple manual instruction via the bluetooth-communicated commands, the Repeat Rover will store direction and distance data in a file within a SD card while driving the motors. Once programming is complete and a bluetooth “DONE” command has been sent, the Repeat Rover will retrace its path back to origin. When prompted with a “REPEAT_PATH” bluetooth command, the Repeat Rover will repeat the directions stored in the SD card by traversing the path, and then inverse the path, to retrace its steps and return to origin.

1.2 Wheel Speed Sensor

The wheel speed sensor sends a digital pulse through an amplifying and noise-filtering interfacing circuit to the main nRF52832 controller. This pulse is read as a logic high when it exceeds the voltage threshold of Voltage Input High, VIH = 0.7 VDD, and a logic low when it is under the voltage threshold of Voltage Input Low, VIL = 0.3 VDD. Determining the time between the start of each logic high pulse gives the period of the signal (time will be tracked by leveraging the nRF52832’s built-in clock) - the inverse of which is the signal frequency. Wheel speed and distance traversed will be used to verify that the Repeat Rover has fulfilled a movement command. When repeating a path, the wheel speed and distance traversed will be used to track the progress of the vehicle and detect autonomous error. Autonomous error includes obstacle interference and slippage. There will be four wheel speed sensors, two monitoring each of the driven rear wheels and two monitoring each of the undriven front wheels. By comparing the movement of the undriven wheels to that of the driven wheels, slippage and obstacle interference may be detected.

1.3 Magnetometer

        The magnetometer sends digital rotation information with I2C protocol to the main nRF52832 controller. The information received from the magnetometer will be used to determine the bearing of the vehicle. The bearing at a given point in the vehicle’s path will be compared to the bearing at startup and will determine the path recorded by the controller. The vehicle’s bearing will be used to verify that the Repeat Rover has fulfilled a movement command. When repeating a path, the bearing will be used to track the progress of a vehicle and detect autonomous error.

1.4 Motor Control

        When under programming, the Repeat Rover will accept commands from a bluetooth transceiver and translate the commands to motor control signals. The motor controller will accept a PWM signal with the frequency of the digital pulse signal relating directly to the speed of the controller. In addition to this, the motor controller will accept a signal to determine the direction of the motor spin. When under path recall, the Repeat Rover will receive commands from an SD card and interpret them accordingly.

        If the Repeat Rover reads a forward (FWD) movement, both motors will be used to move in a forward direction (Left: CCW; Right: CW). If the Repeat Rover reads a reverse (REV) movement, both motors will be used to move in a backwards direction (Left: CW; Right CCW). When turning CW, the Repeat Rover will leave the right motor fixed, while rotating the left motor. Inversely, when turning CCW, the Repeat Rover will leave the left motor fixed, while rotating the right motor.

1.5 Wireless Bluetooth Communication and Program Flow

        A Bluetooth module will exchange commands between the Repeat Rover and an external device. For testing, a smart phone will be used to send commands to the vehicle. For program flow, see Appendix 2: Program Flow.

2.0 Description of Algorithms

2.1 Wheel Speed Calculations

        Given the signal frequency and the number of poles within the signal-inducing reluctor, the following equation can be used to calculate wheel speed:

Equation 2.1.1:

 = revolutions per minute,

 = frequency,

 = number of reluctor poles,

 = time of pulse

Given the wheel circumference, number of poles within the signal-inducing reluctor, and the number of pulses in a given period of time, the following equation can be used to calculate distance traversed:

Equation 2.1.2:

 = distance traversed,

 = number of pulses,

 = wheel circumference,

 = number of reluctor poles

The Repeat Rover’s main controller will calculate wheel speed synchronously and average values when repeating movements to create smooth motion. It will calculate distance traversed for variant periods of motion in a single direction.

3.0 Description of Data Structures

        The Repeat Rover will use a linked list queues and stacks to store, push, and pull data. In file-format, these commands will be listed in ASCII newline delimited form, each describing a movement of the vehicle. When a file is read, each command will be added to a queue (FIFO) by pushing the command to a linked list. Each new node will point to the previous. When reading the path from the queue, the entire queue will first be traversed to find the last node. This last node will then be pulled, giving the first command. This command will then be pushed to a stack (LIFO) linked list.The stack will be a list of commands for retracing. Once all commands have been used to traverse the vehicle’s path and the stack is completely full, the inverse will occur - where all nodes are pulled from the stack and pushed to the queue, inversing the queue. Each pulled stack command will be used to retrace the vehicle’s steps by referencing the inverse of the command in a list of command-to-inverse movements and performing the inverse movement. For example, if the command indicates forward movement, backwards movement will be applied to the vehicle. Similarly, if the command indicates a clockwise rotation, a counterclockwise rotation will be performed.

4.0 Relevant Abbreviations:

BLE - Bluetooth Low Energy

BLE_RX - Bluetooth Low Energy Receiver

BLE_TX - Bluetooth Low Energy Transceiver

CCW - Counter Clockwise

CW - Clockwise

CMD - Command

EOL - End Of Line

ERR - Error

FWD - Forward

MAG - Magnetometer

RCC - Rotate Counter Clockwise

RCW - Rotate Clockwise

REV - Reverse

WSS - Wheel Speed Sensor

5.0 Sources Cited:

[1] Nordic Semiconductor nRF52832 Product Specification v.1.8 [Online] Available:

https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.8.pdf

Appendix 1: Move Flowchart

Appendix 2: Program State Diagram

https://engineering.purdue.edu/ece477                 Page  of