commit e9d5d69b2237f08d0caca3b5b9818ff476c64015 Author: Jurij Podgoršek Date: Sun Aug 8 23:22:37 2021 +0200 Prvi komit diff --git a/8266/8266.ino b/8266/8266.ino new file mode 100644 index 0000000..cdc9072 --- /dev/null +++ b/8266/8266.ino @@ -0,0 +1,94 @@ +// NodeMCU 0.9 (ESP-12 module) + +#include + +/*#include +#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) +#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it +#endif +*/ + +const int MPU_addr=0x68; // I2C address of the MPU-6050 + +const float MPU_GYRO_250_SCALE = 131.0; +const float MPU_GYRO_500_SCALE = 65.5; +const float MPU_GYRO_1000_SCALE = 32.8; +const float MPU_GYRO_2000_SCALE = 16.4; +const float MPU_ACCL_2_SCALE = 16384.0; +const float MPU_ACCL_4_SCALE = 8192.0; +const float MPU_ACCL_8_SCALE = 4096.0; +const float MPU_ACCL_16_SCALE = 2048.0; + +// Sem dobimo vrednosti +int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ; + +void setup() { + pinMode(LED_BUILTIN, OUTPUT); + Wire.begin(); + Serial.begin(115200); + + check_I2c(MPU_addr); + Wire.beginTransmission(MPU_addr); + Wire.write(0x6B); // PWR_MGMT_1 register + Wire.write(0); // set to zero (wakes up the MPU-6050) + Wire.endTransmission(true); + delay(30); // Ensure gyro has enough time to power up + + //SerialBT.begin("MotionGlove"); + //Serial.print("BT on"); +} + +void loop() { + Wire.beginTransmission(MPU_addr); + Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H) + Wire.endTransmission(false); + Wire.requestFrom(MPU_addr,14,true); // request a total of 14 registers + AcX=Wire.read()<<8|Wire.read(); // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L) + AcY=Wire.read()<<8|Wire.read(); // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L) + AcZ=Wire.read()<<8|Wire.read(); // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L) + Tmp=Wire.read()<<8|Wire.read(); // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L) + GyX=Wire.read()<<8|Wire.read(); // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L) + GyY=Wire.read()<<8|Wire.read(); // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L) + GyZ=Wire.read()<<8|Wire.read(); // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L) + Serial.print("AcX = "); Serial.print(AcX); + Serial.print(" | AcY = "); Serial.print(AcY); + Serial.print(" | AcZ = "); Serial.print(AcZ); + Serial.print(" | Tmp = "); Serial.print(Tmp); + Serial.print(" | GyX = "); Serial.print(GyX); + Serial.print(" | GyY = "); Serial.print(GyY); + Serial.print(" | GyZ = "); Serial.println(GyZ); + +/* + SerialBT.write("/accel/0/x/" + String(AcX) + "\n"); + SerialBT.write("/accel/0/y/" + String(AcY) + "\n"); + SerialBT.write("/accel/0/z/" + String(AcZ) + "\n"); + SerialBT.write("/gy/0/x/" + String(GyX) + "\n"); + SerialBT.write("/gy/0/y/" + String(GyY) + "\n"); + SerialBT.write("/gy/0/z/" + String(GyZ) + "\n"); + SerialBT.write("/tmp/0/val/" + String(Tmp) + "\n"); +*/ + + // Blink blink + digitalWrite(LED_BUILTIN, 1); + //delay(500); + digitalWrite(LED_BUILTIN, 0); + Serial.print("\n"); +} + +byte check_I2c(byte addr){ + // We are using the return value of + // the Write.endTransmisstion to see if + // a device did acknowledge to the address. + byte error; + Wire.beginTransmission(addr); + error = Wire.endTransmission(); + + if (error == 0) { + Serial.print(" Device Found at 0x"); + Serial.println(addr,HEX); + } else { + Serial.print(" No Device Found at 0x"); + Serial.println(addr,HEX); + } + return error; +} diff --git a/8266/8266.org b/8266/8266.org new file mode 100644 index 0000000..e8e9697 --- /dev/null +++ b/8266/8266.org @@ -0,0 +1,19 @@ +#+TITLE: 8266 demo za projekt na pifcampu + +* Arduino intro: + https://create.arduino.cc/projecthub/electropeak/getting-started-w-nodemcu-esp8266-on-arduino-ide-28184f + +* Arduino kbd matrika: + https://www.baldengineer.com/arduino-keyboard-matrix-tutorial.html + +* GY-521 howto + https://create.arduino.cc/projecthub/Nicholas_N/how-to-use-the-accelerometer-gyroscope-gy-521-6dfc19 + + Daljsi tutorial: + https://olivertechnologydevelopment.wordpress.com/2017/08/17/esp8266-sensor-series-gy-521-imu-part-1/ + +* ModriZob + https://randomnerdtutorials.com/esp32-bluetooth-classic-arduino-ide/ + +* OSC + https://github.com/CNMAT/OSC diff --git a/motion-glove.jpg b/motion-glove.jpg new file mode 100644 index 0000000..ab4970d Binary files /dev/null and b/motion-glove.jpg differ diff --git a/projekt.jpg b/projekt.jpg new file mode 100644 index 0000000..0ea0698 Binary files /dev/null and b/projekt.jpg differ diff --git a/projekt.jpg~ b/projekt.jpg~ new file mode 100644 index 0000000..4c62daa Binary files /dev/null and b/projekt.jpg~ differ diff --git a/projekt.kra b/projekt.kra new file mode 100644 index 0000000..dc9926f Binary files /dev/null and b/projekt.kra differ diff --git a/projekt.kra.bak b/projekt.kra.bak new file mode 100644 index 0000000..e9c8230 Binary files /dev/null and b/projekt.kra.bak differ diff --git a/projekt.kra~ b/projekt.kra~ new file mode 100644 index 0000000..b176aa6 Binary files /dev/null and b/projekt.kra~ differ diff --git a/projekt.org b/projekt.org new file mode 100644 index 0000000..0eef793 --- /dev/null +++ b/projekt.org @@ -0,0 +1,23 @@ +* Wavey Wind, the Modul-air Mitt + + Using an ESP32 microcontroller with wifi and bluetooth capability, a gyroscope/accelerometer module and keyboards switches, I will be building an experimental low cost motion "glove" controller with a button for each finger. + + The idea stems from an earlier abstract visualisation project which was intended to visualise music. After building the initial prototype and hooking it up with a touch user interface of sliders that modulate the visuals, I asked myself why should I make the program interpret music? We already do that when we listen and (can) react by dancing; using a motion sensor, the dancing can be "aplified" by turning bodily motions into shapes and colours projected on a surface. + + Using the motion mitt, the operator of visuals doesn't have to get locked into a clumsy little touchscreen but can immerse in the experience of sound and video while co-creating it. A workshop will be held to build a number of gloves that can connect in an ad-hoc network, so that group of people could collaborate with them. + + The glove(s) will send events via the open sound control protocol, opening the possibility to using using them for audio synthesis/modulation, or maybe even as a general interface. + + "What Can a Body Do?" + +* Gibalna rokavička ("Wavey Wind, the Modul-air Mitt") + + Z ESP32 mikrokontrolerjem, ki omogoča wifi in bluetooth povezljivost, modulom z žiroskopom in pospeškomerjem ter tipkovničnimi stikali bom izdelal eksperimentalni nizkocenovni gibalni vmesnik z gumbom za vsak prst. + + Ideja izhaja iz zgodnješega projekta abstraktne vizualizacije, ki naj bi odsevala glasbo. Po izgradnji zgodnjega prototipa z vmesnikom na drsnikov na dotik, ki modulirajo prikaz, sem se vprašal zakaj bi program interpretiral glasbo? To namreč počnemo že mi, na poslušanje (lahko) odreagiramo s plesom, gibalni senzor pa bi lahko telesne gibe "ojačal" v oblike in barve, projecirane na površino. + + Z gibalno rokvičko se opravljalka_ec vizualij lahko izogne ujetosti v neroden zaslon na dotitk in potopi raje v izkušnjo zvoka in videa med soustvarjanjem le-te. Organizirana bo tudi delavnica za izgradnjo večih rokavičk, ki se lahko med sabo povežejo v ad-hoc mrežo, kar skupini ljudi omogoči sodelovanje. + + Rokavica oz. rokavice bodo pošiljale podatke preko OSC (open sound control) protokola, kar odpira tudi možnost rabe za zvočno sintezo/modulacijo ali celo kot splošni vmesnik. + + "Kaj zmore telo?"