Development Timeline
-
5. Mistake
I initially triedcompiling and uploading with Board as Lilypad. This was my mistake. You can see on the left compiling errors recieved with avrdude. ON the right you see me changing the board to uno and voila, the FTDI cable is programming the lilypad. Small thing for you maybe. BIG THING FOR ME (2 hours to figure out >D)
-
6. Schematic with Switch(Input) + LED(Output)
The schematic on the right is the first swatch I tried. Its the simplest form of a circuit I could think of. I took this schematic on a rexin fabric and run copper tape on it. I used a simple folded Paper in shape of a diamond and connected copepr tapes of the circuit on either side in such a way that when i press on it, the two copper tapes connect and let current through. Now the goal here is not to power the led by completing the circuit. It is for an IC pin to recieve current when i press the button so its state goes to "HIGH", the IC then swtiches to "HIGH" on another pin which is conencted to an LED. So it is not an analogue circuit but controlled through the IC. The FTDI is able to reac 0 and 1 state pf the swtich and show it in the Arduino READ
-
7. Schematic with LDR (Input) + RGB (Output)
For the analog sensor, I just took a simple LDR. I couldnt find an anogue way of building one. It is possible only through the component and anything else requires much more sophisticated hardware to achieve a light sensor. This swatch has an output device too as I plan to use it to meet assessment criteria of week 9 also. Videos of both swatches are shown above and codes written below for the lilypad.
Note: the A0 analog read pin of the lilypad is to connect in between the LDR and its resistor, not at the end of the Resistor + LDR. I made this mistake the first time on a breadboard.
Code for Button-Led
int SensorPin = 2;
int LEDPin = 13;
int LEDstate = HIGH;
int reading;
int previous = LOW;
long time = 0;
long debounce = 50;
void setup()
{
pinMode(SensorPin, INPUT);
digitalWrite(SensorPin, HIGH);
pinMode(LEDPin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int switchstate;
int sensorValue = digitalRead(2);
reading = digitalRead(SensorPin);
if (reading != previous) {
time = millis();
}
if ((millis() - time) > debounce) {
switchstate = reading;
if (switchstate == HIGH)
LEDstate = LOW;
else
LEDstate = HIGH;
}
digitalWrite(LEDPin, LEDstate);
Serial.println(sensorValue);
previous = reading;
}
Code for LDR-RGB
const int redPin = 7;
const int grnPin = 8;
const int bluPin = 9;
int SensorPin = A0;
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(grnPin, OUTPUT);
pinMode(bluPin, OUTPUT);
pinMode(SensorPin, INPUT);
Serial.begin(9600);
}
void loop() {
if (analogRead(SensorPin) <= 200)
{
redtoyellow();
yellowtogreen();
greentocyan();
cyantoblue();
bluetomagenta();
magentatored();
}
else if (analogRead(SensorPin) >= 201)
{
digitalWrite(redPin, LOW);
digitalWrite(grnPin, LOW);
digitalWrite(bluPin, LOW);
}
reading = digitalRead(SensorPin);
Serial.println(sensorValue);
previous = reading;
}
void redtoyellow()
{
digitalWrite(redPin, HIGH);
digitalWrite(bluPin, LOW);
// fade up green
for(byte i=1; i<100; i++) {
byte on = i;
byte off = 100-on;
for( byte a=0; a<100; a++ ) {
digitalWrite(grnPin, HIGH);
delayMicroseconds(on);
digitalWrite(grnPin, LOW);
delayMicroseconds(off);
}
}
}
void yellowtogreen()
{
digitalWrite(grnPin, HIGH);
digitalWrite(bluPin, LOW);
// fade down red
for(byte i=1; i<100; i++) {
byte on = 100-i;
byte off = i;
for( byte a=0; a<100; a++ ) {
digitalWrite(redPin, HIGH);
delayMicroseconds(on);
digitalWrite(redPin, LOW);
delayMicroseconds(off);
}
}
}
void greentocyan()
{
digitalWrite(grnPin, HIGH);
digitalWrite(redPin, LOW);
// fade up blue
for(byte i=1; i<100; i++) {
byte on = i;
byte off = 100-on;
for( byte a=0; a<100; a++ ) {
digitalWrite(bluPin, HIGH);
delayMicroseconds(on);
digitalWrite(bluPin, LOW);
delayMicroseconds(off);
}
}
}
void cyantoblue()
{
digitalWrite(bluPin, HIGH);
digitalWrite(redPin, LOW);
// fade down green
for(byte i=1; i<100; i++) {
byte on = 100-i;
byte off = i;
for( byte a=0; a<100; a++ ) {
digitalWrite(grnPin, HIGH);
delayMicroseconds(on);
digitalWrite(grnPin, LOW);
delayMicroseconds(off);
}
}
}
void bluetomagenta()
{
digitalWrite(bluPin, HIGH);
digitalWrite(grnPin, LOW);
// fade up red
for(byte i=1; i<100; i++) {
byte on = i;
byte off = 100-on;
for( byte a=0; a<100; a++ ) {
digitalWrite(redPin, HIGH);
delayMicroseconds(on);
digitalWrite(redPin, LOW);
delayMicroseconds(off);
}
}
}
void magentatored()
{
digitalWrite(redPin, HIGH);
digitalWrite(grnPin, LOW);
// fade down blue
for(byte i=1; i<100; i++) {
byte on = 100-i;
byte off = i;
for( byte a=0; a<100; a++ ) {
digitalWrite(bluPin, HIGH);
delayMicroseconds(on);
digitalWrite(bluPin, LOW);
delayMicroseconds(off);
}
}
}
Tips and Tricks
Info Panel
- Velostat-Resistive cloth having coating of Carbon
- Nitinol- Memory wire that changes shape with current/temperature
Warning Notes
- Keep caution regarding the soldering station. Always switch off when not using.
- Dont let the soldering station without regulator get too hot as it damages tip.
Danger Panel
- Wear anti static band before working on solering or while making connections
- Keep a small burn lubricant nearby during soldering sessions.
Success Panel
- Copper tape conducts one side and needs to be continuos.
- Nitilol if passed current beyond prescribed temp could damage its state.
F.A.Q.
I usually ask the Global team or myself questions relevant to the week's task.I plan to use this section to help me document for our lab's next batch of students important questions and their answers discussed during Global review/Recitation.
Objectives | Tasks at hand
The first part of the session started with hitching an arduino lilypad with my laptop. I recently exchanged my laptop under warranty so had to reinstall all drivers again. After installing Arduiono IDE, I continued installing FTDI drivers and then after successfully uplaoding onto a lilypad, continued to a breadboard to quickly set up the schematic. The second part comprised of trying to make nitinol work with my laer cut living hinge loop design i made.
Reffered Links
Oct 23, 2018
Oct 24, 2018
Oct 24, 2018
Oct 25, 2018