Week 5: September 26 October 1 - ngetachew/Portfolio GitHub Wiki
The focus of this week was getting the Robotic Arm that we inherited to work. This was much more of a challenge than the Perpetual Motion Machine. Every time we ran it, different things would happen. For example, our first time running it, the stepper motor was moving correctly, but nothing else was. After more testing, we realized that nothing was working as it was supposed to.
First, we decided to tackle the homing system. Instead of using a switch, this setup uses a sensor to detect a hex screw passing over it. Ideally, as soon as the screw is detected, it should stop the stepper motor. The code for it in stepper.py looked correct as well, so theoretically, it should've worked on the first try.
However, we do not live in a perfect world. The stepper only homed itself correctly about 30% of the time. This bizarre behavior lead us to create a test script that would continually print out the output of the sensor. When the screw was detected(when it reaches the home position), the sensor should return 1, and when nothing is detected, it should return 0. However, the sensor would return a mix of 1's and 0's. My immediate thought was that the stepper motor was somehow interfering with the homing function, so we hooked it up to another motor: However, this yielded no results. When we used it to test the relative_move()
function, the motor would rotate by a different amount every time. We even tried plugging it in to a different port on the slush engine as shown below, but this didn't help either.
For the sake of time and our own sanity, we decided to test out the magnet. Initially, this wasn't hard; we created a test file to find the right PWM values to activate and deactivate it. However, when it was ran in main.py, wasn't working the same. Then, as if by magic, it wasn't working in our test file as well. Using the logic analyzer, we found that there wasn't even a PWM signal being sent to the pins:
This lead us to spend several days looking at the source code and checking connections on the board. I suspected the hardware was the problem from the start, so to rule this out, we plugged in someone else's image to test our hardware. This provided more reliable results, but the robotic arm still wasn't working the way it should, confirming that it was a hardware problem. The stepper motor was having problem with relative_move()
still. More specifically, the motor was struggling to turn the correct distance, which lead us to believe it was a voltage issue. We took the whole board apart and put it back together, checking the voltages of every port connected to power. Due to the issues we were having with the magnet, we decided to check the voltage across the PWM pin it was plugged in to. As my partner was doing this, one of the prongs of the voltmeter accidentally touched the 5 volt and 24 volt pins at the same time. This caused an immediate spark on the Cyprus board and the Slush engine. We lost the GPIO pins on the Slush Board, and completely shorted the Cyprus, so we had to switch to another setup.
After the switch, it became clear that the previous board had a problem(before being shorted) because the code was nearly 100% working. After adjusting some PWM values, we noticed that the sequence where the ball is picked up by the arm and placed on another tower was not working correctly. After using the testing script from earlier in the week, we found that one of the sensors wasn't working, so it needs to be replaced. We anticipate that after this, it will be fully functioning