Image

Input Devices

Week 9

For the ninth week, we had to make a PCB with an input device. I chose the accelerometer, ADXL343. I chose this input component since it was what I was planning on using in my final project, as I want to be able to measure when someone is running versus when they are walking. I had designed the board using Eagle, and was able to mimic the board posted on the class website, but I chose to use an ATTiny 44 instead of a ATTiny 45 (the switch turned out to be super hard). I also added an red LED. The goal was to create a program which would turn on the LED when the acceleration is greater than a threshold.

I quickly noticed that I couldn't find the ADXL343 footprint on the fab library that I had downloaded into Ealge. So, I found a footprint online that I downloaded, but it turns out that this was for an ADXL345, which had different names for the pins but the same footprint. Although the layout of the pins matched, the names did not, so I had to do some weird thinking to figure out which pin was which in the schematic. This was done by going back and forth from the board diagram to the schematic to the board on the class website constantly until I figured it out. I also realized very quickly while trying to design the board that it was going to be difficult with all of the different components. This was especially true since the accelerometer had pins going in a variety of directions. After hours and hours of struggling, I decided that I couldn't get the design working on the program. As such, I drew out the diagram and that enabled me to find an efficient way to organize all of the different components.

Image placeholder

Once this problem was fixed, I realized that I had to change the footprint of the accelerometer. In addition, the footprint I downloaded had pins of the correct size, but they were too close together for the Roland SRM-20 mill I was going to use. As such, I had to alter them so that they were all smaller. I had to make each pin footprint 32x14 in Eagle so that the mill could separate them. This took a really long time, since I didn't know at the time that you could alter all of the pads at one time, so I did each one separately. I also did this twice, since I wasn't sure it was 32x14 the first time.

Image placeholder

Using the solder paste and reflow was incredibly easy for me, as I spent my entire summer soldering incredibly small pieces. For that reason, I had already learned the process, and am actually more comfortable with this method than normal soldering. I ended up having to produce two different boards, as I had improperly connected the reset and SDL (the board shown above). In the end, I was able to create a properly working board (the board and schematic shown below).

Image placeholder
Image placeholder

To get the code working, I had to change all of the 45 in the make code to 44. Then although I had what seemed like a working board, it took me the entire week to get it to work, since the LED was not turning on. I went over the board a bajillion times trying to figure out what was wrong, and resoldered every single piece three times, which definitely sucked. However, it still wasn't working... I couldn't get the python script to work at all, which sucked, but I kinda ignored it for a bit (check Final Project when I finally got it working) It turns out that I had inputed the wrong pins initially. As such, I finally was able to get the code working. I took the python code on the class website which did the math to get values in the range showed in the video on the class website, and then converted it to C, so that I could program the LED (shown below).

Image placeholder
Image placeholder

In the end, I have the light working if the x value is larger than 150. Thankfully it all worked out...

Image placeholder