---
title: ROCA_Hacking spaces_IoT
description: sdsd
Autors: Future Learning Unit
---
###### tags: `ROCA` `Learning Experiences`
[TOC]
<!--
## INITIAL INFO
>An immersive capsule where the students will be able to know, observe and experience with different technologies and toolsof digital manufacturing, used in the Fab Lab's network to prototype (almost) everything, low cost and very fast.
>The objective of the activity is to involve students in the manufacturing process of a IoT (internet of Things) prototype, so that they get a general look at these technologies of manufacturing, and mainly understand the technical possibilities that each one provides, what materials can be used, the design processes and associated times.
References:
- [Doc Code Lab](https://hackmd.io/s/SJTqlg9pQ)
- [Tutorial](https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/)
## Setup Raspberry Pi
1. Install Raspberry Pi OS ( No password)
3. Wi-FI
4. Install Arduino
IFTTT Library
ESP8266 boards
## Schedule
- (35min) Presentació Guest speaker
- (25min) Tour
- (15min) Intro dinámica
- Explicación reto
- Enumerar materiales y tecnologia
- Explicar tiempos de las fases
- (15min) Demo electronica
- Explicar como funciona IFTTT
- Que sensores tenemos (coger)
- (30min) Ideación
- Buscar dos elementos en la casa para conectarlos
- Jam session
- (90min) Prototipado
- Division de equipos
- Prototipo carton
- Diseño CAD
- CAM
- (30min) Presentacion:
- 5 minuts por grupo = 25min
- 5 min feedback o clausura
## Circuits
1. Input: Button Output: LED + IFTTT
*[Instructable Reference](https://www.instructables.com/id/Control-LED-Using-PushButton-With-NodeMCU/)*
-->
<iframe src="https://docs.google.com/presentation/d/e/2PACX-1vSC2xphBP-bdZO5NJ4f05p-Xa1Ngck44xwgel9fnkkw2TgxpGskheAc78EZowvTtuPO7ilHWd9Haw8I/embed?start=false&loop=false&delayms=3000" frameborder="0" width="720" height="435" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
## What's IoT ?
[The Internet of things (IoT)](https://en.wikipedia.org/wiki/Internet_of_things) is the extension of Internet connectivity into physical devices and everyday objects. Embedded with electronics, Internet connectivity, and other forms of hardware (such as sensors), these devices can communicate and interact with others over the Internet, and they can be remotely monitored and controlled.
# FROM TRASH TO IOT

## CHALLENGE
**Re-Design, Re-Program and Re-conect any object into a IoT Object**
## OBJECTIVE
The objective of this learning activity is to involve students in the manufacturing process of a IoT (internet of Things) prototype, so that they get a general look at these technologies of manufacturing, and mainly understand the technical possibilities that each one provides, what materials can be used, the design processes and associated times.
## STEPS
### UNDERSTAND THE ELECTRONICS
**1. Identify all electronic components and note what they are (10').**
**HOW:** Use Google, ask your partner or ask your facilitator. ( in that order :-) )
*Some Keywords: resistor, breadboard, led, ldr sensor, moisture sensor, button, Nodemcu,jumpers, Arduino IDE*
**2. Connect all the components and test if it works (10')**
**HOW:** Use as a reference the schematic to connect all the components. Ask us if you have questions. ( See IoT Kits below )

**3. What does it do ?**
**HOW:** Describe in one sentence how it works/what it does.
### IDEATION
**1. Find in the lab materials / objects that can help you to create your IoT prototype(5')**
Some ideas: flower pot, boxes, cardboard, wood....

**2. Jam Session (25')**
Imagine 5 applications/ideas of IoT product depending of your electronics.
Some ideas: warning button, smart flower pot, light graph....

![Uploading file..._33ztmlaz9]()
### PROTOTYPING
Split the group in two and:
**1. Create a IFTTT recipe (see IFTTT recipe section below) (30')**
Be cool! IFFT have a lot of services! ( Twitter, Mail, Drive, Telegram, Phone calls...)

**2. Re-design your object for assembling the electronics (30')**
You can use 3D printing ( take time! ) and/ or laser cutter. Ask us for help.
**HOW:** If you know Rhino use one of our computers. If not ask us!

### COMMUNICATION
Imagine you want to sell your IoT product to a possible business angel.
Prepare your elevator pitch answering these questions:

## ELECTRONICS KITS
### IoT Kit BUTTON ( Team 1 and 3)
+ Input: Button - Connection **D2 pin**
+ Output: LED - Connection **D1 pin**
+ How is coded: Generates an event (Webhook request) when button is pressed. Led ON when event happens.
+ Schematic:

+ Code:
```
#include <IFTTTMaker.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
char ssid[] = "IAAC-WIFI"; // your network SSID (name)
char password[] = "enteriaac2013"; // your network key
#define KEY "pz7QWW54kFi8y4mrbEMvkLjUEkRb3vr1RvN8n5JcWG5" // Get it from this page https://ifttt.com/services/maker/settings
//#define EVENT_NAME "do_action1" // Name of your event name, set when you are creating the applet
#define EVENT_NAME "do_action3"
int led = 5; // LED pin
int button = 4; // push button is connected
int temp = 0; // temporary variable for reading the button pin status
IPAddress ip;
WiFiClientSecure client;
IFTTTMaker ifttt(KEY, client);
void setup() {
pinMode(led, OUTPUT); // declare LED as output
pinMode(button, INPUT); // declare push button as input
Serial.begin(115200);
// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
ip = WiFi.localIP();
Serial.println(ip);
}
void loop() {
temp = digitalRead(button);
if (temp == HIGH) {
digitalWrite(led, HIGH);
Serial.println("LED Turned ON");
//triggerEvent takes an Event Name and then you can optional pass in up to 3 extra Strings
if(ifttt.triggerEvent(EVENT_NAME,"Param1")){
Serial.println("Successfully sent");
} else
{
Serial.println("Failed!");
}
delay(1000);
}
else {
digitalWrite(led, LOW);
Serial.println("LED Turned OFF");
delay(1000);
}
}
```
### IoT Kit LDR ( Team 2 and 4)
*A photoresistor (or light-dependent resistor, LDR, or photo-conductive cell) is a light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity; in other words, it exhibits photoconductivity. ... A photoresistor is made of a high resistance semiconductor.*
+ Input: LDR sensor - Connection **A0 pin**
+ Output: LED - Connection **D4 pin**
+ How is coded: Webhook request and send sensor value every 10 seconds. Led ON when request happens.
+ Schematic:

+ Code:
```
#include <WiFiClientSecure.h>
char ssid[] = "IAAC-WIFI"; // your network SSID (name)
char password[] = "enteriaac2013"; // your network key
#define KEY "pz7QWW54kFi8y4mrbEMvkLjUEkRb3vr1RvN8n5JcWG5" // Get it from this page https://ifttt.com/services/maker/settings
#define EVENT_NAME "do_action4"
int led = 2; // LED pin D4
int temp = 0; // temporary variable for reading the button pin status
IPAddress ip;
WiFiClientSecure client;
IFTTTMaker ifttt(KEY, client);
void setup() {
pinMode(led, OUTPUT); // declare LED as output
pinMode(A0, INPUT);
Serial.begin(115200);
// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
ip = WiFi.localIP();
Serial.println(ip);
}
void loop() {
digitalWrite(led, LOW);
int sensorValue = analogRead(A0); // read the input on analog pin 0
float voltage = sensorValue * (5.0 / 1023.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V)
Serial.println(voltage);
if(ifttt.triggerEvent(EVENT_NAME,String(voltage))){
digitalWrite(led, HIGH);
Serial.println("Successfully sent");
} else
{
Serial.println("Failed!");
}
delay(10000);
}
```
### IoT Kit Soil Moisture Sensor ( Team 5 )
*Soil moisture sensors measure the volumetric water content in soil.*
+ Input: LDR sensor - Connection **A0 pin**
+ Output: LED - Connection **D4 pin**
+ How is coded: Webhook request when it's not humid and wait 1 minute to check again sensor status.
+ Schematic:

+ Code:
```
#include <IFTTTMaker.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
char ssid[] = "IAAC-WIFI"; // your network SSID (name)
char password[] = "enteriaac2013"; // your network key
#define KEY "pz7QWW54kFi8y4mrbEMvkLjUEkRb3vr1RvN8n5JcWG5" // Get it from this page https://ifttt.com/services/maker/settings
#define EVENT_NAME "do_action5"
int led = 2; // LED pin D4
int temp = 0; // temporary variable for reading the button pin status
IPAddress ip;
WiFiClientSecure client;
IFTTTMaker ifttt(KEY, client);
void setup() {
pinMode(led, OUTPUT); // declare LED as output
pinMode(A0, INPUT); // declare push button as input
Serial.begin(115200);
// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
ip = WiFi.localIP();
Serial.println(ip);
}
void loop() {
int sensorValue = analogRead(A0); // read the input on analog pin 0
Serial.println(sensorValue);
if(sensorValue>800){
if(ifttt.triggerEvent(EVENT_NAME,String(sensorValue))){
digitalWrite(led, HIGH);
Serial.println("Successfully sent");
delay(3000);
digitalWrite(led, LOW);
} else
{
Serial.println("Failed!");
}
delay(60000);
}else{
delay(1000);
}
}
```
## HELP
### General Accounts (all teams)
- Gmail: fablabbcn.team1@gmail.com // flufluflu3
- [IFTT](https://ifttt.com/session/new?wp_=1)
- IMPORTANT: Download IFTTT app in your mobile phone
- Step 1: Continue with Google
- Step 2: Use gmail information
- [Twitter](https://twitter.com/FablabbcnT):
- User: fablabbcn_team1
- @FablabbcnT
### How to do a IFTTT recipe ?
**1. Open the IFTTT App**
**2. Add New Applet**

**3. Press +this and select "webhooks" service**


**4. Select trigger: Receive a web request**

**5. Complete trigger with Event Name: do_action1**
+ IFTTT Event name (In recipe - Webhook service):
+ Team 1: "do_action1"
+ Team 2: "do_action2"
+ Team 3: "do_action3"
+ Team 4: "do_action4"
+ Team 5: "do_action5"

**6. Press +that**

**7. Select action service**

**8. Complete service information**


**9. Finish applet**

**10. Check it's ready (green light)**

# FROM TRASH TO IOT WITH ...
## LUND UNIVERSITY
[Lund University](https://www.lunduniversity.lu.se/) was founded in 1666 and is ranked among the world’s top 100 universities. The University has 40,000 students and 7,600 staff based in Lund, Helsingborg and Malmö. We are united in our efforts to understand, explain and improve our world and the human condition.
[@lunduniversity](https://twitter.com/lunduniversity)
### Participants
(25) Lund University, School of Architecture, design studio students.
### Program
**(1) Inspiring talk**. Duration: 1h.
A guest speaker will introduce your group of 25 students into the Fab Lab's world.
**(2) Ideation**. Duration: 1h.
Two teachers will guide the students through an ideation process. The students will be divided.
into groups of 5 members each. Each group of 5 students will generate one idea to be.
prototyped.
**(3) Prototyping**. Duration: 1h 30min.
Digital fabrication (3D and Laser). Each team will prototype their idea. (5 prototypes).
**(4) Final presentation**. Duration: 30 min.
Each team will present and share their idea and prototype.
### Learning Experience in pictures




## OMNIA TRAVEL
### The Subject
Taking into consideration the interests of Omnia Travel, Fab Lab Barcelona proposes the development of a short immersive learning experience with the following features:
An immersive capsule where the participants will be able to experience **the cycle of materials** from the point of view of the FabCity concept, a new urban model of transforming and shaping cities that shifts how they source and use materials from **‘Products In Trash Out’ (PITO)** to **‘Data In Data Out’ (DIDO)**. This means that more production occurs inside the city, along with recycling materials and meeting local needs through local inventiveness.


### Objective
The objective of the activity is to involve participants in the manufacturing process of a **IoT (Internet Of Things) prototype**, so that they get a general look at these technologies of manufacturing, and mainly understand the technical possibilities that each one provides, what materials can be used, the design processes and associated times.
### TO DO
- Define the prompt - Challenge
- Jam Session
- Step by Step doc for IFTTT
- System Inputs -> Process -> Outputs
- How to visualize the data ? IFTT -> Events AR -> Data
AR exambple by Xavi: https://thimbleprojects.org/xavidominguez/687324/
<!--
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.6.0/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<a-scene embedded arjs='sourceType: webcam;'>
<a-box position='0 0.5 0' material='opacity: 0.9;'></a-box>
<a-marker-camera preset='hiro'></a-marker-camera>
</a-scene>
</body>
-->