Week 09 - lglik/Portfolio GitHub Wiki

10/17/18 - 10/23/18

Day One:

While I had been working on making and connecting wires to the lead's of the batteries, other people had started to make the board that would monitor the energy stored in each battery. When I finished with the wires, I took over the job of making that board. I first soldered some pins onto the board to enable I2C with the Pi. I also learned how to wrap wires using a special tool to connect two pins on a board. I connected the address pin and the Vdd pin so that the board would have the desired I2C address. I also soldered on connectors on the two opposite sides of the board for the two pairs of batteries.

Day Two:

I began to work on connecting the board to the project. The board would be connected to the end of a chain of I2C devices. I used a new type of crimping to create two six-pin connectors with wires between them for I2C communication. I did a lot more wire wrapping and crimping and was ultimately able to finish assembling the board and connect it to one of the motor controllers attached to the electromagnet. It was great to finally have the board, the wires, and all the new hardware for the project finished.

Image 1 The finished battery monitoring board

Day Three:

There was an open house planned for the next day, so the whole programming team worked to get the room ready for that. We moved the tables and projects around so that there was only one path through the room and the touchscreens were on the opposite side of the projects so visitors could not use them. We got as many projects as we could working to show to families. After that, I helped drill and tap some holes in the acrylic that the motor controllers for the electromagnets are on. This location was picked so we could mount the power monitoring board there. That board uses I2C to connect back to the Pi, and by placing it next to the motor controllers which also have I2C, we could add it on to the end of the chain of I2C devices. Once I plugged it in, I used the command i2cdetct -y 1 to check that the Pi detected the board and that the board was at the expected address.

Day Four:

I spent quite a long time online looking for a library of python code for Adafruit board I had installed. I finally found it, downloaded the code and installed the libraries. I ran the example code they had that said it would show the analog voltage input four different pins. I was only using two of the inputs since I had two pairs of batteries, but when I ran the code, numbers showed up on all four inputs, and the number was the same for each. Also, when I unplugged or plugged in the batteries, the number the board was reading did not change. Something was not working correctly. After much experimentation, I was able to use the I2C get command to read information directly from registers on the board. None of the information changed when the batteries were unplugged or switched around. There was a larger problem. Both Mr. Harlow and I were stuck, and he said he was going to do some reading of the documentation for the board.

Day Five:

I switched to working on a different issue with the magnetic trees project. When the electromagnets turn off and on or change direction, they do so extremely fast, and violently, causing some of the iron filings to be flung off the electromagnet which is a problem. I started to work on how to write code so that the magnets switch states much slower. Right now the code has the magnets immediately switch to whatever the desired PWM is, regardless of their previous state. I tried to begin to fix this by first creating a variable that stored the previous state of the magnet. Then I created a logic tree for the six different ways the magnet could move between the three states of "OFF," "IN," and "OUT." This way, I could later write code that would slowly change the electromagnet to the desired PWM based on its current state and the desired state. I first wrote the code with the logic tree and the variable that sored the previous state but kept the code so it should still move the filings suddenly, as before. Unfortunately, when I ran the code, the electromagnets would not change state at all.