Example Board
This week I decided to use the distance input device. While I wanted a potentiometer like device for my final project, distance seemed like the best input device from the examples. Distance allowed me a range of values without having repeatedly input (like clicking a button multiple times). But also distance seemed like the coolest input device to me, so I just went for it.
Just like during output devices, I first attempted to make the example board to understand how the sonar worked. Unfortunately like input device week, it took me several tries to make a working board. This week it took until the third board for the board to be able to program. In all honesty, I don't know what was wrong with the first two. While they were able to program, they didn't work with the python interface slider that was provided. I just got so frustrated with each board I made a new one. Finally on the third try it magically worked even though I did the same thing over and over again. The difficulty could stem from the fact that the sonar pins were in the opposite order of what was on the board, forcing the sonar to face backwards from the board or for the pins to be manually bent with pliers.
But at the end, I had a working distance sensor based on the example.
Designing a Board
I designed my own sonar board in Eagle. I added an led and resistor off of the ground line to act as a power light. Once again the schematic was very straight forward to make while routing the board took a lot of effort. I made a concerted effort to have the pins of the sonar device reflect what we had in the shop. When originally routing, the route was impossible. This lead me to change some of the pins of the attiny45 and reflect those changes in the code.
Programming the Board
After milling and sautering the board, I attempted to program the board. Within the first few minutes of programming, I accidently dropped the board causing the sonar to fall off and the traces to break in half. I milled another board. This time the board came off the sacrifical layer while milling the interior. I decided that the interior was not needed and carried on with the traces milled on an entire board. I sautered all the elements on the board and used hot glue to ensure that the sonar device would stick to my board this time. I programmed the code using the example code. While the distance device was able to detect distance, the values didn't line up exactly to centimeters, which I decided was fine because I didn't need that much specificity. Additionally, the sonar had difficulty within an inch of a device, reading the values as 30+ cm. After consulting online and with som TAs, this is likely due to being unable to properly receive a signal back.