Introduction: Light Sensitive E-textile Bag
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.
Step 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.
If the S4A firmware was successfully uploaded into the Arduino board, the “searching board…” message should disappear in a few seconds.
Step 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
Step 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.
3 years ago
This tutorial has been produced as part of the iTech project, co-financed by the Erasmus + programme of the European Union. Project n°: 2017-1-FR02-KA205-012764
The content of this publication does not reflect the official opinion of the European
Union. Responsibility for the information and views expressed therein lies entirely with
3 years ago
A romanian version of this tutorial is available here
Une version de ce tutoriel en français est disponible ici