10 Input Devices

This week, we had options to make a few different boards with various sensors. I was interested in the photogransistor that detects reflected light, and then a mic board and sensor. Many of the boards were predesigned for us, so all we had to do was mill them, stuff them, and download and flash the microcontroller with the c code that Neil had written. Neil also wrote the code for a visualization using python, which lets us see the effect of the sensors via the computer.  This is Neil's code for the phototransistor board that we flash to the board (it uses his C code, which I'm not posting here):

PROJECT=hello.reflect.45
SOURCES=$(PROJECT).c
MMCU=attiny45
F_CPU = 8000000

CFLAGS=-mmcu=$(MMCU) -Wall -Os -DF_CPU=$(F_CPU)

$(PROJECT).hex: $(PROJECT).out
avr-objcopy -O ihex $(PROJECT).out $(PROJECT).c.hex;\
   avr-size --mcu=$(MMCU) --format=avr $(PROJECT).out

$(PROJECT).out: $(SOURCES)
avr-gcc $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)

program-bsd: $(PROJECT).hex
avrdude -p t45 -c bsd -U flash:w:$(PROJECT).c.hex

program-dasa: $(PROJECT).hex
avrdude -p t45 -P /dev/ttyUSB0 -c dasa -U flash:w:$(PROJECT).c.hex

program-avrisp2: $(PROJECT).hex
avrdude -p t45 -P usb -c avrisp2 -U flash:w:$(PROJECT).c.hex

program-usbtiny: $(PROJECT).hex
avrdude -p t45 -P usb -c usbtiny -U flash:w:$(PROJECT).c.hex

program-dragon: $(PROJECT).hex

avrdude -p t45 -P usb -c dragon_isp -U flash:w:$(PROJECT).c.hex

helloreflect from Kate Balug on Vimeo.

I made the mic board next. It turned out that the files for that board were not drawn correctly. Kaimen figured out that the design didn't connect the mic to power, so we soldered jumper cables to fix this. Thanks Kaimen! Otherwise, I had no trouble with this board, which after remaking the fabduino, was quite easy.

The code for the mic board: (again not posting the C code, just the make file)

PROJECT=hello.mic.45
SOURCES=$(PROJECT).c
MMCU=attiny45
F_CPU = 8000000

CFLAGS=-mmcu=$(MMCU) -Wall -Os -DF_CPU=$(F_CPU)

$(PROJECT).hex: $(PROJECT).out
avr-objcopy -O ihex $(PROJECT).out $(PROJECT).c.hex;\
   avr-size --mcu=$(MMCU) --format=avr $(PROJECT).out

$(PROJECT).out: $(SOURCES)
avr-gcc $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)

program-bsd: $(PROJECT).hex
avrdude -p t45 -c bsd -U flash:w:$(PROJECT).c.hex

program-dasa: $(PROJECT).hex
avrdude -p t45 -P /dev/ttyUSB0 -c dasa -U flash:w:$(PROJECT).c.hex

program-avrisp2: $(PROJECT).hex
avrdude -p t45 -P usb -c avrisp2 -U flash:w:$(PROJECT).c.hex

program-usbtiny: $(PROJECT).hex
avrdude -p t45 -P usb -c usbtiny -U flash:w:$(PROJECT).c.hex

program-dragon: $(PROJECT).hex
avrdude -p t45 -P usb -c dragon_isp -U flash:w:$(PROJECT).c.hex

Here's the board, along with Neil's python visualization behind, and in the video.

 

 

 

Published on   April 16th, 2013