Interaction/Media/Design Student at the Royal Academy of Art in The Hague Here begins a big learning process - this Blog presents the step from the unknown to the achieved
Don't wanna be here? Send us removal request.
Video
tumblr
Controlling a DC motor
(part of the assignment 2 of the 2nd semester)
0 notes
Video
tumblr
Control high power LED with Mosfet
(video related to assignment 2 of the 2nd semester)
0 notes
Text
The difference between the variables ‘int’ and ‘long’
Width - int is 32 bit, and long is 64 bits.
The types int and long, when counted in bytes instead of bits the type int is 4 bytes and the type long, is just twice if type int i.e. 8 bytes.
In Java, the range of type int is from –2,147,483,648 to 2,147,483,647 whereas, the range of type long is from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 which is very much greater than type int.
The keyword used to declare a variable of the type int is “int”. On the other hand, the keyword used to declare the variable of type long is “long”.
Generally, the memory required to hold the value of type int is less as compared to long.
0 notes
Text
Preparing the greenhouse

The boxes, the water pumps and the fan at the spot where the future greenhouse will be



First tryout outside with an actual plant

Waterpump reacted to the data measured by the moisture sensor in the soil

Uploading to ThingSpeak and downloading the data

Making final adjustments before hanging it up
0 notes
Video
tumblr
The fan set up in front of the humidity sensor. Once the sensor measures a temperature higher or equal to 22 degrees, it turns on. The temperature measured below is not activating the fan.
0 notes
Video
tumblr
We put the humidity sensor in and out of the water, uploaded the link to ThingSpeak and downloaded on a different computer to read the state of the sensor on the serial monitor.
0 notes
Text
Group BioProp - Fan

End result: Fan is connected to NodeMCU in the box What you need: Fan, NodeMCU, Temperature sensor

Connecting the NodeMCU with the fan and testing the uploaded code (on/off function) to ThingSpeak

We also connected a temperature sensor to the NodeMCU. The sensor measures the temperature in the greenhouse and activates the fan if needed

