Wednesday, February 22, 2017

Week 3

This past week, I was tasked to fix any bugs that our code had as well as get the encoders to work so that our team can determine the speed of the motors. There were issues with getting the LED to indicate the correct status as well as breaking from a loop when the error button was pressed or the podcar had arrived at a station. I was only able to fix the kill switch issue as well as indicating the correct status but in order to break the loop in regards to the station arrival indicator, that is still a working progress. This is due to that pathing needs to be implemented so that that particular indicator will function as desired.

As for the encoders, I had to do some background research and look back at old mechatronics notes I had from when I took the class in order to gain some knowledge about interrupts. In order to use the encoders, I must use interrupts for this application so that we can calculate the speed. Unfortunately, I have not been able to get the encoders to display a value that resembles a proper speed for the motors. In the coming week, I am aiming to get the encoders to work properly and have them ready by the time our team starts to build the systems for the podcars.

Also as requested from Chris, I was able to remake a wiring schematic of our system since we are using new components and a different microcontroller. Chris requested the schematic since he wanted to create a prototype of the final product that will be mounted on the podcar. The last task assigned to me was to do some research and testing with the Xbees since these devices will be the main source of communication between our microcontrollers and the system that the mobile app team created. I have some knowledge of how Xbees function and I have been able to successfully turn on an LED based on what values the microcontroller receives through the Serial Monitor in the Arduino IDE.

In the coming week, I will be aiming to finish any encoder related work as well as applying user input so that commands or values can be sent through Xbee to control our system as will be done through the app created by the mobile app team. I will also be working closely with my teammates to integrate the system altogether so that we can begin testing in about a week or so. Presentations are also coming up so we need to prepare for that too. Deadlines are coming and I feel indifferent than what I had mentioned in past blog posts.

Tuesday, February 14, 2017

Week 2

During the past week, I have been working on building code for our controls system as my other teammates are also doing. I was in charge of making all of the individual system components work while my teammates focused on pathing and routing. I was able to successfully create the functions that the mobile app team requested from our team. There are some functions that still need to be created which deal with the encoders and the pathing algorithm we have for our controls system.

I was also able to run the motors at the target speed we had specified throughout the project year which was 0.82 ft/sec or 0.25 m/sec. There is a library that allows a user to set the PWM duty cycle using fast PWM pins, instantly changing the PWM duty cycle of an electronic component capable of PWM. The library used was the Timer3 library instead of the Timer1 library which was originally used for the Arduino Uno. Since our team is using the Arduino Mega, another Timer library that is compatible with the Mega had to be used. At the bottom of this post is part of the code that basically runs the motors and stops the motors under certain conditions. The RGB LED has also been incorporated as an indicator of the podcar status.

In the coming week, I will be working with my team to integrate all of our work together so that we can begin testing and debugging soon. We will also begin to build our system at the end of the month which is the anticipated approximate time when all of the small scale subteams will be ready to start testing everything on the track. I am looking forward to seeing our project be a success when it is up and running on the track.


**********************************************************************************
// Function that controls the functions of the system
void controls()
{
     // Changed distance from 30 cm to 15 cm due to pole obstacle
   // LED is Red when statement is true
   if (distance <= 15)
   {
    setStateLED(1);
    setSpeedOfMotors(0);
   }

   // LED is blinking red if button is pressed
   else if (kill_state < 1)
   {
    // Creates a latching button
    kill_latch_state = false;
    reset_latch_state = true;

    // Continues to blink the LED red while latching button is in effect
    // Only way to stop this cycle is to reset Arduino or add another button
    while(kill_latch_state == false && reset_latch_state == true)
    {
      setStateLED(4);
      setSpeedOfMotors(0);
    }
   }

   // Checks to see if the hall effect sensor on the left of podcar read a magnet
   else if (hall_1_state == 0 || hall_2_state == 0)
   {
    setStateLED(2);
    setSpeedOfMotors(580);
   }

   // Checks to see if podcar is at a station
   else if (StationId == 1 || StationId == 2 || StationId == 3 || StationId == 4)
   {
    setStateLED(1);
    setSpeedOfMotors(0);
   }

   // LED should be green
   else
   {
    setStateLED(3);
    setSpeedOfMotors(580);
   } 
}

Tuesday, February 7, 2017

Week 1 of Spring Semester 2017

Last week marked the first week of class for the second half of the project year. With a tough past semester, I managed to get some needed rest as well as making some progress in our project. Over the winter break, I was able to build code and test it on one microcontroller to determine if our team can use one microcontroller without any issues instead of using two. I was pleased to report to my team that we can transition our whole system to using an Arduino Mega because there seemed to be no interference with any of the sensors or components and the system response was surprisingly fast. The code was also much more condense than the previous code we had for each of the microcontrollers.

During this past week, I was assigned to fix some bugs that our team was experiencing with the LED status indicators as well as breaking from a loop when an indicator turns on without any indication that it will end without resetting the microcontroller. I was successfully able to fix those bugs and our system prototype seems to work satisfactorily. I was also able to assign station numbers to the RFID tags based on some serial number that the RFID reader would read. We are still having issues trying to drive the motors and the servo in the same manner that the past year's team implemented but if in any case, we would have to drive those components a different way and just adjust the performance as we see fit when we test our system.

After this coming week, we will only have roughly about 6 weeks to have a fully functional demo of our project. This leaves little time for mistakes and postponement of the project. With our team leader assigning us roles and tasks on a weekly basis, I am confident that our team will succeed this semester and have demo that will at least make me feel good and proud of. In the coming week, I will be meeting up often and working with my team to finish the pathing and routing of our system as well as getting the motors and the servo to run either in the past year's method or create a different method. We plan to build and test no later than the end of this month so that we have a reasonable amount of time to fix any bugs in our system.