PB2 = serial Tx PA3 = serial Rx PA7 = sensor 1 input = port 6 on ATtiny = analog input 6 in arduino code PA6 = sensor 2 input = port 7 on ATtiny = analog input 7 in arduino code Then we have the programming header for an AVRISPmkII. Finally we have a 3.3V input and a ground input. The board supplies power and ground to the two sensor boards. RGB part in Fab inventory is wrong by 180 degree rotation (2012-10-22) Red LED pin = pin 12 on ATtiny schematic = pin 12 on Mellis HLT tutorial for arduino programming of AVR = pin 1 in arduino sketch Green LED pin = pin13 on ATtiny = pin 0 in arduino sketch Blue LED pin = pin 11 on ATtiny = pin 2 in arduino sketch One way to program this is with Arduino code following this tutorial from David Mellis: http://hlt.media.mit.edu/?p=1695 Power the boards with 5V and ground and hook up an AVRISPmkII programmer. Then just program the board using the Arduino software. Make sure to burn the correct fuse bits onto the board first -- here for a 20 MHz resonator: otherwise delay and other methods that use timing will be way off "By default, the ATtiny’s run at 1 MHz (the setting used by the unmodified “ATtiny45″, etc. board menu items). You need to do an extra step to configure the microcontroller to run at 8 MHz – necessary for use of the SoftwareSerial library. Once you have the microcontroller connected, select the appropriate item from the Boards menu (e.g. “ATtiny45 (8 MHz)”). Then, run the “Burn Bootloader” command from the Tools menu. This configures the fuse bits of the microcontroller so it runs at 8 MHz. Note that the fuse bits keep their value until you explicitly change them, so you’ll only need to do this step once for each microcontroller. (Note this doesn’t actually burn a bootloader onto the board; you’ll still need to upload new programs using an external programmer.)" See David's diagram for mapping between arduino pins and avr pins Example: this program makes the RGB led blink blue // blue int led = 2; //red // int led = 1; //green // int led = 0; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } while this makes it blink in purple int led = 1; int led2 = 2; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); pinMode(led2, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW digitalWrite(led2, LOW); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second } Got serial output from this to show up on the oscilloscope: // Borrowing from Heather Dewey-Hagborg's example at http://www.arduino.cc int led = 1; int led2 = 2; #include #define bit9600Delay 84 #define halfBit9600Delay 42 #define bit4800Delay 188 #define halfBit4800Delay 94 byte rx = 8; byte tx = 3; byte SWval; // the Tx and Rx pins are 5 and 10 on the ATtiny which in Arduino map to pin 8 and pin 3 of arduino // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); pinMode(led2, OUTPUT); pinMode(rx,INPUT); pinMode(tx,OUTPUT); digitalWrite(tx,HIGH); SWprint('h'); //debugging hello SWprint('i'); SWprint(10); //carriage return } // the loop routine runs over and over again forever: void loop() { //digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) //digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level) //delay(1000); // wait for a second //digitalWrite(led, LOW); // turn the LED off by making the voltage LOW //digitalWrite(led2, LOW); // turn the LED on (HIGH is the voltage level) //delay(1000); // wait for a second SWprint('h'); //debugging hello SWprint('i'); SWprint(10); //carriage return //SWval = SWread(); //SWprint(toupper(SWval)); } void SWprint(int data) { byte mask; //startbit digitalWrite(tx,LOW); delayMicroseconds(bit9600Delay); for (mask = 0x01; mask>0; mask <<= 1) { if (data & mask){ // choose bit digitalWrite(tx,HIGH); // send 1 } else{ digitalWrite(tx,LOW); // send 0 } delayMicroseconds(bit9600Delay); } //stop bit digitalWrite(tx, HIGH); delayMicroseconds(bit9600Delay); } int SWread() { byte val = 0; while (digitalRead(rx)); //wait for start bit if (digitalRead(rx) == LOW) { delayMicroseconds(halfBit9600Delay); for (int offset = 0; offset < 8; offset++) { delayMicroseconds(bit9600Delay); val |= digitalRead(rx) << offset; } //wait for stop bit + extra delayMicroseconds(bit9600Delay); delayMicroseconds(bit9600Delay); return val; } } At this point we can see Tx output on the oscilloscope but I don't see a new serial port come up in ls /dev/tty.* on mac so I am not sure the computer is recognizing the board. Next step: bi-directional communication using the arduino as an intermediate and software serial on the FabSampler to communicate with the arduino Advice from someone for direct to-computer connection was: "on mac, if you have everything hooked up, tab complete ls /dev/tty on that list is tty.usbserial-FTF4ZHMI . that's what you need, as in: python term.py /dev/tty.usbserial-FTF4ZHMI 115200 yours may look different, but it should match the serial number you see in System Profiler > USB (see screenshot) if not, maybe try installing drivers http://www.ftdichip.com/Drivers/VCP.htm" So I also installed the FTDI drivers. This then worked once I burned the boot-loader using the arduino software and then send the program to the board: it prints hello world every time the LED blinks purple #include #define rxPin 8 #define txPin 3 #define led 1 #define led2 2 SoftwareSerial mySerial(rxPin, txPin); //rx, tx // the Tx and Rx pins are 5 and 10 on the ATtiny which in Arduino map to pin 8 and pin 3 of arduino // the setup routine runs once when you press reset: void setup() { pinMode(led, OUTPUT); pinMode(led2, OUTPUT); pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); mySerial.begin(9600); mySerial.println("Hello, world?"); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW digitalWrite(led2, LOW); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second mySerial.println("Hello, world?"); //if (mySerial.available()) //mySerial.write(mySerial.read()); } This script is our first FabSampler: it samples a sensor input and reports the measured values over serial #include #define rxPin 8 #define txPin 3 #define led 1 #define led2 2 #define sensor1 7 #define sensor2 6 SoftwareSerial mySerial(rxPin, txPin); //rx, tx // the Tx and Rx pins are 5 and 10 on the ATtiny which in Arduino map to pin 8 and pin 3 of arduino // the setup routine runs once when you press reset: void setup() { pinMode(sensor1, INPUT); pinMode(sensor2, INPUT); pinMode(led, OUTPUT); pinMode(led2, OUTPUT); pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); mySerial.begin(9600); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW digitalWrite(led2, LOW); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second mySerial.println("Sensor 1 value:"); mySerial.println(analogRead(sensor1)); mySerial.println("Sensor 2 value:"); mySerial.println(analogRead(sensor2)); mySerial.println(""); //if (mySerial.available()) //mySerial.write(mySerial.read()); } Then this code produced a raw sensor data stream which we could plot in Matlab: #include #define rxPin 8 #define txPin 3 #define led 1 #define led2 2 #define sensor1 7 #define sensor2 6 SoftwareSerial mySerial(rxPin, txPin); //rx, tx // the Tx and Rx pins are 5 and 10 on the ATtiny which in Arduino map to pin 8 and pin 3 of arduino // the setup routine runs once when you press reset: void setup() { pinMode(sensor1, INPUT); pinMode(sensor2, INPUT); pinMode(led, OUTPUT); pinMode(led2, OUTPUT); pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); mySerial.begin(9600); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(led2, HIGH); // turn the LED on (HIGH is the voltage level) delay(2); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW digitalWrite(led2, LOW); // turn the LED on (HIGH is the voltage level) delay(2); // wait for a second //mySerial.println("Sensor 1 value:"); mySerial.println(analogRead(sensor1)); //mySerial.println("Sensor 2 value:"); //mySerial.println(analogRead(sensor2)); //mySerial.println(""); //if (mySerial.available()) //mySerial.write(mySerial.read()); } Programming directly with Crosspack: this also worked Adam-Marblestones-MacBook-Pro:desktop adammarblestone$ make -f FabSampler_v5m_echodebug.c.make avr-gcc -mmcu=attiny44 -Wall -Os -DF_CPU=20000000 -I./ -o FabSampler_v5m_echodebug.out FabSampler_v5m_echodebug.c avr-objcopy -O ihex FabSampler_v5m_echodebug.out FabSampler_v5m_echodebug.c.hex;\ avr-size --mcu=attiny44 --format=avr FabSampler_v5m_echodebug.out AVR Memory Usage ---------------- Device: attiny44 Program: 832 bytes (20.3% Full) (.text + .data + .bootloader) Data: 33 bytes (12.9% Full) (.data + .bss + .noinit) Adam-Marblestones-MacBook-Pro:desktop adammarblestone$ sudo make -f FabSampler_v5m_echodebug.c.make program-avrisp2-fuses Password: avr-objcopy -O ihex FabSampler_v5m_echodebug.out FabSampler_v5m_echodebug.c.hex;\ avr-size --mcu=attiny44 --format=avr FabSampler_v5m_echodebug.out AVR Memory Usage ---------------- Device: attiny44 Program: 832 bytes (20.3% Full) (.text + .data + .bootloader) Data: 33 bytes (12.9% Full) (.data + .bss + .noinit) avrdude -p t44 -P usb -c avrisp2 -U lfuse:w:0x7E:m avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.01s avrdude: Device signature = 0x1e9207 avrdude: reading input file "0x7E" avrdude: writing lfuse (1 bytes): Writing | ################################################## | 100% 0.02s avrdude: 1 bytes of lfuse written avrdude: verifying lfuse memory against 0x7E: avrdude: load data lfuse data from input file 0x7E: avrdude: input file 0x7E contains 1 bytes avrdude: reading on-chip lfuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of lfuse verified avrdude: safemode: Fuses OK avrdude done. Thank you. Adam-Marblestones-MacBook-Pro:desktop adammarblestone$ sudo make -f FabSampler_v5m_echodebug.c.make program-avrisp2 avr-objcopy -O ihex FabSampler_v5m_echodebug.out FabSampler_v5m_echodebug.c.hex;\ avr-size --mcu=attiny44 --format=avr FabSampler_v5m_echodebug.out AVR Memory Usage ---------------- Device: attiny44 Program: 832 bytes (20.3% Full) (.text + .data + .bootloader) Data: 33 bytes (12.9% Full) (.data + .bss + .noinit) avrdude -p t44 -P usb -c avrisp2 -U flash:w:FabSampler_v5m_echodebug.c.hex avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.01s avrdude: Device signature = 0x1e9207 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 "FabSampler_v5m_echodebug.c.hex" avrdude: input file FabSampler_v5m_echodebug.c.hex auto detected as Intel Hex avrdude: writing flash (832 bytes): Writing | ################################################## | 100% 0.29s avrdude: 832 bytes of flash written avrdude: verifying flash memory against FabSampler_v5m_echodebug.c.hex: avrdude: load data flash data from input file FabSampler_v5m_echodebug.c.hex: avrdude: input file FabSampler_v5m_echodebug.c.hex auto detected as Intel Hex avrdude: input file FabSampler_v5m_echodebug.c.hex contains 832 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 0.25s avrdude: verifying ... avrdude: 832 bytes of flash verified avrdude: safemode: Fuses OK avrdude done. Thank you. Adam-Marblestones-MacBook-Pro:desktop adammarblestone$ Then disconnect programmer and connect FTDI cable.