-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
3,442 additions
and
4 deletions.
There are no files selected for viewing
145 changes: 145 additions & 0 deletions
145
Assasin costume/running_costume_with_temp_sensor/running_costume_with_temp_sensor.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
//Author: Saurutobi | ||
#include <OneWire.h> | ||
#include <DallasTemperature.h> | ||
|
||
enum LINE { | ||
lineA = 2, | ||
lineB, | ||
lineC, | ||
lineD, | ||
lineE, | ||
lineF, | ||
lineG, | ||
lineH | ||
} line; | ||
|
||
int statusLED = 10; | ||
int testLED = 13; | ||
float inputTemp = 12; | ||
int freq1 = 100; | ||
int freq2 = 200; | ||
int freq3 = 300; | ||
int freq4 = 400; | ||
int freq5 = 500; | ||
int freq6 = 600; | ||
int freq7 = 700; | ||
int freq8 = 800; | ||
int freq9 = 900; | ||
int freq10 = 1000; | ||
int lowthreshold = 0; | ||
int threshold1 = 1; | ||
int threshold2 = 2; | ||
int threshold3 = 3; | ||
int threshold4 = 4; | ||
int threshold5 = 5; | ||
int threshold6 = 6; | ||
int threshold7 = 7; | ||
int highthreshold = 8; | ||
|
||
// Data wire is plugged into pin 3 on the Arduino | ||
#define ONE_WIRE_BUS 3 | ||
|
||
// Setup a oneWire instance to communicate with any OneWire devices | ||
OneWire oneWire(ONE_WIRE_BUS); | ||
|
||
// Pass our oneWire reference to Dallas Temperature. | ||
DallasTemperature sensors(&oneWire); | ||
|
||
//USE THE DS18B20_address_finder to get this address | ||
DeviceAddress tempSensor = { 0x28, 0x94, 0xE2, 0xDF, 0x02, 0x00, 0x00, 0xFE }; | ||
|
||
void setup() | ||
{ | ||
//set up testLED, statusLED for output | ||
pinMode(testLED, OUTPUT); | ||
pinMode(statusLED, OUTPUT); | ||
|
||
//set up all lines for output | ||
pinMode(lineA, OUTPUT); | ||
pinMode(lineB, OUTPUT); | ||
pinMode(lineC, OUTPUT); | ||
pinMode(lineD, OUTPUT); | ||
pinMode(lineE, OUTPUT); | ||
pinMode(lineF, OUTPUT); | ||
pinMode(lineG, OUTPUT); | ||
pinMode(lineH, OUTPUT); | ||
|
||
// Start up the library | ||
sensors.begin(); | ||
// set the resolution to 10 bit (good enough?) | ||
sensors.setResolution(tempSensor, 9); | ||
} | ||
|
||
void loop() | ||
{ | ||
//read temperature here | ||
sensors.requestTemperatures(); | ||
inputTemp = sensors.getTempC(tempSensor); | ||
|
||
dWrite(); | ||
} | ||
|
||
void dWrite() | ||
{ | ||
//we want to stop when we've started over the 3rd time | ||
line = LINE.lineA; | ||
int frequency = HIGH; | ||
for(int counter = 0; counter < 2; line++) | ||
{ | ||
digitalWrite(testLED, frequency); //do the first test | ||
digitalWrite(line, frequency); //write to the specific line and freq | ||
if (line == LINE.lineH) //if we're at the end do something different | ||
{ | ||
/*** Depending on HIGH or LOW we will do freq# or 1000 - freq# ***/ | ||
if (inputTemp <= lowthreshold) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq1); | ||
} | ||
else if (inputTemp > lowthreshold && inputTemp <= threshold1) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq2); | ||
} | ||
else if (inputTemp > threshold1 && inputTemp <= threshold2) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq3); | ||
} | ||
else if (inputTemp > threshold2 && inputTemp <= threshold3) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq4); | ||
} | ||
else if (inputTemp > threshold3 && inputTemp <= threshold4) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq5); | ||
} | ||
else if (inputTemp > threshold4 && inputTemp <= threshold5) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq6); | ||
} | ||
else if (inputTemp > threshold5 && inputTemp <= threshold6) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq7); | ||
} | ||
else if (inputTemp > threshold6 && inputTemp <= threshold7) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq8); | ||
} | ||
else if (inputTemp > threshold7 && inputTemp <= highthreshold) | ||
{ | ||
delayMicroseconds((counter * 1000) - freq9); | ||
} | ||
else | ||
{ | ||
delayMicroseconds((counter * 1000) - freq10); | ||
} | ||
|
||
if (counter == 0) //only do this stuff the first time | ||
{ | ||
frequency = LOW; //change the frequency | ||
digitalWrite(testLED, frequency); //do a test write | ||
} | ||
|
||
counter++; //change the next set of writes | ||
} | ||
line++; //change to next line | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
... programs/program_to_test_and_read_freq_for_pwm/program_to_test_and_read_freq_for_pwm.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//Author: Saurutobi | ||
int lineA = 2; | ||
int testLED = 13; | ||
int printButton = 11; //http://www.arduino.cc/en/Tutorial/Button for tutorial | ||
int changeTempButton = 12; | ||
int frequency = 100; | ||
|
||
void setup() | ||
{ | ||
//this sets up testLED as an output | ||
pinMode(testLED, OUTPUT); | ||
//set up all lines for output | ||
pinMode(lineA, OUTPUT); | ||
//sets up printButton to output a frequency or something like that | ||
pinMode(printButton, INPUT); | ||
} | ||
|
||
void loop() | ||
{ | ||
dWrite(); | ||
} | ||
void dWrite() | ||
{ | ||
if(digitalRead(printButton) == HIGH) | ||
{ | ||
Serial.println("duty on frequency = " + frequency); | ||
digitalWrite(testLED, HIGH); | ||
delay(1000); | ||
} | ||
else if(digitalRead(changeTempButton) == HIGH) | ||
{ | ||
frequency += 10; | ||
Serial.println("changed frequency. it is now = " + frequency); | ||
digitalWrite(testLED, HIGH); | ||
delay(1000); | ||
} | ||
else | ||
{ | ||
digitalWrite(testLED, LOW); | ||
} | ||
|
||
digitalWrite(lineA, HIGH); | ||
delayMicroseconds(frequency); | ||
digitalWrite(lineA, LOW); | ||
delayMicroseconds(1000 - frequency); | ||
} |
55 changes: 55 additions & 0 deletions
55
... programs/program_to_test_and_read_temperatures/program_to_test_and_read_temperatures.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//Author:Saurutobi | ||
#include <OneWire.h> | ||
#include <DallasTemperature.h> | ||
|
||
// Data wire is plugged into pin 3 on the Arduino | ||
#define ONE_WIRE_BUS 3 | ||
|
||
// Setup a oneWire instance to communicate with any OneWire devices | ||
OneWire oneWire(ONE_WIRE_BUS); | ||
|
||
// Pass our oneWire reference to Dallas Temperature. | ||
DallasTemperature sensors(&oneWire); | ||
|
||
|
||
//USE THE DS18B20_address_finder to get this address | ||
DeviceAddress tempSensor = { 0x28, 0x94, 0xE2, 0xDF, 0x02, 0x00, 0x00, 0xFE }; | ||
float currTemp; | ||
float pastTemp; | ||
boolean up = true; | ||
|
||
|
||
void setup(void) | ||
{ | ||
// Start up the library | ||
sensors.begin(); | ||
// set the resolution to 10 bit (good enough?) | ||
sensors.setResolution(tempSensor, 9); | ||
} | ||
|
||
void loop(void) | ||
{ | ||
pastTemp = currTemp; | ||
sensors.requestTemperatures(); | ||
currTemp = sensors.getTempC(tempSensor); | ||
|
||
if(up) | ||
{ | ||
if(pastTemp > currTemp) | ||
{ | ||
up = false; | ||
Serial.print("Peaked at: "); | ||
Serial.println(pastTemp); | ||
} | ||
} | ||
else | ||
{ | ||
if(pastTemp < currTemp) | ||
{ | ||
up = true; | ||
Serial.print("hit bottom at: "); | ||
Serial.println(pastTemp); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Saurutobi_Assasin_Costume | ||
========================= | ||
|
||
This Repo contains multiple Arduino Projects and libraries aimed at one goal: driving EL wire. | ||
Projects: -DS18B20_address_finder | ||
-arduino_ds18b20_temperature_sensor | ||
-running_costume_with_temp_sensor | ||
-program_to_test_and_read_freq_for_pwm | ||
-program_to_test_and_read_temperatures | ||
|
||
Libraries: -DallasTemperature | ||
-OneWire | ||
|
||
Each Project and Library has its own purpose. | ||
DS18B20_address_finder: | ||
This program is designed solely to find the 64bit address of the DS18B20 temperature | ||
sensors currently connected | ||
|
||
arduino_ds18b20_temperature_sensor: | ||
This Project contains sample code on how to use the DS18B20 | ||
|
||
program_to_test_and_read_freq_for_pwm: | ||
This program is designed to test the EL wire on the El Escudo Dos Arduino sheild to | ||
find the frequencies where the EL wire does not flicker. The flickering is caused by | ||
the AC switches in the El Escudo Dos, which wait for the AC wave to peak or Trough. | ||
|
||
program_to_test_and_read_temperatures: | ||
This program was solely designed to find the maximum and minimum temperatures that | ||
the DS18B20 returns under the costume working environment. | ||
|
||
running_costume_with_temp_sensor: | ||
This is the program that actually runs the Costume. It determines the temperature, | ||
adjusts the EL wire frequency to a predetermined frequency as found by the testing | ||
program. This causes the suit to get brighter as you inhale, and dimmer as you | ||
exhale. | ||
|
||
Both libraries are required to allow the DS18B20 to function with any program. | ||
|
||
Plans for the Future: | ||
-Add sound sensitivity for different EL wire strands. | ||
-Add heartbeat sensing for different EL wire strands. |
50 changes: 50 additions & 0 deletions
50
arduino_ds18b20_temperature_sensor/DS18B20_address_finder/DS18B20_address_finder.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// This sketch looks for 1-wire devices and | ||
// prints their addresses (serial number) to | ||
// the UART, in a format that is useful in Arduino sketches | ||
// Tutorial: | ||
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html | ||
|
||
#include <OneWire.h> | ||
|
||
OneWire ds(3); // Connect your 1-wire device to pin 3 | ||
|
||
void setup(void) { | ||
Serial.begin(9600); | ||
discoverOneWireDevices(); | ||
} | ||
|
||
void discoverOneWireDevices(void) { | ||
byte i; | ||
byte present = 0; | ||
byte data[12]; | ||
byte addr[8]; | ||
|
||
Serial.print("Looking for 1-Wire devices...\n\r"); | ||
while(ds.search(addr)) { | ||
Serial.print("\n\rFound \'1-Wire\' device with address:\n\r"); | ||
for( i = 0; i < 8; i++) { | ||
Serial.print("0x"); | ||
if (addr[i] < 16) { | ||
Serial.print('0'); | ||
} | ||
Serial.print(addr[i], HEX); | ||
if (i < 7) { | ||
Serial.print(", "); | ||
} | ||
} | ||
if ( OneWire::crc8( addr, 7) != addr[7]) { | ||
Serial.print("CRC is not valid!\n"); | ||
return; | ||
} | ||
} | ||
Serial.print("\n\r\n\rThat's it.\r\n"); | ||
ds.reset_search(); | ||
return; | ||
} | ||
|
||
void loop(void) { | ||
// nothing to see here | ||
} | ||
|
||
|
||
|
Oops, something went wrong.