Project 11 - Networking and Communication

To network boards I took my EKG board, my controller board and the input from me. I measured the voltage across my chest with the ATtiny44 on the EKG board as in Input Devices week. I started out with the EKG board programmed just the way it was from Input week and reprogrammed the controller board to read the serial from the EKG. Because I hadn't planned the board initially to receive data I jumped a wire from the FTDI header to one of the unclaimed ATtiny pins. To power the system I re-soldered the zero ohm resistor back to my FabISP. I connected the programner board to the EKG board via ribbon wire with single connectors.

vacuume bubbles

Because the two boards are communicating and one is sending a command to the other it is a "master and slave" set up where the EKG board is the master and the programmer board which flashed its LED is the slave. 3 boards

There was a lot of noise in the EKG today when I was looking at the serial numbers. So I re-programmed both boards so the EKG board would output an analog signal and the controller board would read it. If the controller read above a certain threshold the LED would blink, i.e. it would blink to my heart beat. There were still some problems with this, neither method really worked consitently, but both kind of worked. I think the problem was mainly getting a good signal from my heart. When my brother, whose currently in med school, looked at this page he noted that my leads were not symmetric around my heart, which they should be to pick up the signal. We suspect this is the cause to at least some of my problems. me

Arduino Code for Controller Board

#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 1); // RX, TX

int led = 7;
int led_on = 0;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
mySerial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop()
{
if (mySerial.available()) {
//Serial.write(mySerial.read());

// readString
if (mySerial.read() > 500)
{
led_on = 1;
}
else
// wait for a second
{
led_on = 0;
}
}

if (led_on == 1) {
digitalWrite(led, LOW); // turn the LED on (HIGH is the voltage level)
delay(10);
} else {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10);
}
}

Arduino Code for EKG Board

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 1); // RX, TX

void setup()
{
// Open serial communications and wait for port to open:
mySerial.begin(9600); // set the data rate for the SoftwareSerial port
pinMode(8, INPUT);
}

void loop() // run over and over
{
const int analogInPin = A7;
int adcread =0;
adcread = analogRead(analogInPin);

mySerial.println(adcread);
delay(20);
}