wieselectronics
wieselectronics
WIES ELECTRONICS
20 posts
Don't wanna be here? Send us removal request.
wieselectronics · 6 years ago
Text
s2 ex1
Distinct sensor, send data 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 //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 = 771305; //your channel ID char myWriteAPIKey[] = "I63TDIQ3D09Q8DTX"; //"Write API" of your channel float distance = 0;  //data that I sendf to thingspeak int wait = 2000; // Time between two uplinks void setup() {  Serial.begin(9600);  Serial.println();  WiFi.begin(ssid, pass);  Serial.print("Connecting");      while (WiFi.status() != WL_CONNECTED)    {      delay(500);      Serial.print(".");      }        Serial.println();    Serial.println("\nConnected.");      ThingSpeak.begin(client);  //Initialize ThingSpeak } void loop() {  long duration, distance;  digitalWrite(TRIGGER, LOW);    delayMicroseconds(2);    digitalWrite(TRIGGER, HIGH);  delayMicroseconds(10);    digitalWrite(TRIGGER, LOW);  duration = pulseIn(ECHO, HIGH);  distance = (duration/2) / 29.1;    Serial.print("Centimeter:");  Serial.println(distance);  delay(1000);  // set the ThingSpeak fields with the values  ThingSpeak.setField(1, distance);  // send uplink  ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);  // wait before the next measurment  delay(wait); }
Tumblr media Tumblr media Tumblr media
0 notes
wieselectronics · 6 years ago
Text
BICYCLE BLENDER
With my group we decided to make a bicycle blender. Emma already thought through that we could use a dynamo to provide energy to charge a battery.
We started searching online and finally we came up with the idea to use a blender. That is where the bicycle blender was born. We started drawing the schematic and then we decided our group in two and we both had our own tasks.
The idea: The installation is made out of an old bike. The bicycle leans on a triangle shaped stand so you can generate energy and stay inside the garden. By cycling on the bike, the user will produce energy which will be used for the blender to make smoothies. There is a Dynamo next to the back wheel which will charge a battery, and this will make the blender work. The dynamo is also connected to a NodeMCU which provides us the opportunity to upload data to ThingSpeak. You’ll then be able to track if someone is cycling or cycled and how much the battery is charged.
Me and Sarah worked on the dynamo, we tried to work very secure, and it was really interesting and fun to make, but we made mistakes which we couldn’t fix that easy.
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
0 notes
wieselectronics · 6 years ago
Text
THINGSPEAK ex2, person A&B
A
#include <ThingSpeak.h>
#include ‘’thingSpeak.h’’
#include <ESP8266WiFi.h>
#include ‘’secret.h’’
char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;
long myChannel_ID = SECRET_CH_ID;
char myWriteAPIkey[] = SECRET_WriteAPIkey;
int data_download = 0;
int wait = 3000;
int val;
int LDRpin = A0;
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 (3000);
}
delay(1000);
delay(1000);
Serial.println(‘’Connected’’);
//write data
int FieldNumber_data = analogRead(LDRpin); //Read Analog values and store in val variable
Serial.print(val); //Print on Serial Monitor
data_download= ThingSpeak.writeField(myChannel_ID, 1, FieldNumber_data, myWriteAPIkey);
delay(wait);
}
}
B
#include <ThingSpeak.h>
#include ‘’thingSpeak.h’’
#include <ESP8266WiFi.h>
#include ‘’secret.h’’
char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;
long myChannel_ID = SECRET_CH_ID;
char myWriteAPIkey[] = SECRET_WriteAPIkey;
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 (6000);
}
Serial.println(‘’Connected’’);
}
//Read data
data_download= ThingSpeak.readLongField(myChannel_ID, FieldNumber_data, myReadAPIkey);
Serial.println(‘’Connected);
}
//Read data
data_download= ThingSpeak.readLongField(myChannel_ID, FieldBumber_data, myReadAPIkey);
int StatusCode= ThingSpeak.getLastReadStatus();
if(statusCode == 200){
Serial.println(‘’it worked’’);
Serial.println(data_download);
}
delay(wait);
}
Tumblr media Tumblr media Tumblr media
0 notes
wieselectronics · 6 years ago
Video
tumblr
CUSTOM CHARACTERS
/* * * Wies Mobachi, Nov 2018 *   * custom_char sketch * creates and use custom characters */ #include <Wire.h> #include <LiquidCrystal_I2C.h> uint8_t bell[8]  = {0x4, 0xe, 0xe, 0xe, 0x1f, 0x0, 0x4}; uint8_t note[8]  = {0x2, 0x3, 0x2, 0xe, 0x1e, 0xc, 0x0}; uint8_t clock[8] = {0x0, 0xe, 0x15, 0x17, 0x11, 0xe, 0x0}; uint8_t heart[8] = {0x0, 0xa, 0x1f, 0x1f, 0xe, 0x4, 0x0}; uint8_t duck[8]  = {0x0, 0xc, 0x1d, 0xf, 0xf, 0x6, 0x0}; uint8_t check[8] = {0x0, 0x1 ,0x3, 0x16, 0x1c, 0x8, 0x0}; uint8_t cross[8] = {0x0, 0x1b, 0xe, 0x4, 0xe, 0x1b, 0x0}; uint8_t retarrow[8] = {  0x1, 0x1, 0x5, 0x9, 0x1f, 0x8, 0x4}; // Set the LCD address to 0x27 for a 16 chars and 2 line display LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address void setup() {  lcd.begin(16,2);  lcd.backlight(); } void loop() {  lcd.home();  lcd.print(";P");  delay(2000);  lcd.clear();  lcd.print(":P");  delay(2000); }
0 notes
wieselectronics · 6 years ago
Text
LCD
Tumblr media
/* * Wies Mobach, Nov 2018 * * hello world sketch for LCD */ #include <Wire.h> #include <LiquidCrystal_I2C.h> // Set the LCD address to 0x3F for a 16 chars and 2 line display LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address void setup() {  // initialize the LCD  lcd.begin(16,2);    // Turn on the blacklight and print a message.  lcd.backlight(); } void loop() {  lcd.setCursor(0, 0);  lcd.print("mq4do e3llqbq53 ");  lcd.setCursor(0, 1);  lcd.print("wi3z m0bqafjhi");  delay(2000);    lcd.clear();  delay(1000);   }
0 notes
wieselectronics · 6 years ago
Text
NEOPIXEL
Tumblr media
#include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> #endif
#define PIN 6
// Parameter 1 = number of pixels in strip // Parameter 2 = Arduino pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: //   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) //   NEO_KHZ400  400 KHz (classic ‘v1’ (not v2) FLORA pixels, WS2811 drivers) //   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products) //   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) //   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products) Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across // pixel power leads, add 300 - 500 Ohm resistor on first pixel’s data input // and minimize distance between Arduino and first pixel.  Avoid connecting // on a live circuit…if you must, connect GND first.
void setup() { // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket #if defined (__AVR_ATtiny85__)   if (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif // End of trinket special code
strip.begin(); strip.show(); // Initialize all pixels to 'off’ }
void loop() { rainbowCycle(10); }
// Slightly different, this makes the rainbow equally distributed throughout void rainbowCycle(uint8_t wait) { uint16_t i, j;
for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel   for(i=0; i< strip.numPixels(); i++) {     strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));   }   strip.show();   delay(wait); } }
// Input a value 0 to 255 to get a color value. // The colours are a transition r - g - b - back to r. uint32_t Wheel(byte WheelPos) { WheelPos = 255 - WheelPos; if(WheelPos < 85) {   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); } if(WheelPos < 170) {   WheelPos -= 85;   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); } WheelPos -= 170; return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); }
1 note · View note
wieselectronics · 6 years ago
Video
tumblr
0 notes
wieselectronics · 6 years ago
Video
tumblr
0 notes
wieselectronics · 6 years ago
Text
MyMath
void setup() { // put your setup code here, to run once: Serial.begin(9600); }
void loop() { // put your main code here, to run repeatedly: int i = 2; int j = 3; int k;
k = myMultiply(i,j); Serial.println(k); delay(1000);
k = myAddition(i, j); Serial.println(k); delay(1000);
k = mySubtraction(i, j); Serial.println(k); delay(1000);
k = myDivision(i, j); Serial.println(k); delay(1000);
}
int myMultiply (int x, int y) { int result = x*y; return result; }
int myAddition (int x, int y) { int result = x + y; return result; }
int myDivision(int x, int y){ int result = x/y; return result; }
int mySubtraction(int x, int y){ int result = y - x; return result;
}
0 notes
wieselectronics · 6 years ago
Video
tumblr
Tumblr media
0 notes
wieselectronics · 6 years ago
Text
Final assignment: WHY NOISE?
With Marco 
For the final assignment we chose to make a butterfly with a sound sensor as the input. We want to use frequency to make different levels for the output. 
The first reaction of the butterfly will be slow movement. The second reaction of the butterfly will be lights and more movement. The third reaction of the butterfly will be sound and even more movement. 
---
After the sound sensor didn’t work we decided to use another sensor. 
We used the distant sensor (PIR). For the butterfly it was important that we also made a good base so it would be able to make the wings move. With two threads on the wings attached to the motor the wings were able to move up and down. We made a box where we put all the electronics inside and made it lay on top.
CODE
/*   * Butterfly - v0.2 * Marco Dell'Abate & Wies Mobach * */ // Servo library + declaration #include <Servo.h> Servo servo;   // Variables int servoPin = 3;            // Servo Pin int sensor = 2;              // PIR Sensor Pin int state = LOW;             // By default, no motion detected int val = 0;                 // Sensor status int pos = 0;                 // Servo position in degrees void setup() {  pinMode(sensor, INPUT);    // Initialize sensor as an input    servo.attach(servoPin);    Serial.begin(9600);        // initialize serial } void loop(){    val = digitalRead(sensor);   // read sensor value    servo.write(0);  if (val == HIGH) {           // check if the sensor is HIGH    //control the servo's speed  with delay    for (int count = 0; count < 200; count++) {           for (pos = 0; pos <= 90; pos += 1) { // goes from 0 degrees to 180 degrees     // in steps of 1 degree      servo.write(pos);              // tell servo to go to position in variable 'pos'      delay(2);                       // waits 2ms for the servo to reach the position     }         for (pos = 90; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees      servo.write(pos);              // tell servo to go to position in variable 'pos'      delay(2);                       // waits 15ms for the servo to reach the position     }          }        }    }
0 notes
wieselectronics · 6 years ago
Video
tumblr
0 notes
wieselectronics · 6 years ago
Video
tumblr
DICE
int buttonstatus = 0;
void setup () {
 pinMode(2, OUTPUT);
 pinMode(3, OUTPUT);
 pinMode(4, OUTPUT);
 pinMode(5, OUTPUT);
 pinMode(6, OUTPUT);
 pinMode(7, OUTPUT);
 pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop () {
if(digitalRead(A0)  == HIGH && buttonstatus == 0)  {
 buttonstatus = 1;
 int randomnumber = random(1, 7);
 if(randomnumber == 1){
   one();
 }
else if(randomnumber == 2){
 two();
}
else if(randomnumber == 3){
 three();
}
else if(randomnumber == 4){
 four();
}
else if(randomnumber == 5){
 five();
}
else if(randomnumber == 6){
 six();
}
 delay(3000);
 allOff();
 buttonstatus = 0;
}
 Serial.println(digitalRead(A0));
 delay(50);
}
void one() {
 digitalWrite(2, HIGH);
 digitalWrite(3, LOW);
 digitalWrite(4, LOW);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 digitalWrite(7, LOW);
}
void two() {
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, LOW);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 digitalWrite(7, LOW);
}
void three() {
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, HIGH);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 digitalWrite(7, LOW);
}
void four() {
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, HIGH);
 digitalWrite(5, HIGH);
 digitalWrite(6, LOW);
 digitalWrite(7, LOW);
}
void five() {
 digitalWrite(2, HIGH);
 digitalWrite(3, LOW);
 digitalWrite(4, LOW);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 digitalWrite(7, LOW);
}
void six() {
 digitalWrite(2, HIGH);
 digitalWrite(3, HIGH);
 digitalWrite(4, LOW);
 digitalWrite(5, HIGH);
 digitalWrite(6, HIGH);
 digitalWrite(7, HIGH);
}
void allOff() {
 digitalWrite(2, LOW);
 digitalWrite(3, LOW);
 digitalWrite(4, LOW);
 digitalWrite(5, LOW);
 digitalWrite(6, LOW);
 digitalWrite(7, LOW);
}
Tumblr media
0 notes
wieselectronics · 6 years ago
Video
tumblr
DICE
/**  DICE*  Wies Mobach*/
int leds[] = {1,2,3,4,5,6};int randNr = 0;
int ledsNr;
int btnState = 0;         
int lastBtnState = 1; 
int btnCounter = 0;   
    void setup() {
 for(ledsNr = 0; ledsNr < 7; ledsNr++) {                      
 // length returns the number of elements in the array 
pinMode(leds[ledsNr] ,OUTPUT);  }    
pinMode(8, INPUT); 
randomSeed(analogRead(A1));
}
void loop() {  
randNr= random(1,7);  
btnState = digitalRead(8);  if (btnState == 1 && btnState != lastBtnState) {    
btnCounter++;       
delay(50);  
}  if(btnCounter  == 1)
{    
for (ledsNr = 0; ledsNr < randNr; ledsNr++)
{      
digitalWrite(leds[ledsNr], 1);      
delay(50);    
}        
btnCounter = 2;  
}  if(btnCounter == 3)
{    for (ledsNr = 6; ledsNr >= 0; ledsNr--)
{      
digitalWrite(leds[ledsNr], 0);    
}    
delay(50);   
 btnCounter = 0;  
}
 lastBtnState = btnState; }
Tumblr media
0 notes
wieselectronics · 6 years ago
Video
tumblr
Changing led with potentiometer alternately. 
int mappedValue;
Int mappedValue;
void setup()
{
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop()
{
mappedValue = map(analogRead(A0), 0, 1023, 0, 255);
mappedValue2 = map(analogRead(A0), 0, 1023, 255, 0);
analogWrite(3, mappedValue);
analogWrite(5, mappedValue2);
}
0 notes
wieselectronics · 6 years ago
Video
tumblr
Lesson 2 exercise  1: Control leds with a potentiometer
CODE:
int pot_value = 0;
void setup() {
pinMode(A0, INPUT);
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
}
void loop() {
pot_value = map(analogRead(A0), 0, 1023, 0, 255);
analogWrite(3, pot_value);
delay(50);
}
Tumblr media
0 notes
wieselectronics · 6 years ago
Video
tumblr
0 notes