Project idea: using iPhone to charge, program and communicate with sensor peripherals, such as the EEG monitor that Charles and I are developing Inspiration: http://web.eecs.umich.edu/~prabal/projects/hijack/ http://code.google.com/p/hijack-main/ These document basically describe how to do it: http://cdn.energymicro.com/dl/an/pdf/an0054_efm32_phone_audio_jack_interface.pdf http://web.eecs.umich.edu/~prabal/pubs/papers/kuo10hijack-islped.pdf So I'm basically making a Fab-HiJack EEG monitor. Hopefully this will make HiJack type technology even more accessible. Goal is to: 1) power FabECG and FabSampler hybrid board from iPhone audio jack 2) sample data from FabECG and FabSampler hybrid board from iPhone audio jack 3) program these boards via the iPhone audio jack This week I'm just starting with powering a micro-controller via the iPhone audio jack. 3.5 mm plug fits in the iPhone jack: http://en.wikipedia.org/wiki/File:Audio-TRS-Mini-Plug.jpg OK well I need a micro-transformer for this, which I don't have at the moment. So we'll have to just send data for now from an externally powered board. Therefore what we'll do is make a version of the FabSampler board that outputs over FSK-modulated audio instead of just over serial. We'll also optionally hook up a speaker to hear the modem-like sounds that should be produced. The basic way of doing this from an arduino is described here: I plan to adapt this for the Tiny44 using the Mellis strategy of programming the Tiny44 using arduino code http://arduino.cc/forum/index.php/topic,19648.0.html What we're going to do is take FabSampler and replace the RGB LED with an output channel to communicate with the iphone: That frees up PAO, PA1 and PA2 on the ATtiny44 also known as pins 13, 12 and 11 One issue is that in the arduino code I've seen, there seems to be no obvious way to change which pins SoftModem uses for FSK input and output: http://www.creativedistraction.com/demos/sensor-data-to-iphone-through-the-headphone-jack-using-arduino/ We should be able to change this by editing the SoftModem.cpp file: #define SOFT_MODEM_TX_PIN (3) should be changed to whichever pin we are using for FSK output. To implement that, we'll follow this page on how to to modify one of the built in Arduino libraries: http://www.ladyada.net/library/arduino/libraries.html The libraries folder for Arduino on my Mac OSX is hidden inside the arduino app itself: /Applications/Arduino.app/Contents/Resources/Java/Libraries Couldn't see the softmodem library built in so will try downloading it from here: http://code.google.com/p/arms22/downloads/detail?name=SoftModem-004.zip&can=2&q= Got this error when compiling: In file included from FabSamplerFSK_v1.cpp:2: /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.h:72: error: conflicting return type specified for 'virtual void SoftModem::write(uint8_t)' /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)' So using patched version of softmodem. But this gave a different set of errors /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp: In member function 'void SoftModem::begin()': /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:109: error: 'TCNT2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:112: error: 'TCCR2A' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:113: error: 'TCCR2B' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp: In member function 'void SoftModem::end()': /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:120: error: 'TIMSK2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:120: error: 'OCIE2A' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp: In member function 'void SoftModem::demodulate()': /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:139: error: 'TCNT2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:142: error: 'TIFR2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:142: error: 'TOV2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:170: error: 'OCR2A' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:171: error: 'TIFR2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:171: error: 'OCF2A' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:172: error: 'TIMSK2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:172: error: 'OCIE2A' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp: In member function 'void SoftModem::recv()': /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:235: error: 'TIMSK2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:235: error: 'OCIE2A' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp: In function 'void TIMER2_COMPA_vect()': /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:247: error: 'OCR2A' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp: In member function 'void SoftModem::modulate(uint8_t)': /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:284: error: 'OCR2B' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:285: error: 'TIFR2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:285: error: 'OCF2B' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:290: error: 'OCR2B' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:291: error: 'TIFR2' was not declared in this scope /Applications/Arduino.app/Contents/Resources/Java/libraries/SoftModem/SoftModem.cpp:291: error: 'OCF2B' was not declared in this scope Finally tried softmodem 005 from here: http://code.google.com/p/arms22/ Same issue. Those guys also have a softmodem terminal iPhone app With arduino 1.0, but not 1.0.1, after I made a bunch of replacements of the register names as shown in the edited softmodem.cpp file, I was able to compile the program. Did not work with arduino1.0.1 Had to remember to change the output port to (0) in the softmodem.cpp file after these changes. Saw nice FSK modulated signals on the scope and the board could digitally sample an analog signal, convert it to an int, and output the int with FSK modulation The input square waves were around 2.5V or so, into the AVR. Where I believe the ADC was referenced by default such that 5V = 1024. Note that the softmodem library takes 8bit unsigned integers.