Schematic
Code (incl. the code for the humidity sensor, the water pump and for the fan, uploading the data to ThingSpeak, downloading it on another device visualized through the serial monitor):
#include “ThingSpeak.h” #include “secret.h” #include <ESP8266WiFi.h>// WiFi variables char ssid[] = SECRET_SSID; char pass[] = SECRET_PASS;// TS variables long myChannel_ID = SECRET_CH_ID; char myReadAPIKey[] = SECRET_R_API_K; int FieldNumber_moisturedata = 1; int FieldNumber_tempdata = 5; int data_download = 0; int temp_download = 0;
int wait = 2000;int pumprelaypin = 14; int fanrelaypin = 2;WiFiClient client;void setup() { Serial.begin(9600); pinMode(pumprelaypin, OUTPUT); pinMode(fanrelaypin, OUTPUT); WiFi.mode(WIFI_STA); // IP adress in STAtic mode ThingSpeak.begin(client); }void loop() { if(WiFi.status() != WL_CONNECTED) { Serial.println(“Trying to connect”); while(WiFi.status() != WL_CONNECTED) { WiFi.begin(ssid, pass); Serial.println(“…”); delay(5000); } Serial.println(“CONNECTED”); }// Read data data_download = ThingSpeak.readLongField(myChannel_ID, FieldNumber_moisturedata, myReadAPIKey); temp_download = ThingSpeak.readLongField(myChannel_ID, FieldNumber_tempdata, myReadAPIKey); int statusCode = ThingSpeak.getLastReadStatus(); if (data_download >= 10000) { Serial.println(“Soil Dry, Activate Irrigation!”); Serial.println(data_download); digitalWrite(pumprelaypin, HIGH); } else { Serial.println(“Soil Wet, Deactivate Irrigation!”); Serial.println(data_download); digitalWrite(pumprelaypin, LOW); } if (temp_download >= 22) { //if the temperature is higher or exactly 22 the fan will be turned on Serial.println(“Greenhouse Hot, Activate Fan!”); Serial.println(temp_download); digitalWrite(fanrelaypin, HIGH); } else { Serial.println(“Greenhouse Cold, Deactivate Fan!”); Serial.println(temp_download); digitalWrite(fanrelaypin, LOW); } delay(wait); }
// secret.h // For storing private credentials
#define SECRET_SSID "KABK-Students" #define SECRET_PASS "kabk@air"
#define SECRET_CH_ID 741401 #define SECRET_R_API_K "DCF0F3VMW980222N"
0 notes
Text
Group BioProp - Automated water system

The end result: the water pumps packed with the NodeMCUs into boxes, ready to be taken into the garden

What you need: NodeMCU, Moisture sensor, an extension of NodeMCU for analogue pins

To avoid any contact with water, we passed the wires through holes and closed it up with tape

To ensure that the moisture sensor will be long enough to reach the plants in the greenhouse, we had to extend the wires. We first cut the wires, sold them together and added a shrink tubes (out of caoutchouc) part over it.

Serial Monitor downloading data of moisture and temperature sensors and stating it

Schematic Code:
#include "ThingSpeak.h" #include "secret.h" #include <ESP8266WiFi.h>// WiFi variables char ssid[] = SECRET_SSID; char pass[] = SECRET_PASS;// TS variables long myChannel_ID = SECRET_CH_ID; char myReadAPIKey[] = SECRET_R_API_K; int FieldNumber_moisturedata = 1; int FieldNumber_tempdata = 5; int data_download = 0; int temp_download = 0;
int wait = 2000;int pumprelaypin = 14; int fanrelaypin = 2;WiFiClient client;void setup() { Serial.begin(9600); pinMode(pumprelaypin, OUTPUT); pinMode(fanrelaypin, OUTPUT); WiFi.mode(WIFI_STA); // IP adress in STAtic mode ThingSpeak.begin(client); }void loop() { if(WiFi.status() != WL_CONNECTED) { Serial.println("Trying to connect"); while(WiFi.status() != WL_CONNECTED) { WiFi.begin(ssid, pass); Serial.println("..."); delay(5000); } Serial.println("CONNECTED"); }// Read data data_download = ThingSpeak.readLongField(myChannel_ID, FieldNumber_moisturedata, myReadAPIKey); temp_download = ThingSpeak.readLongField(myChannel_ID, FieldNumber_tempdata, myReadAPIKey); int statusCode = ThingSpeak.getLastReadStatus(); if (data_download >= 10000) { Serial.println("Soil Dry, Activate Irrigation!"); Serial.println(data_download); digitalWrite(pumprelaypin, HIGH); } else { Serial.println("Soil Wet, Deactivate Irrigation!"); Serial.println(data_download); digitalWrite(pumprelaypin, LOW); } if (temp_download >= 22) { Serial.println("Greenhouse Hot, Activate Fan!"); Serial.println(temp_download); digitalWrite(fanrelaypin, HIGH); } else { Serial.println("Greenhouse Cold, Deactivate Fan!"); Serial.println(temp_download); digitalWrite(fanrelaypin, LOW); } delay(wait); }

0 notes
Text
Group BioProp - A collaboration between the ‘Design For Life’ course and ‘Electronics’
Our group consist of Jeroen, Simbu, Xioayao and Gaetan. The electronics we will introduce into the garden will be for the greenhouse. Our goal is to install an automated water system and a fan to balance the temperature inside of it.

An overview (as a block diagram) of the installation we worked on
0 notes
Text
WiFi Access in the garden
Checking if there’s WiFi access in the area where the future greenhouse will be. Result: positive
The WiFi in the greenhouse will be used to monitor the humidity sensors and the water pump.

0 notes
Text
Upload & Download Data
We’re placing a distance sensor right next to the door to measure when a person is entering the room. The sensor is permanently sending data to ThingSpeak. At the same time, we’re sending the online located data to another computer to detect the presence of a person in the room.


What you need: Breadboard, wires, NodeMCU, distance sensor, USB cable
Schematic:


The values between 90-100 show nobody entered the room. The values below the latter numbers show a person passing in front of the sensor, therefore entering the room.
Codes: Code to measure data from the sensor, show it on the serial monitor and upload to ThingSpeak
#include <ESP8266WiFi.h> //Including library to use esp8266 #include "ThingSpeak.h" //Including library to send data to thingspeak #define TRIGGER 5 #define ECHO 4
float duration = 2.0; // float: for decimal number float distance = 2.0; //> those numbers (2) are uploaded on the channel, to do: connect data of the sensor to the channel
//WiFi credentials char ssid[] = "KABK-Students"; // your network SSID (name) char pass[] = "kabk@air"; // your network password
WiFiClient client;
//ThingSpeak credentials credentials unsigned long myChannelNumber = 767799 ; //your channel ID char myWriteAPIKey[] = "0U9U963C0F5DKNRK"; //"Write API" of your channel
//float temperature = distance; //data that I send to thingspeak, int wait = 5; // Time between two uplinks, set: 20000
void setup() {
Serial.begin(9600); Serial.println();
WiFi.begin(ssid, pass);
Serial.print("Connecting");
pinMode(TRIGGER, OUTPUT); //added from distance_code pinMode(ECHO, INPUT); pinMode(BUILTIN_LED, OUTPUT); //added from distance_code
while (WiFi.status() != WL_CONNECTED) { delay(50); Serial.print("."); }
Serial.println(); Serial.println("\nConnected.");
ThingSpeak.begin(client); //Initialize ThingSpeak
}
void loop() {
long duration, distance; //added from distance_code digitalWrite(TRIGGER, LOW); delayMicroseconds(2);
digitalWrite(TRIGGER, HIGH); delayMicroseconds(10);
digitalWrite(TRIGGER, LOW); duration = pulseIn(ECHO, HIGH); distance = (duration/2) / 29.1;
// set the ThingSpeak fields with the values ThingSpeak.setField(1, distance); //temperature = field 1 in channel / what you want to measure
// send uplink ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
// wait before the next measurment delay(wait);
Serial.print("Centimeter:"); Serial.println(distance); delay(1000); //added from distance_code
}
Code to download the data on ThingSpeak and show it on the serial monitor:
#include "ThingSpeak.h" #include <ESP8266WiFi.h> #include "secrets.h"
// wifi var
char ssid[] = SECRET_SSID; char pass[] = SECRET_PASS;
//thingspeak var
long myChannel_ID = SECRET_CH_ID; char myReadAPIKEY[] = SECRET_ReadAPIKEY;
int FieldNumber_data = 1; int data_download =0; int wait = 15000; WiFiClient client;
void setup() { Serial.begin (9600); WiFi.mode (WIFI_STA); ThingSpeak.begin(client);
}
void loop() {
if (WiFi.status() != WL_CONNECTED){ Serial.println("try to connect"); while (WiFi.status() != WL_CONNECTED){ WiFi.begin(ssid, pass ); Serial.println("..."); delay(5000); }
Serial.println("connected"); }
//read data
data_download = ThingSpeak.readLongField (myChannel_ID, FieldNumber_data, myReadAPIKEY); int statusCode = ThingSpeak.getLastReadStatus(); if (statusCode ==200 ){ Serial.println("it worked"); Serial.println(data_download);
}
delay(wait);
}
0 notes
Text
Control DC motor

What you need: Relay, crocodile clips, wires, DC motor

Schematic
Code:
First version: int pin (A0);
void setup() { pinMode(A0,OUTPUT); } void loop() { digitalWrite(A0,HIGH); }
Second version: int motor_pin = 14; void setup(){ pinMode(led_pin,OUTPUT); } void loop(){ digitalWrite(motor_pin, LOW);
delay(5000); digitalWrite(motor_pin, HIGH); delay(5000); }
0 notes
Video
tumblr
Control high power LED with the help of a Relay

What you need: wires, 3x crocodiles clips, relay
Code: int pwm = 15;
void setup() { pinMode (pwm, OUTPUT);
} void loop() { digitalWrite (pwm,HIGH); }
Control high power LED with the help of a Mosfet
Video: Up in the blog, one of the last posts
Code:
const int led_pin = 5;
void setup() { //open serial communication witht the computer Serial.begin(9600); pinMode(led_pin, OUTPUT);
} Void loop() { for (int i= 0; i<= 255; i = i +1){ analogWrite(led_pin, i); delay(10); } }
0 notes
Text
Distance Sensor - in the kitchen
Using Node MCU and uploading the data to my ThingSpeak channel

Distance sensor placed in the kitchen
Data sent from Node MCU to my ThingSpeak channel - Pictures shows: time slot of 3 hours
Value 269 shows no object is being detected by the sensor
Value 91 shows no object is being detected by the sensor

What you need: Node MCU, distance sensor, wires, 2x resistor (10k + 20k)

Schematic
Code (combination between nodemcu_distance & nodemcu_uplink) :
#include <ESP8266WiFi.h> //Including library to use esp8266 #include "ThingSpeak.h" //Including library to send data to thingspeak #define TRIGGER 5 #define ECHO 4float duration = 2.0; // float: for decimal number float distance = 2.0; //> those numbers (2) are uploaded on the channel, to do: connect data of the sensor to the channel //WiFi credentials char ssid[] = "Wagstr185"; // your network SSID (name) char pass[] = "xxxxxx"; // your network passwordWiFiClient client;//ThingSpeak credentials credentials unsigned long myChannelNumber = 741407 ; //your channel ID char myWriteAPIKey[] = "0HK567OW3YVTFQ7F"; //"Write API" of your channel//float temperature = distance; //data that I send to thingspeak, int wait = 20; // Time between two uplinks, set: 20000void setup() { Serial.begin(9600); Serial.println(); WiFi.begin(ssid, pass); Serial.print("Connecting"); pinMode(TRIGGER, OUTPUT); //added from distance_code pinMode(ECHO, INPUT); pinMode(BUILTIN_LED, OUTPUT); //added from distance_code while (WiFi.status() != WL_CONNECTED) { delay(50); Serial.print("."); } Serial.println(); Serial.println("\nConnected."); ThingSpeak.begin(client); //Initialize ThingSpeak}void loop() { long duration, distance; //added from distance_code digitalWrite(TRIGGER, LOW); delayMicroseconds(2); digitalWrite(TRIGGER, HIGH); delayMicroseconds(10); digitalWrite(TRIGGER, LOW); duration = pulseIn(ECHO, HIGH); distance = (duration/2) / 29.1; // set the ThingSpeak fields with the values ThingSpeak.setField(1, distance); //temperature = field 1 in channel / what you want to measure // send uplink ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey); // wait before the next measurment delay(wait); Serial.print("Centimeter:"); Serial.println(distance); delay(1000); //added from distance_code}
0 notes
Video
tumblr
PLANT PRIVACY is a project that helps humans and plants at the same time. Plants can maintain their comfortable spot in the sun while humans can learn to respect the personal space of the plant.
0 notes
Text
An interactive plant!
‘Make it interactive’ is the name of the semester project in which we have to transform an object that originally is not interactive and make it into one.
Materials we are using: LDR Sensor, buzzer, wires, Arduino Uno, wooden stick
To transform the plant into an interactive object our group added an LDR sensor to it which will detect the lightness around the plant. The LDR Sensor, through the Arduino, is connected to a buzzer. The output of the buzzer is a melody of Sandstorm (from Darude) at a normal speed. Every time the sensor detects a shadow over the plant, meaning less light shining on it, the melody will speed up. As darker it gets around the plant, as faster will play the melody.


The plant we will be using for the project

What you need: Arduino Uno, LDR Sensor (light dependent resistor), piezo buzzer, wires (7x), resistor (220Ω)

Schematic
Code:
/* Speaker on port 8 */ #include "pitches.h" >pitches.h includes the notes of the melody
// notes in the melody:
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int shortTone = 80; int longTone = 200; int standardDelay = 50; int delayBetweenBars = 50;
int sensorpin = A1; int sensorvalue = 0; int sensorMin = 1023; // minimum sensor value int sensorMax = 0; // maximum sensor value
void setup() { pinMode(sensorpin, INPUT); pinMode(13, OUTPUT); Serial.begin(9600);
digitalWrite(13, HIGH);
// calibrate during the first five seconds >during the first 5 sec after uploading the code, a calibration will detect the lowest and highest value of light. Those value will be read by the LDR Sensor later on while (millis() < 5000) { sensorvalue = analogRead(sensorpin);
// record the maximum sensor value if (sensorvalue > sensorMax) { sensorMax = sensorvalue; }
// record the minimum sensor value if (sensorvalue < sensorMin) { sensorMin = sensorvalue; } }
Serial.println("stop cal"); // signal the end of the calibration period digitalWrite(13, LOW); }
void loop() { > the melody will repeat over and over again shortTone = analogRead(sensorpin);
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_B3, shortTone); >melody starts to play delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, longTone); delay(longTone); noTone(8); delay(delayBetweenBars);
shortTone = analogRead(sensorpin); >callibration calculates (maps) again the values to detect if there are any changes while melody is playing
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8,NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, longTone); delay(longTone); noTone(8); delay(standardDelay);
shortTone = analogRead(sensorpin);
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_E4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8,NOTE_E4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_E4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_E4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_E4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_E4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_E4, longTone); delay(longTone); noTone(8); delay(standardDelay);
shortTone = analogRead(sensorpin);
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_D4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8,NOTE_D4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_D4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_D4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_D4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_D4, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_D4, longTone); delay(longTone); noTone(8); delay(standardDelay);
shortTone = analogRead(sensorpin);
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_A3, longTone); delay(longTone); noTone(8); delay(standardDelay);
tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, longTone); delay(longTone); noTone(8); delay(delayBetweenBars);
shortTone = analogRead(sensorpin);
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8,NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, longTone); delay(longTone); noTone(8); delay(standardDelay);
shortTone = analogRead(sensorpin);
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_E4, longTone); delay(longTone); noTone(8); delay(standardDelay);
tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, longTone); delay(longTone); noTone(8); delay(delayBetweenBars);
shortTone = analogRead(sensorpin);
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8,NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, shortTone); delay(shortTone); noTone(8); delay(standardDelay); tone(8, NOTE_B3, longTone); delay(longTone); noTone(8); delay(standardDelay);
shortTone = analogRead(sensorpin);
shortTone = map(shortTone, sensorMin, sensorMax, 5, 100); shortTone = constrain(shortTone, 10, 200);
longTone = shortTone+120;
Serial.println(shortTone);
tone(8, NOTE_E4, longTone); delay(longTone); noTone(8); delay(standardDelay);
}
The project still in progress Upcoming: schematic of the circuit, more pictures and videos
0 notes