Software apps and online services
This project was done for the ME 461 class at the University of Illinois, Urbana-Champaign. The idea behind this project was to take a car powered by MyRIO and wirelessly control it using an MPU9250 accelerometer. To accomplish this we also ended up using the MSP430 microprocessor and an Orange Pi board. We were also supplied with a PCB for the MSP430 which aided in the connections involving the microcontroller. The MSP430 and Orange Pi were both programmed in C, while the MyRIO ran LabView code. As can be seen in the linked video of the car in operation, we set it up so that tilting the PCB forward and backward controlled the speed of the car, and tilting it left and right turned the car.
Since we knew from the start that we wanted to control the car wirelessly, we decided to use the Orange Pi to communicate wirelessly with the MyRIO. In order to do this we used a TCP protocol to establish a connection between the MyRio and Orange Pi. Once the connection is established the MyRio reads data as a string at which point we separated the three values the accelerometer output as three floats. We then used the X and Y values to control the cars speed and turning direction because the Z value always changed with each direction we rotated. The X and Y values did not correlate appropriately for the range of values the car already operated under so we used a saturation block to change the accelerometer values to be in the car's previous established range.
We then decided to use the MSP430 to relay the information from the accelerometer to the Orange Pi. Interestingly, the MSP430 only has two data channels. One (A) that can do either SPI or UART, and another (B) that can do either SPI or I2C. Since the Orange Pi could only communicate over I2C, we knew we needed to use channel B for that. This meant that we had to use SPI over channel A for the accelerometer, with the MSP430 as the master and the MPU as the slave. Once we had this worked out, all we had to do was write code for the MSP430 to pull data from the accelerometer and send it to the Orange Pi, and code for the Orange Pi to take the data from the MSP430 and push it to the MyRIO. The accelerometer data ended up being 3 16-bit integers (X, Y, Z), so we ended up needing to pull data from 6 registers in the MPU and combined the "high" and "low" 8-bit values into 3 16-bit values afterwards.
One of the main challenges we faced was figuring out all the register settings for the MPU9250 to get it to work with the MSP430. The code for passing the data to the Orange Pi was similar to code we developed in one of our lab sections for the class, so that wasn't too difficult to adapt for this project. The main issue we experienced when connecting the Orange Pi and MyRio was not being able to choose which MSP430 core the TCP protocol would operate on since the TCP protocol operated in a while loop. As a result this could slow the MSP430 down a bit which consequently led to a little bit of input delay to the car. Finally, once we had the accelerometer data in LabView we found that it would loop around from its maximum value to its minimum value, so we had to shift the data to be centered at zero instead. After that, it was just a matter of adapting the LabView code we had from previous labs and tuning the gains to make everything feel easy enough to control.
Demo Video: https://youtu.be/m041oWgNu78
SPI Video: https://youtu.be/FAVYNg8LQBQ
I2C Video: https://youtu.be/1JD9WiccoIo