The objective of this ECEN 2440 project was to make a Roomba Quade robot with numerous modes. The first mode is the default ordinary mechanization utilizing ultrasonic sensors and development rationale. The second mode permits the robot to dance. The third mode is utilized to decide the action of the robot. This mode permits the user to "turn off" the development and fringe highlights of the robot until it is walked out on. We utilized different peripherals, for example, a speaker to show when Quade is near an obstacle. The speaker is also used in the Dance Mode to make arbitrary sounds. LEDs were used as an indication of the current mode that the Quade is in.Procedure
For our project goal, we wanted to establish communication with all of the peripheral devices when operating in the three modes. Through the use of TIMER_A1, we wanted to compute Quade’s distance to the nearest wall using the ultrasonic sensor. The ultrasonic sensor, which is a distance sensor, uses the transmitter and the receiver built inside it to send ultrasound pulses in order to detect obstacles directly in front of it. Additionally, in order to demonstrate the output logic for our modes, we are using the onboard LEDs on the MSP. When Quade is in the “off” mode, it doesn’t output anything except the red onboard LED. In the autonomous mode, Quade outputs to the green onboard LED, the PCA, and the buzzer. In our dance mode, the outputs are the RGB onboard LEDs, the PCA, and the buzzer.Challenges
One of the challenges we faced in this project was integrating the individual peripherals codes. Both the ultrasonic sensor and the speaker were using Timer_ A0 which ultimately wouldn't operate if ran at the same time. We ended up using Timer_A1 for the ultrasonic sensor and Timer_A0 for the speaker. While integrating the individual peripherals, we struggled to combine the ultrasonic code with the state machine we devised with. We used the debugger and the console to analyze the problem, after which we realized the function was stuck in a continuous while loop. Diagrams
Pin mapping helps us see the layout of how our pins are interconnected with each other. If there are many wires and connections, pin mapping allows us to keep track of which connection goes to what pins.
We communicated with the electromagnetic buzzer through PWM on Port 2 Pin 4. We divided the clock and modified the ticks so that the clock frequency would be within the Buzzer’s working range at about 2kHz. In the autonomous mode, a constant sound was outputted to the buzzer when the ultrasonic sensor detected a nearby obstacle. In the dance mode, the buzzer was randomly played, and in the off mode, the PWM was turned off.
When we first tested our ultrasonic sensor, we connected it with the MSP using UART. We used eUSCI (Universal Serial Communication Interface) within our MSP to receive data from the ultrasonic sensor. The eUSCI_A receives and sends character bits asynchronous to another device, which is why selecting a baud rate becomes necessary. This way, both the receive and the sent functions operate on the same baud rate. In order to initialize the eUSCI_A, the following steps are necessary:
We used Port 2 Pin 6 as our TRIG pin and Port 2 Pin 7 as our ECHO pin. The ultrasonic sensor uses the input-output trigger for a logic high signal for around 10 microseconds. After that, the sensor sends eight quick pulses to detect if there are any signals back. The signals that return are captured by the receiving end. When integrating the code, we didn't need the UART configurations as we only needed sensor values in order for the autonomous state to function.
In this mode, Quade is continuously scanning for obstacles in its path. If the distance the ultrasonic measures goes below 5 inches, it's an indication that something has obstructed its path and will turn right while flashing its LEDs as well as activating the buzzer. If the distance measured is greater than 5 inches, Quade will keep moving forward with the buzzer and the LEDs turned off.Dance Mode
In dance mode, the Quade-Roomba would turn on its axis multiple times which performing random actions. While in this mode, the RGB LEDs will provide a disco effect. Idle Mode
In our off/idle mode, the Quade will be saving power by remaining at one location while the buzzer and the LEDs are turned off. Integration
In order to handle both our buzzer and the ultrasonic sensor, we used the TA0 IRQ handler to configure the two peripherals. We used the timer to count the time units for the ultrasonic sensor and using the same interrupt to toggle and generate a PWM for our buzzer. The three modes are toggled with the onboard buttons on the MSP. Cost