Week 12 - lglik/Portfolio GitHub Wiki

11/07/18 - 11/13/18

Day One:

Today, I continued to work on the block diagram for the Magnetic Trees project. I added in more information about how the magnetic trees are connected. For every tree, I listed what the direction port and the PWM port was. I also created a graphic of the project as viewed from above, with each tree numbered as it is in the code. I also added some more info about GPIO and the batteries. I wrote what code to use in order to use the correct GPIO mode, set the desired pines to output, and how to actually send the information. I added in the GPIO pins that each battery is hooked up to. I also wrote a section on how to the GPIO code I previously wrote about, and the pins for the batteries to switch which batteries are charging and which are being used. I think I am pretty clode to being done with the schematic.

Day Two:

I finished up my work on the block diagram and went through what I did with Mr. Harlow. He approved of what I made and said it was done. I shifted back to working on making the magnetic trees move more slowly. First, I looked at the code for the set_pwm function which I found the definition for in the code file for the motor controller. The value inputted into the function had different bitwise operations done to it and then passed on to 4 different registers in the motor controller. I spent some time reviewing bitwise operations and figured out that the 2 different operations split the value into two separate bytes, that are sent to 4 different registers. I looked through the extensive documentation online for how the motor controller works and was able to figure out that for PWM, the two bytes are the on-time and the off-time of the magnetic tree. I could then extrapolate from this knowledge how I could write could to adjust the PWM slowly. I began more on some test code that would be separate from the existing code for the magnetic tree project.

Day Three:

Absent.

Day Four:

No school.

Day Five:

I continued to work on the test code. I decided to try to get just one tree to go from out to in slowly. I discovered that this could be done by incrementing and decrementing the off-time value that is passed to the motor controller. After a lot of trial and error, I was able to successfully get the tree to move slowly. To go from out to in, the PWM must go from the max value to zero, switch direction, and then go back to the high value. I was able to get the PWM values to change as I wanted them to. However, I currently am not able to change the direction. So instead of going from out to in, the tree goes from out to off to out again. I believe this is because the documented direction pin is incorrect. I will need to do further tests to determine if this is correct.