Our team faced several challenges throughout our project, but one of the most difficult to overcome was noise in our phototransistor circuit that was used to detect the MINERs. This was problematic because the four periods that we were looking for were 300 microseconds, 500 microseconds, 700 microseconds, and 1100 microseconds and we were seeing noise in the ranges of 300-500 microseconds. These false readings would have impaired our ability to perform on the field if we had not corrected them. To combat these challenges, we first ran our phototransistor circuit off an external power supply to ensure that it worked properly when isolated from the circuit. When we could confirm that the circuit worked independently, we slowly added back in the different components of the circuit to see where we saw noise. Unfortunately, we saw the noise issues increase when we added back our accelerometer, motors, and some of the other circuits that were running off of our buck converter (at the time, this included our encoders). Over the course of several days, we set about reducing noise by:
Physically elevating the phototransistor circuit
Adding grounded aluminum foil layers between our motor and our TIVA and between our TIVA and the phototransistor circuit
Moving our TIVA signal wires from our phototransistor circuit to the other TIVA belt, so that they would not be located so close to our motor PWM signals
Taping down signal wires from our phototransistor circuit and our accelerometer with the oscilloscope on, so we could see where to put them to best avoid noise
Removing solid core wires from our power distribution board
Removing our buck converter and replacing it with a linear voltage regulator
Adding a second linear voltage regulator, so that the phototransistor circuit could have all of its power supplied from one isolated source
Adding a counter in software to our detecting MINER module, so that we would only believe we had seen a MINER if we had a certain number of correct consecutive periods
Another challenge that we faced was the current-guzzling electromagnet. When we had it tied to the same power supply as the encoders, we noticed that the encoders would not work as well when the electromagnet was turned on and we would not properly execute our turns. To counter this, we decided to run the electromagnet directly off one of our 7.2 V batteries. Also, during our testing, we made sure to reset our TIVA and release the MINERs, so we could reduce power consumption. Otherwise, our electromagnet would get quite warm in between runs.
Finally, we found the accelerometer difficult to work with and ultimately did not include it in our final robot even though it had originally played an integral role in our strategy. At the beginning of the project, we decided to forego the colorimeter sensor that we were given and use the accelerometer readings to point us in the direction of North (located at a 3 degree angle relative to the floor). This would give us our bearings and allow us to navigate to the correct square to deposit the MINER. We had also planned to use the accelerometer to interpret crashes by looking at the yaw values and finding minimum thresholds that would allow the bot to react to crashing into a wall or another bot. But ultimately, our accelerometer was so noisy that we decided to replace our strategy with one that relied on the SPUD-queried location and use limit switches for bump detection.