Software used herein is unique to the project. Though it may be a derivative of software published under the GNU licence, it is code that can only be used with the corresponding mapping that we generate and therefore has to be modified to fit any other device with different hardware or physical architecture. It is the unique functional correlation between devices and their respective code that makes this summation of this device a unique and creative generation of our own. The code that was referenced will be properly sourced.
The GNU and GPL licence states the following;
The freedom to run the program, for any purpose (freedom 0).
The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this.
The freedom to redistribute copies so you can help your neighbor (freedom 2).
The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). Access to the source code is a precondition for this.
All Arduino hardware is also open source and claims the following;
Open-source hardware shares much of the principles and approach of free and open-source software. In particular, we believe that people should be able to study our hardware to understand how it works, make changes to it, and share those changes. To facilitate this, we release all of the original design files (Eagle CAD) for the Arduino hardware. These files are licensed under a Creative Commons Attribution Share-Alike license, which allows for both personal and commercial derivative works, as long as they credit Arduino and release their designs under the same license. The Arduino software is also open-source. The source code for the Java environment is released under the GPL and the C/C++ microcontroller libraries are under the LGPL.
Here we input cases for proper TEC reaction if(temp < 15) tempInput = ('o'); else if (temp < 20) tempInput = ('m'); else if (temp < 25) tempInput = ('f'); else tempInput = ('h');
Here are the proper TEC reactions based from above
if(tempInput == 'o'){
Serial.println("TEC is off");
}
else if(tempInput == 'm'){
Serial.println("TEC will run at moderate pulses");
}
else if(tempInput == 'f'){
Serial.println("TEC will run fast");
}
else{
Serial.println("TEC will run at full blast");
} Serial.print(getTemp(tempPin)); delay(1000);
} }
other useful functions int getTemp() { return (((5.0 * analogRead(tempPin) * 100.0)/1024.0)/8.0);
int temp1 = random(10,30); return temp1; }
Very raw implementation of the code but it gets us started thinking.
Things that are still needed:
1) Code to get temperature (clearly lol)
2) decision on how the TECs are placed (parallel or series. Very important as it affects how the arduino works with the switches [don't forget we can have different pins to different switches possibly])
3) Any other steps we can take to "simplify" or "cut down" on the code due to our size limitations of ram on the board.
for ( i = 0; i < 9; i++) { we need 9 bytes
data[i] = ds.read();
}
Temp=(data[1]<<8)+data[0];take the two bytes from the response relating to temperature
Temp=Temp>>4;divide by 16 to get pure celcius readout
next line is Fahrenheit conversion TempF=Temp*1.8+32; comment this line out to get celcius
Serial.print("Temp in C=");output the temperature to serial port Serial.print(Temp); Serial.print(" ");
Serial.print("Temp in F="); Serial.print(TempF); Serial.print(" ");
Serial.println();
}
FRS Code with modifications yielding a ten digit output in pounds instead of a two digit output in newtons...
+ A table of values or an equation needs to be generated mapping variable pressures to watt power sent to the TEC once the initial programming is complete and all three components and corresponding code are observed to function accurately together... ( i.e. temperature should be initially capped at 3 to 4 degrees Centigrade at contact pressures of 14 to 44 mmHg. - See P. Janwantanakul / Physiotherapy 92 (2006) 256-259, in RESEARCH ARCHIVE)
int fsrPin = 0; the FSR and 10K pulldown are connected to a0
int fsrReading; the analog reading from the FSR resistor divider int fsrVoltage; the analog reading converted to voltage
unsigned long fsrResistance; The voltage converted to resistance, can be very big so make "long" unsigned long fsrConductance; long fsrForce; Finally, the resistance converted to force
void setup(void) {
Serial.begin(9600); We'll send debugging information via the Serial monitor }
analog voltage reading ranges from about 0 to 1023 which maps to 0V to 5V (= 5000mV)
fsrVoltage = map(fsrReading, 0, 1023, 0, 5000);
Serial.print("Voltage reading in mV = ");
Serial.println(fsrVoltage);
if (fsrVoltage == 0) {
Serial.println("No pressure");
} else { The voltage = Vcc * R / (R + FSR) where R = 10K and Vcc = 5V
so FSR = ((Vcc - V) * R) / V yay math!
fsrResistance = 5000 - fsrVoltage; fsrVoltage is in millivolts so 5V = 5000mV fsrResistance *= 10000; 10K resistor
fsrResistance /= fsrVoltage;
Serial.print("FSR resistance in ohms = ");
Serial.println(fsrResistance);
fsrConductance = 1000000; we measure in micromhos so fsrConductance /= fsrResistance; Serial.print("Conductance in microMhos: "); Serial.println(fsrConductance);
Use the two FSR guide graphs to approximate the force
if (fsrConductance <= 1000) {
double fsrForce = fsrConductance / 80;
Serial.print("Force in Newtons: ");
Serial.println(fsrForce,10);
fsrForce = fsrForce/4.44822162;
Serial.print("Force in Pounds:");
Serial.println(fsrForce,10);
March 24, 2011 Fan Code and Paired Components Update
Code has been generated for all components except the red LED and the temperature sensors, programmers should familiarize themselves with the pin scheme as we move towards finishing the programming for the temperature sensors and embedding their values into the rest of the programming.
Libraries Used:
The GNU and GPL licence states the following;
As cited from http://www.gnu.org/home.html
All Arduino hardware is also open source and claims the following;
Open-source hardware shares much of the principles and approach of free and open-source software. In particular, we believe that people should be able to study our hardware to understand how it works, make changes to it, and share those changes. To facilitate this, we release all of the original design files (Eagle CAD) for the Arduino hardware. These files are licensed under a Creative Commons Attribution Share-Alike license, which allows for both personal and commercial derivative works, as long as they credit Arduino and release their designs under the same license.
The Arduino software is also open-source. The source code for the Java environment is released under the GPL and the C/C++ microcontroller libraries are under the LGPL.
As cited from http://arduino.cc/en/Main/FAQ
Arduino Lilly Pin Avaliability
A5 -LM35 (R)
A4 -LM35 (R)
A3 -FSR1 (L)
A2 -FSR2 (L)
A1 - FSR1(R)
A0 - FSR2(R)
13 -
12 - one wire (R)
11 - Fan for to peltier10 (R)
10 - mosfet to peltier10 (R)
9 - blue LED for peltier110 (R)
8 -one wire (L)
7 -red LED (R)
6 - mosfet to peltier6 (L)
5 - Fan for peltier6 (L)
4 -red LED (L)
3 - blue LED for peltier6 (L)
2 -
1-
0 -
variables
int tempPin = 10;
int temp;
setup
void setup ()
{
Serial.begin(9600);
}
main body "loop"
void loop()
{
temp = getTemp();
char tempInput;
if(Serial.available() > 0)
{
tempInput = Serial.read();
Serial.println(temp);
Here we input cases for proper TEC reaction
if(temp < 15)
tempInput = ('o');
else if (temp < 20)
tempInput = ('m');
else if (temp < 25)
tempInput = ('f');
else
tempInput = ('h');
Here are the proper TEC reactions based from above
if(tempInput == 'o'){
Serial.println("TEC is off");
}
else if(tempInput == 'm'){
Serial.println("TEC will run at moderate pulses");
}
else if(tempInput == 'f'){
Serial.println("TEC will run fast");
}
else{
Serial.println("TEC will run at full blast");
}
Serial.print(getTemp(tempPin));
delay(1000);
}
}
other useful functions
int getTemp()
{
return (((5.0 * analogRead(tempPin) * 100.0)/1024.0)/8.0);
int temp1 = random(10,30);
return temp1;
}
Very raw implementation of the code but it gets us started thinking.
Things that are still needed:
1) Code to get temperature (clearly lol)
2) decision on how the TECs are placed (parallel or series. Very important as it affects how the arduino works with the switches [don't forget we can have different pins to different switches possibly])
3) Any other steps we can take to "simplify" or "cut down" on the code due to our size limitations of ram on the board.
we gotz this guys. lets do it!
~ Ferdinand "ferdy bird" Aliaj
Dallas DS18S20 Temperature Chip i/o for C and F output.
http://stuff.nekhbet.ro/2009/08/23/how-to-use-the-ds18s20-and-ds18b20-temperature-sensors-with-arduino.html
Download the onewire.h library first....
#include <OneWire.h>
int Temp;
int TempF;
DS18S20 Temperature chip i/o
OneWire ds(10); on pin 10
void setup(void) {
initialize inputs/outputs
start serial port
Serial.begin(9600);
}
void loop(void) {
byte i;
byte present = 0;
byte data[12];
byte addr[8];
if ( !ds.search(addr)) {
ds.reset_search();
return;
}
for( i = 0; i < 8; i++) {
}
if ( OneWire::crc8( addr, 7) != addr[7]) {
Serial.print("CRC is not valid!\n");
return;
}
if ( addr[0] == 0x10) {
}
else if ( addr[0] == 0x28) {
}
else {
return;
}
ds.reset();
ds.select(addr);
ds.write(0x44,1); start conversion, with parasite power on at the end
delay(1000); maybe 750ms is enough, maybe not
we might do a ds.depower() here, but the reset will take care of it.
present = ds.reset();
ds.select(addr);
ds.write(0xBE); Read Scratchpad
for ( i = 0; i < 9; i++) { we need 9 bytes
data[i] = ds.read();
}
Temp=(data[1]<<8)+data[0];take the two bytes from the response relating to temperature
Temp=Temp>>4;divide by 16 to get pure celcius readout
next line is Fahrenheit conversion
TempF=Temp*1.8+32; comment this line out to get celcius
Serial.print("Temp in C=");output the temperature to serial port
Serial.print(Temp);
Serial.print(" ");
Serial.print("Temp in F=");
Serial.print(TempF);
Serial.print(" ");
Serial.println();
}
FRS Code with modifications yielding a ten digit output in pounds instead of a two digit output in newtons...
+ A table of values or an equation needs to be generated mapping variable pressures to watt power sent to the TEC once the initial programming is complete and all three components and corresponding code are observed to function accurately together... ( i.e. temperature should be initially capped at 3 to 4 degrees Centigrade at contact pressures of 14 to 44 mmHg. - See P. Janwantanakul / Physiotherapy 92 (2006) 256-259, in RESEARCH ARCHIVE)
int fsrPin = 0; the FSR and 10K pulldown are connected to a0
int fsrReading; the analog reading from the FSR resistor divider
int fsrVoltage; the analog reading converted to voltage
unsigned long fsrResistance; The voltage converted to resistance, can be very big so make "long"
unsigned long fsrConductance;
long fsrForce; Finally, the resistance converted to force
void setup(void) {
Serial.begin(9600); We'll send debugging information via the Serial monitor
}
void loop(void) {
fsrReading = analogRead(fsrPin);
Serial.print("Analog reading = ");
Serial.println(fsrReading);
analog voltage reading ranges from about 0 to 1023 which maps to 0V to 5V (= 5000mV)
fsrVoltage = map(fsrReading, 0, 1023, 0, 5000);
Serial.print("Voltage reading in mV = ");
Serial.println(fsrVoltage);
if (fsrVoltage == 0) {
Serial.println("No pressure");
} else {
The voltage = Vcc * R / (R + FSR) where R = 10K and Vcc = 5V
so FSR = ((Vcc - V) * R) / V yay math!
fsrResistance = 5000 - fsrVoltage; fsrVoltage is in millivolts so 5V = 5000mV
fsrResistance *= 10000; 10K resistor
fsrResistance /= fsrVoltage;
Serial.print("FSR resistance in ohms = ");
Serial.println(fsrResistance);
fsrConductance = 1000000; we measure in micromhos so
fsrConductance /= fsrResistance;
Serial.print("Conductance in microMhos: ");
Serial.println(fsrConductance);
Use the two FSR guide graphs to approximate the force
if (fsrConductance <= 1000) {
double fsrForce = fsrConductance / 80;
Serial.print("Force in Newtons: ");
Serial.println(fsrForce,10);
fsrForce = fsrForce/4.44822162;
Serial.print("Force in Pounds:");
Serial.println(fsrForce,10);
} else {
double fsrForce = fsrConductance - 1000;
fsrForce /= 30;
Serial.print("Force in Newtons: ");
Serial.println(fsrForce,10);
fsrForce = fsrForce/4.44822162;
Serial.print("Force in Pounds:");
Serial.println(fsrForce,10);
}
}
Serial.println("--------------------");
delay(400);
}
March 24, 2011 Fan Code and Paired Components Update
Code has been generated for all components except the red LED and the temperature sensors, programmers should familiarize themselves with the pin scheme as we move towards finishing the programming for the temperature sensors and embedding their values into the rest of the programming.
Libraries Used:
Here is a copy of our original code:
Features:
Net Version:
Credits:
Copy of fully commented code:
Features:
Next Version:
Credits:
Current Code:
Features:
Next Version:
Credits: