INPUT SENSORS
I have really struggled with the electronics portion of this course. Each week I attempt to tackle something very complex. I haven't been able to understand the basics in order to advance so I took the opportunity this week to learn the basics in the hopes that I can expand on the knowledge.
PREPPING THE FILES
I started with the reflective light sensor example posted on the weekly site. I read through the code for each, read through the data sheets on the components, redrew the board in eagle and read through the tutorial on how to program the sensor board. After all this effort, I was still very confused and decided to just create the board that was the example in the hopes that I could make a second with extra time in order to elaborate on the design.
MILLING
The milling is second nature at this point. I was able to mill the file with no hiccups on the first try. I stuffed the board though neglected the orientation on the sensor, which proved to be a problem later.
PROGRAMMING
I attmepted to use the online tutorial for programming the audio sensor board, and tweak the instructions to meet the needs of the reflective sensor. One thing that I forgot to update was in the MAKE file, I needed to rename the base file so that the "PROJECT" would look for the right file.
PROJECT=hello.reflect.45 Make sure that this title is the same that you name your C file! 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
Once you double checked your make file, run the script:
sudo make -f hello.mic.45.make program-usbtiny
As long as no errors occurred, you should run the python script:
python hello.mic.45.py /dev/ttyUSB0
I, unfortunately, did have an error when I attempted to run the python script. After working with Novysan, and checking some of the background information of the script, we realized that it must be something on the board. This was when we noticed that the light sensor was soldered on in the wrong orientation. I re-soldered this piece (and all of the resistors and capacators that fell off when I tried to remove the sensor) and ran the script again. Perfect!
/>
WHAT I LEARNED
Sometimes doing the most simple thing is the best way to learn the basics. I finally understand the processes of designing a board, milling it, stuffing it, programming it, and trouble-shooting. Hopefully I have the foundation to now develop a more complicated input/output device!