====== Tilt sensor ====== For the Assignment of this week I decided to make a tilt sensor. Scheme: {{ :fabricademy2017:students:anamaria.martinlopez:week5:captura.jpg?nolink&483x551 |captura.jpg}} I start by choosing the fabric, I need one that is very conductive. Then, I do a test with the multimeter. {{ :fabricademy2017:students:anamaria.martinlopez:week5:img_0160.jpg?nolink&300x400 |img_0160.jpg}} Once the conductivity is checked I choose the materials that I will use in my project: • Conductive wire • Conductive fabric •Wool • LEDs • Non-conductive tissue • Non-conductive beads I begin by making a pompom with wool and conductive thread. {{ :fabricademy2017:students:anamaria.martinlopez:week5:dibujo1.png?nolink&690x700 }} Then I put the beads to isolate and so have no problems if the cord touches some other thread. I begin to sew following the scheme. {{ :fabricademy2017:students:anamaria.martinlopez:week5:dibujo9.png?nolink&700x273 }} In order not to be confused with the pins of the leds I bend them differently, I bent the negative pin with a more rounded shape and the positive with a more square shape. This way I can sew them perfectly and I know I will not make any mistakes. {{ :fabricademy2017:students:anamaria.martinlopez:week5:img_0161.jpg?nolink&300x225 |img_0161.jpg}} **Battery holders** Following the diagram, the part of the thread that comes from the pompom is the positive so I end up sewing on the fabric a few more stitches so that when I insert the battery, it touches the thread well. {{ :fabricademy2017:students:anamaria.martinlopez:week5:img_0146_-_copia_2_.jpg?nolink&300x225 |img_0146_-_copia_2_.jpg}} I end up sewing the following leds and the battery holder. {{ :fabricademy2017:students:anamaria.martinlopez:week5:img_0168.jpg?nolink&800x600 |img_0168.jpg}} {{vimeo>240297726?medium}} ---- ====== ATtiny Programming ====== Configure ATTINY board:\\ 1. Arduino preferences: Additional url card managers\\ 2. Add: [[https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json|https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json]] {{:fabricademy2017:students:anamaria.martinlopez:week5:captura_1.jpg?nolink&400x337|captura_1.jpg}} - We close the manager - In Tools - Plate - We go to Card Manager - Search Attiny ====== Using your Arduino ISP to program an ATtiny microcontroller ====== Thanks to Kobakant for his fantastic tutorial: [[http://www.kobakant.at/DIY/?p=3742|http://www.kobakant.at/DIY/?p=3742]] {{ :fabricademy2017:students:anamaria.martinlopez:week5:dibujo3.png?nolink&690x700 }} Burn Bootloader To set the clock speed of your ATtiny to be faster (8Mhz) than the default of 1 MHz. - Select "ATtiny45 (8 MHz)" in the "Tools> Card" menu - Select "Arduino as ISP" in the "Tools> Programmer" menu - Select "Burn Bootloader" in the "Tools" menu ====== Arduino as ISP ====== Loading sketch - Open the sketch you want to load in ATtiny - Select "ATtiny45 (8 MHz)" from the "Tools> Board" menu - Select "Arduino as ISP" from the "Tools> Programmer" menu - Load sketch. If you get this error message, it's okay \\ avrdude: define the PAGEL and BS2 signals in the configuration file for the ATtiny85 part \\ avrdude: define the PAGEL and BS2 signals in the configuration file for the ATtiny8 part Remove the capacitor when loading the Arduino ISP sketch to the Arduino Uno and replace the capacitor to record the boot manager and load any sketch on your ATtiny. ====== ====== ---- ====== ATtiny Programming ====== Configure ATTINY board: \\ 1. Arduino preferences: Additional url card managers \\ 2. Add: [[https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json|https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json]] {{:fabricademy2017:students:anamaria.martinlopez:week5:captura_1.jpg?nolink&400x337|captura_1.jpg}} - We close the manager - In Tools - Plate - We go to Card Manager - Search Attiny ====== Turning your Arduino into a programmer of ISPArduino into an ISP programmer ====== Without condenser! Download the Arduino software and install itArduino software and install it\\ Download the ATtiny folder and save it in the "hardware" folder of the Arduino folder sketchesATtiny folder and save it in the "hardware" folder of the Arduino sketches folder\\ Restart ArduinoArduino\\ Open the "ArduinoISP" sketch in the "Examples" folder\\ Select "Arduino" One "from the menu" Tools> Board "Arduino" One "from the menu" Tools> Board "\\ Select from the Tools menu> Serial Port\\ Load the sketch Using your Arduino ISP to program an ATtiny microcontroller Add capacitors and programming connections! Arduino ISP to program an ATtiny microcontroller With condenser! Select "ATtiny45 (8 MHz)" in the "Tools> Board" menu\\ Select "Arduino as ISP" in the menu "Tools> Programmer" Arduino as ISP "in the" Tools> Programmer "menu\\ Select "Burn Boot Manager" in the "Tools" menu (yes capacitor)\\ Open the sketch you want to load in the ATtinyATtiny\\ Load sketch (yes condenser)\\ Now I connect my sensor to Attiny by adding a buzzer. Scheme: {{vimeo>240630034?medium}} Code: /*\\ CODE for the Fabricademy e-textile sensor swatch\\ first built for the Fabricademy 2017\\ Hannah Perner-Wilson and Mika Satomi, KOBAKANT\\ */ #define sensorPin 3\\ #define speakerPin 2\\ #define ledPin 0 int sensorValue = 0;\\ int noiseFrequency = 0;\\ int ledBrightness = 0; void setup()\\ {\\ pinMode(sensorPin, INPUT); // use digital pin number here\\ pinMode(speakerPin, OUTPUT);\\ pinMode(ledPin, OUTPUT);\\ } void loop()\\ {\\ sensorValue = analogRead(sensorPin); //use analog pin number here //MAKE SOUND:\\ if(sensorValue < 900){ noiseFrequency = map(sensorValue, 0, 1023, 100, 10000); noise (speakerPin, noiseFrequency); } //FADE LED: ledBrightness = map(sensorValue, 0, 1023, 0, 255); analogWrite(ledPin, ledBrightness); } // MAKE SOUND ON THE ATTINY WITHOUT THE SOUND LIBRARY: void noise (unsigned char noisePin, int frequencyInHertz) { long delayAmount = (long)(1000000 / frequencyInHertz); digitalWrite(noisePin, HIGH); delayMicroseconds(delayAmount); digitalWrite(noisePin, LOW); delayMicroseconds(delayAmount); } // ---- ====== Belt ====== I started cutting a rectangle of 95 x 22 cm in two different tissues. I chose synthetic leather to give body to the belt and tulle to decorate and hide the electronics. For decoration I vectorized an image to cut it on textile vinyl. {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/hh_2_.jpg?nolink&756x425|hh_2_.jpg}} I opened with Rhinoceros and I rised the design. {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/dibujo.png?nolink&710x230}} I cut the vinyl with a 45ºC blade that is usually the basic one with these parameters: Speed: 24 Power: 130 Temperature at 167º (ask the seller, not all vinyls are ironed at the same temperature). {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/dibujo1.jpg?nolink&800x209|dibujo1.jpg}} ---- This week, we worked with Gemma v2 and 4 neopixel. If you have Windows, download these drivers: [[https://github.com/adafruit/Adafruit_Windows_Drivers/releases/download/2.0.0.0/adafruit_drivers_2.0.0.0.exe|https://github.com/adafruit/Adafruit_Windows_Drivers/releases/download/2.0.0.0/adafruit_drivers_2.0.0.0.exe]] Then, open Arduino and configure the board: {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/captura5.jpg?nolink&538x266|captura5.jpg}} Then, select **USBtinyISP** from the **Tools→Programmer** sub-menu {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/captura6.jpg?nolink&510x271|captura6.jpg}} After installing the Arduino IDE with support for Adafruit's boards you can load a simple blinking LED example to test uploading to Gemma works as expected. Open the Arduino IDE and replace the sketch code with the following blink code: Edit ====== Blink Gemma: ====== 1. /* \\ 2. Blink \\ 3. Turns on an LED on for one second, then off for one second, repeatedly. \\ 4. \\ 5. This example code is in the public domain. \\ 6. \\ 7. To upload to your or Trinket: \\ 8. 1) Select the proper board from the Tools→Board Menu (Arduino Gemma if \\ 9. teal, Adafruit Gemma if black) \\ 10. 2) Select the uploader from the Tools→Programmer (“Arduino Gemma” if teal, \\ 11. “USBtinyISP” if black Gemma) \\ 12. 3) Plug in the Gemma into USB, make sure you see the green LED lit \\ 13. 4) For windows, make sure you install the right Gemma drivers \\ 14. 5) Press the button on the Gemma/Trinket - verify you see \\ 15. the red LED pulse. This means it is ready to receive data \\ 16. 6) Click the upload button above within 10 seconds \\ 17. */ \\ 18. \\ 19. int led = 1; //blink 'digital' pin 1 - AKA the built in red LED \\ 20. \\ 21. //the setup routine runs once when you press reset: \\ 22. void setup() { \\ 23. //initialize the digital pin as an output. \\ 24. pinMode(led, OUTPUT); \\ 25. \\ 26. } \\ 27. \\ 28. //the loop routine runs over and over again forever: \\ 29. void loop() { \\ 30. digitalWrite(led, HIGH); \\ 31. delay(1000); \\ 32. digitalWrite(led, LOW); \\ 33. delay(1000); \\ If the blink works correctly, load the program for our neopixels. Edit ====== Code: ====== #include \\ #define NUM_LEDS 4 //Number of NeoPixels \\ #define PIN 1 //DIGITAL pin # where NeoPixels are connected \\ //IMPORTANT: Avoid connecting on a live circuit. . .// \\ if you must, connect GND first. \\ Adafruit_NeoPixel strip = Adafruit_NeoPixel( NUM_LEDS, PIN) ; \\ void setup() { \\ strip. begin(); \\ strip. setBrightness(100); //100/255 brightness ( about 40%) \\ strip. show(); //Initialize all pixels to ' off' \\ } \\ void loop( ) { \\ for( int j=0; j<256; j ++) { \\ for( int i=0; i[[http://wiki.textile-academy.org/fabricademy2017/students/anamaria.martinlopez/week12#fn__1|1)]] ; \\ } \\ strip.show(); \\ delay(20); \\ } \\ } \\ //Input a value 0 to 255 to get a color value.// \\ The colours are a transition r - g - b - back to r. \\ uint32_t Wheel( byte WheelPos) { \\ if( WheelPos < 85) { \\ return strip. Color(WheelPos * 3, 255 - WheelPos * 3, 0); \\ } else if(WheelPos < 170) { \\ WheelPos -= 85; \\ return strip. Color(255 - WheelPos * 3, 0, WheelPos * 3); \\ } else { \\ WheelPos -= 170; \\ return strip. Color(0, WheelPos * 3, 255 - WheelPos * 3); \\ } \\ } Then, sew the circuit this way. Edit ====== Circuit: ====== {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/dibujo2.jpg?nolink&800x209|dibujo2.jpg}} {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/dibujo3.png?nolink&660x210}} {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/img_8139.jpg?nolink&600x800|img_8139.jpg}} Finish making the belt. To have the battery on hand and thus be able to turn on and off the belt, make a small cut on the fabric so that the battery is on the inside of the belt. Fold it in half and machine sew. Sew textile clasps at the ends to be able to close our belt. {{http://wiki.textile-academy.org/_media/fabricademy2017/students/anamaria.martinlopez/week_12/dibujo3_2.png?nolink&500x267}} Video: {{youtube>--DRFhbo86E?medium}}