The plan for this project was to build a car which could be navigated via a WiFi connection and follow a black line. This blog post will go over the final product. We will be looking at both the hardware and software which was used in this project.
BILL OF MATERIALS
- RF TXRX MODULE WIFI CHIP ANT
- CUSTOM CONTROL BOARD
- 120:1 MINI PLASTIC GEARMOTOR OFFSET 2mm SPLINE OUTPUT (2)
- LCD MODULE 4X10 WH BKGRND RFLT 2.6mm
This is the code that initializes the MSP430's ADC.
This is a precompiled binary given to us.
This code is very basic. It uses the IR emitter and detectors to see where the car is on the blackline. If only the right one is on, it is veering too far left and needs to turn right. Similarly, if only the left is on it is veering too far right and needs to turn left. Otherwise (being on black or white) it will go straight. I had used PWMs for the motions, but as the batteries got low, these no longer worked, so I just used turning on and off the motors to move.
This code simply uses debouncing in order to detect a button push. It also sets the backlight of the LCD to be off, but I have it off by default, so in reality lines 45 and 60 do not do anything.
This code initializes the MSP430's clocks so that we can set up timers later.
This code takes in and converts the input of the MSP430's ADC values so that they are useable (IR Left and Right Detector, Thumbwheel, etc.). This also contains a function that converts the hex value in memory (used when sending commands over WiFi) into BCD and then to ASCII.
Header file containing all function names.
Contains the initial conditions that are used by all other files.
This code contains the interrupts for the timers that we set up, as well as the ADC interrupt.
This code turns on the two LEDs on the MSP430.
Header file that contains all of the macros used and their corresponding values.
This code is where all other functions are called, and contains the while loop which process incoming commands, displays command info on the LED display, and calls the required process based on the incoming command.
As mentioned earlier, this was originally done with PWMs, however, when the battery voltage was too low, this no longer worked. This code now contains the turning on and off the motors directly (both in the forward and reverse directions).
This code contains the initialization of all the port pins.
This code handled the serial data. It handled both USB and WiFi TX and RX buffers, which were used to decipher the commands being sent, as well as debugging.
This code initialized Button 1 and Button 2 on the MSP430 as switches.
This code contains the system configurations.
This code initialized the timers to the desired frequency using the MSP430's clocks.
Currently, I do not have the car to take videos of, but these will be added to this post in a few weeks when I have access to the vehicle again (enjoy the few I do have though!)
Attached are the related material and BOM for this project.