Matrix Bracelet Bert Xie
Intro
My individual project is an AI that will remind user for danger pose when they using the digital device to prevent them from experiencing injury such as neck pain and shoulder pain. Since digital device have already became an important part of our daily life, people are using it everywhere at anytime. The large amount of digital device use time might cause body pain unconsciously. This system will use the webcam of user’s digital device to detect their pose and identify wether it is danger or not. The bracelet on user’s hand will show a happy face or a frown face on its screen to remind users. The LED matrix screen can show text to communicate with the suer as well.
Why is it posthuman
I think the aesthetic of digital interface might change in the future, just like the definition of fashion is always changing, sometime it will go extreme elegant and sometime it might go back to vintage. Thus making this LED matrix device was my intention to create a more cyberpunk vibe rather than what the interfaces are look like nowadays. Also, the matrix screen are emphasis the anti-over technology since I believe some future technology are way too scary and even bring it to an ethical phase, it’s time to slow it down and look at those new technology with a more rational view.
P5JS Code
<div>Teachable Machine Image Model - p5.js and ml5.js</div>
<script> src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/addons/p5.dom.min.js"></script>
<script src="https://unpkg.com/ml5@0.4.3/dist/ml5.min.js"></script>
<script type="text/javascript">
// Classifier Variable
let classifier;
// Model URL
let imageModelURL = 'https://teachablemachine.withgoogle.com/models/Rw0PB0Xj/';
// Video
let video;
let flippedVideo;
// To store the classification
let label = "";
// Load the model first
function preload() {
classifier = ml5.imageClassifier(imageModelURL + 'model.json');
}
function setup() {
createCanvas(320, 260);
// Create the video
video = createCapture(VIDEO);
video.size(320, 240);
video.hide();
flippedVideo = ml5.flipImage(video)
// Start classifying
classifyVideo();
}
function draw() {
background(0);
// Draw the video
image(flippedVideo, 0, 0);
// Draw the label
fill(255);
textSize(16);
textAlign(CENTER);
text(label, width / 2, height - 4);
}
// Get a prediction for the current video frame
function classifyVideo() {
flippedVideo = ml5.flipImage(video)
classifier.classify(flippedVideo, gotResult);
}
// When we get a result
function gotResult(error, results) {
// If there is an error
if (error) {
console.error(error);
return;
}
// The results are in an array ordered by confidence.
// console.log(results[0]);
label = results[0].label;
// Classifiy again!
classifyVideo();
}
</script>
Arduino Code
/***************************************************
This is a library for our I2C LED Backpacks
Designed specifically to work with the Adafruit LED Matrix backpacks
----> http://www.adafruit.com/products/872
----> http://www.adafruit.com/products/871
----> http://www.adafruit.com/products/870
These displays use I2C to communicate, 2 pins are required to
interface. There are multiple selectable I2C addresses. For backpacks
with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
with 3 Address Select pins: 0x70 thru 0x77
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();
void setup() {
Serial.begin(9600);
Serial.println("8x8 LED Matrix Test");
matrix.begin(0x70); // pass in the address
}
static const uint8_t PROGMEM
smile_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10100101,
B10011001,
B01000010,
B00111100 },
neutral_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10111101,
B10000001,
B01000010,
B00111100 },
frown_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10011001,
B10100101,
B01000010,
B00111100 };
void loop() {
matrix.clear();
matrix.drawBitmap(0, 0, smile_bmp, 8, 8, LED_GREEN);
matrix.writeDisplay();
delay(500);
matrix.clear();
matrix.drawBitmap(0, 0, neutral_bmp, 8, 8, LED_YELLOW);
matrix.writeDisplay();
delay(500);
matrix.clear();
matrix.drawBitmap(0, 0, frown_bmp, 8, 8, LED_RED);
matrix.writeDisplay();
delay(500);
matrix.clear(); // clear display
matrix.drawPixel(0, 0, LED_GREEN);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);
matrix.clear();
matrix.drawLine(0,0, 7,7, LED_YELLOW);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);
matrix.clear();
matrix.drawRect(0,0, 8,8, LED_RED);
matrix.fillRect(2,2, 4,4, LED_GREEN);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);
matrix.clear();
matrix.drawCircle(3,3, 3, LED_YELLOW);
matrix.writeDisplay(); // write the changes we just made to the display
delay(500);
matrix.setTextWrap(false); // we dont want text to wrap so it scrolls nicely
matrix.setTextSize(1);
matrix.setTextColor(LED_GREEN);
for (int8_t x=7; x>=-36; x--) {
matrix.clear();
matrix.setCursor(x,0);
matrix.print("Hello");
matrix.writeDisplay();
delay(100);
}
matrix.setRotation(3);
matrix.setTextColor(LED_RED);
for (int8_t x=7; x>=-36; x--) {
matrix.clear();
matrix.setCursor(x,0);
matrix.print("World");
matrix.writeDisplay();
delay(100);
}
matrix.setRotation(0);
}
Video Link
https://www.youtube.com/watch?v=If-GD3btuVc