11 Input Devices

measure something: add a sensor to a microcontroller board that you have designed & read it

The main phenomena I am aiming to sense is specific locations of rain droplets. I was debating for a while whether I should go with a piezo or a mic. I tried some initial experiments with a piezo disk - connecting it with an oscillascope to see what voltage would be generated when a small water droplet comes in contact with the disk. On the piezo side, I put some fuzzy velcrow to enable it to be a bit more sensitive as each of the little hairs deform a bit to interact with the piezo ceramic material.

Because the voltage generated by the piezo was so small (about 300mV), I would need an amplifier to get a good signal for readout from the attiny. So I ended up choosing the analog MEMS mic instead since it was compact and already had opAmps inside. I also placed a piece of polyester film on top to interface with the raindrops, creating a sort of "drum" to sense the rain.

The modification I made was changing the microprocessor from attiny45 to attiny44. Also, as an experiment I also made this into a semi-2-sided board with one side Ground. However, the modela couldn't drill through to the holes without damaging the other traces so I ended up soldering thin wires to those locations instead.

In order to program it, there were several things I had to edit as a result of changing the processor such as the makeFile and also the various I/O ports in the C file.

After changing the code to point to an attiny44, I tried to program with with the makefile in terminal. However, I kept getting errors like it was reverse insert. I tried inserting it the other way but I think there may be something I did wrong with the soldering or board layout.

As a result, I ended up making a new board without changing anything and tried again. When it came time to program it, I first navigated to where the makefiles were through the terminal. Next I made the hex file, wrote into the flash, and burned the fuses by typing in:

make -f hello.SPU0414HR5H.make

avrdude -c avrispmkii -p t45 -U flash:w:hello.SPU0414HR5H.c.hex

avrdude -c avrispmkii -p t45 -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m

After it was programmed without error, I navigated to my python file in terminal and opened a serial port by typing in: (although at times my computer wouldn't recognize the FTDI cable unless I restart my computer...so I looked into the forums and apparently if you've upgraded to El Capitan OSX on your mac, this has been a reported issue)

python hello.SPU0414HR5H.py /dev/cu.usbserial-FTF4BJVR


Eagle > Modella > MEMS mic > AVRdude