Light sensitive e-textile bag

Auteur avatarDigijeunes | Dernière modification 9/12/2019 par Clementflipo

Light sensitive e-textile bag 7.PNG
In this tutorial you will learn how to set up the e-textile bag to create a smart object that reacts to the amount of light recorded by an ambient light sensor.
Difficulté
Moyen
Durée
2 heure(s)
Catégories
Vêtement & Accessoire, Électronique, Recyclage & Upcycling
Coût
30 EUR (€)
Autres langues :
English
Licence : Attribution (CC BY)

Introduction

In this tutorial you will learn how to set up the e-textile bag to create a smart object that reacts to the amount of light recorded by an ambient light sensor.

Matériaux

- e-textile bag (see tutorial here)

- light sensor

Outils

- soldering iron

- needle and thread

- computer with Arduino IDE installed

Étape 1 - Prepare the arduino board

We will be using S4A to program the board. Therefore, we need to first set up our Arduino adequately.

Download the S4A software by reaching S4A and then clicking on “Downloads” > Choose the correct version based upon your operating system.

Afterwards, download the S4A firmware by reaching this link > Right-click > Save as > Remove the .txt part of the name > Save as type: Change from “Text Document” to “All Files” > Save.

Upload the S4A firmware

You will also need to use Arduino IDE to code and upload the firmware onto your Arduino Leonardo board.

Download the software by visiting Arduino IDE > Scroll down until you see the “Download the Arduino IDE” section and choose the version based upon your operating system (e.g. If you have Windows 7, choose “Windows Installer” / if you have Windows 10, choose “Windows app”) > On the next page choose “Just download” and run the installation files.

Launch Arduino IDE and open the S4A firmware by going to File > Open or by pressing Ctrl+O and then browsing to the location you previously saved the firmware to.

Connect the Arduino to your computer.

Select Arduino Leonardo from Tools menu > Board.

Select the correct port from the Tools menu > Port.

Upload the S4A firmware into it by using the right arrow (→) button at the top right corner of the window, by choosing Sketch > Upload or by pressing Ctrl+U on the keyboard.

Launch S4A

If the S4A firmware was successfully uploaded into the Arduino board, the “searching board…” message should disappear in a few seconds.


Étape 2 - Wire the sensor and actuator

You will need to connect the ambient light sensor and the LED patches to the Arduino board. The ambient light sensor patch has 3 cables deriving from it, whereas the LED patch has two cables.

The positive side of the ambient light sensor goes to 5V.

The negative side goes to GND. You can use either of the 3 GND pins available on the board.

If you are not sure which one of the ambient light sensor legs is positive, just attempt to connect either to pin 5V and the other one to GND. If that doesn’t work, try the reverse.

Finally connect the remaining cable of the ambient light sensor patch to A0.

The negative side of the LED goes to GND and the positive one to a digital pin (ex. 13).

In the end it should look like this:

  • white cable - A0
  • green cable - 5V
  • blue cable - GND
  • orange cable - 13
  • black cable - GND


Étape 3 - Program the Arduino

We want to program the Arduino board so that the ambient light sensor interacts with the LED.

Take notice of how the value of A0 changes based on fluctuations in the amount of light.

In our example, A5 (i.e. Analog pin 5, which is where we connected the ambient light sensor), displays a value around 30 when no artificial light is pointed at it.

Whereas if we point a smartphone torch at the ambient light sensor, the value drops down to around 10.

Once you’ve understood how the ambient light sensor reacts to changes in the amount of light, you are ready to program the Arduino so that, whenever the ambient light sensor records a value higher than 15 (in our example), the LED patch will turn on, otherwise the LED patch will stay off.


Notes et références

This tutorial has been developed as part of the #iTech project, co-financed by the Erasmus + Programme of the European Union.

For more details, contact info@digijeunes.com

Commentaires

Published