10. E-Textiles and Wearables II

This week we went deeper into eletronics and wearables, adding ATtiny microcontroller and different acutators in the game. The main guide for the experiments was Lisa's presentation.

ATtiny

Attiny is a microcontroller that has fewer options then Arduino but being smaller can be attached to garments or accessories. For the ATtiny you need an intermediate between the microcontroller and the computer. You can use the Arduino or a AVR programmer.

In our case we are using the ATtiny85 and will use the Arduino Genuino Uno as a intermediate

How to use the Arduino into a programmer - ARDUINO SOFTWARE

  1. Open the Arduino program
  2. File> Examples> 11.ArduinoISP > ArduinoISP (In System Programmer)
  3. Tools > Board > Arduino Uno
  4. Tools > Port > select the usb port that you connected the Arduino
  5. Upload the sketch

Connecting the ATtiny to the programmer - ARDUINO SOFTWARE

step by step link

All of these steps are only done the first time you are using the microcrontoller (and only one time to load the ATtiny into your software)

  1. Install the ATtiny to your Arduino software (follow steps in here)
  2. Tools > Boards > ATtiny 25/45/85
  3. Tools > Processor > ATtiny 85
  4. Tools > Clock > Internal 8Hz (You need to set up the clock inside the controller and the frequency the controller will be working - when you buy a ATtiny the clock is empty, so is up to you to decide the best option for your clock)
  5. Tools > Programmer > Arduino As ISP
  6. Tools > Burn Bootloader

Tools setup in Arduino software - in portuguese tools-setup

Connect the ATtiny to Arduino - HARDWARE

The ATtiny has a direction based on the little circle it has engraved, that part is up. PINS

Then each pin follows the scheme below. The blue pins are for Digital control, if you are using an analog device, then you can only use the PWM pins, the A1, A2 and A3 are to read Analog sensor.

Using the specific pins to connect the ATtiny to Arduino following the connections from this link

Arduino Uno - ATtiny85

5V – Vcc | Gnd – Gnd | Pin 13 – Pin 2 | Pin 12 – Pin 1 | Pin 11 – Pin 0 | Pin 10 – Reset

Coding for ATtiny

Coding for ATtiny is bascially the same for Arduino, this week we were challenge to experiment a bit more into the logics of coding. To help out in this process a very usefull link is this arduino language list

arduino-ATtiny

  • We wrote a code to blink the led. Is important to know that Arduino program shows you in color code to show different commands.

Writing comments starts with // ... or / ... /

code-ex

arduino-ATtiny-LED

If you want to have not a 0 or 1 instruction, you need an analog command. In this case we want the led to shine at the middle of it's full light.

So to use an analog command, we need to change the pin that the LED is connected in ATtiny, from 3 to 0.

analog-skecth

We will now use a Smart LED = Neopixels, they have a microcontroller inside which allows them to be connected in only one pin and work in a series.

Need to include in the library the Neopixel. Then you run a test to check if the circuit is fine.

  • Sketch > Include library > Manage Library > Adafruit Neopixel
  • File > Examples > Adafruit Neopixel > strandtest
  • Upload the sketch

neopixel-circuit

Knowing that the circuit is fine, you can write your code.

Arduino back as Arduino (not as programmer)

In case you want to use the Arudino back as it was before ATtiny, you need to select in Tools > Boards and Processor Arduino and also Programmer: AVRISP mkII arduino

Actuator

An actuator is a component of a circuit that moves or controls another part based on input.

wiki Electromagnetism

Speakers and motors uses the electromagnetic field to function. To use it you need to concetrate the force of the magnetic field to make it strong enough to make things like a motor works.

Flip dots - Motion

With a lab porwer supply or bench supply, we set up the voltage to 5V and the max current to 1 A. And with a copper wire rolled up, ** COIL**, you can turn on the machine and the copper wire immediattely pulls or repels the magnet.

You dont want something that consumes more then 1 A on a wearable device.

Arduino cannot supply a circuit like this because it has curretn limitations, from the input/output pins the max is 20mA and from the 5V pin the max is 500mA. But you can use the Arduino to program it.

Speaker - Sound

The magnetic field moves the cone and the vibration creates the sound. You need an amplifier to amplify the sound waver coming out from your source.

speakerAMP

DFPlayer Mini

Heating elements

If you wanna use a thermosensitive material, the only thing you need is to generate heat. The current is what generates the heat, so working with resistance is how you control the heat generation.

So what you need to make sure is that you can control and play with the heating source the amount nedeed for your project.

Shape memory alloys - SMA

We tested with Smartwire by turning on with 9V and a current limitation of .150 A. If we would connect this to another power source then the lab power supply, the current would be higher then needed, so ideally for .180 A you would need 7 V.

high power led

Its a very strong light, that works with 3V and consumes ~.200A. I usually comes in a little metal plate to dissipate the heat.

powerled

Transistor

There are many different types of transistors, the one we are using is called MOSFET it can be N-Channel or P-Channel. We go with the N-Channel. It has three legs that are G gate, D drain and S source.

You need to check online based on the transistor you have the datasheet for that one.

data sheet ex

The transistor works like a switch in the circuit to allow or not the current to flow, so the LOAD (motor, coil, led..) can work or not.

wiki

MOSFET PICTURE

Vibrating motor

We have one from the Rotor amsterdam shop specifications : 1,5 to 3V, would consume 0.1A.

attiny-device

I followed this link for building the circuit, (https://www.precisionmicrodrives.com/content/how-to-drive-a-vibration-motor-with-arduino-and-genuino/)

vibration-motor-circuit-ex

motor-schematic

motor-device-front

motor-device-back

heatnbond

thermochromic

swatches