15/4/2015 // Input Devices //
Making
My first experience making an input device was in week 7 when I made a water sensor; I made a sensor with two inputs and one output and I programmed it using Arduino.
I decided I wanted to make a "standard" board this time because the water sensor I programmed with Arduino and I wanted to use Python so for the first step I made the basic boards and played with them.
In order to make the boards I used the fab academy
tutorial as well as a tutorial from a 2014 student
Michael Hurtado .
Temp sensor:
Sound sensor:
Programming
To program the sensors I used the following comands:
Make:
sudo make -f hello.temp.45.make program-avrisp2
Hex:
avrdude -p t45 -c avrisp2 -U flash:w:hello.temp.45.c.hex
This is how it looks like in Terminal:
Last login: Sat Jun 13 21:30:26 on ttys000
Katies-MacBook-Pro:~ katielevine$ cd desktop
Katies-MacBook-Pro:desktop katielevine$ cd temp
Katies-MacBook-Pro:temp katielevine$ sudo make -f hello.temp.45.make program-avrisp2
Password:
avr-objcopy -O ihex hello.temp.45.out hello.temp.45.c.hex;\
avr-size --mcu=attiny45 --format=avr hello.temp.45.out
AVR Memory Usage
----------------
Device: attiny45
Program: 504 bytes (12.3% Full)
(.text + .data + .bootloader)
Data: 1 bytes (0.4% Full)
(.data + .bss + .noinit)
avrdude -p t45 -P usb -c avrisp2 -U flash:w:hello.temp.45.c.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9206
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "hello.temp.45.c.hex"
avrdude: input file hello.temp.45.c.hex auto detected as Intel Hex
avrdude: writing flash (504 bytes):
Writing | ################################################## | 100% 0.17s
avrdude: 504 bytes of flash written
avrdude: verifying flash memory against hello.temp.45.c.hex:
avrdude: load data flash data from input file hello.temp.45.c.hex:
avrdude: input file hello.temp.45.c.hex auto detected as Intel Hex
avrdude: input file hello.temp.45.c.hex contains 504 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.16s
avrdude: verifying ...
avrdude: 504 bytes of flash verified
avrdude: safemode: Fuses OK (H:FF, E:DF, L:62)
avrdude done. Thank you.
Katies-MacBook-Pro:temp katielevine$ avrdude -p t45 -c avrisp2 -U flash:w:hello.temp.45.c.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9206
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "hello.temp.45.c.hex"
avrdude: input file hello.temp.45.c.hex auto detected as Intel Hex
avrdude: writing flash (504 bytes):
Writing | ################################################## | 100% 0.17s
avrdude: 504 bytes of flash written
avrdude: verifying flash memory against hello.temp.45.c.hex:
avrdude: load data flash data from input file hello.temp.45.c.hex:
avrdude: input file hello.temp.45.c.hex auto detected as Intel Hex
avrdude: input file hello.temp.45.c.hex contains 504 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.16s
avrdude: verifying ...
avrdude: 504 bytes of flash verified
avrdude: safemode: Fuses OK (H:FF, E:DF, L:62)
avrdude done. Thank you.
Katies-MacBook-Pro:temp katielevine$
Katies-MacBook-Pro:temp katielevine$ ls /dev/tty.usb*
/dev/tty.usbserial-FTGG468I
Katies-MacBook-Pro:temp katielevine$ python hello.temp.45.py /dev/tty.usbserial- FTGG468I
command line: hello.temp.45.py serial_port
Testing
For testing with python I first needed to find my usb serial port so I used the command:
ls /dev/tty.usb*
Once I found my serial port I ran python using this command:
python hello.temp.45.py /dev/tty.usbserial- *serial port number*
VIDEO