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 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¶
- Open the Arduino program
- File> Examples> 11.ArduinoISP > ArduinoISP (In System Programmer)
- Tools > Board > Arduino Uno
- Tools > Port > select the usb port that you connected the Arduino
- Upload the sketch
Connecting the ATtiny to the programmer - ARDUINO SOFTWARE¶
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)
- Install the ATtiny to your Arduino software (follow steps in here)
- Tools > Boards > ATtiny 25/45/85
- Tools > Processor > ATtiny 85
- 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)
- Tools > Programmer > Arduino As ISP
- Tools > Burn Bootloader
Tools setup in Arduino software - in portuguese
Connect the ATtiny to Arduino - HARDWARE¶
The ATtiny has a direction based on the little circle it has engraved, that part is up.
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
- 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 / ... /
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.
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
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
An actuator is a component of a circuit that moves or controls another part based on input.
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.
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.
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.
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.
We have one from the Rotor amsterdam shop specifications : 1,5 to 3V, would consume 0.1A.
I followed this link for building the circuit, (https://www.precisionmicrodrives.com/content/how-to-drive-a-vibration-motor-with-arduino-and-genuino/)