Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Yoona Yang
Created January 17, 2022

A Flipped Plate: repeated ambivalences

This interactive installation is part of the artistic practice exploring the idea of coexisting ambivalence.

BeginnerShowcase (no instructions)10 hours13
A Flipped Plate: repeated ambivalences

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
SparkFun Qwiic Shield for Arduino
SparkFun Qwiic Shield for Arduino
×1
Stepper Motor, Bipolar
Stepper Motor, Bipolar
×1
SparkFun Grid-EYE Infrared Array Breakout - AMG8833 (Qwiic))
×1
DRV8834 Low-Voltage Stepper Motor Driver Carrier
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Electrolytic Capacitor, 1000 µF
Electrolytic Capacitor, 1000 µF
×1
Qwiic Cable
×1
Power Adapter (5V)
×1
Microswitch, IP67
Microswitch, IP67
×2

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

A Flipped Plate: repeated ambivalences

Arduino
#include <Arduino.h>
#include <SparkFun_GridEYE_Arduino_Library.h>
#include <Wire.h>

// Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step
#define MOTOR_STEPS 200
#define RPM 120

#define DIR 2
#define STEP 3
#define SLEEP 13

#include "DRV8834.h"
#define M0 10
#define M1 11
DRV8834 stepper(MOTOR_STEPS, DIR, STEP, SLEEP, M0, M1);

GridEYE grideye;

//boolean running = false;

int turn_dir = 1;
int up;
int down;
int step_count = 0;


void setup() {

  Serial.begin(115200);

  // GridEye sensor
  Wire.begin();
  grideye.begin();

  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);
  pinMode(STEP, OUTPUT);
  pinMode(DIR, OUTPUT);

  // Set target motor RPM
  stepper.begin(RPM);
  // if using enable/disable on ENABLE pin (active LOW) instead of SLEEP uncomment next line
  // stepper.setEnableActiveState(LOW);
  stepper.enable();
  stepper.setMicrostep(32);

  // setting starting point
  stepper.setMicrostep(32);
  up = digitalRead(5);
  while (up == 0) {
    stepper.move(-1);

    up = digitalRead(5);
    Serial.println(digitalRead(5));

    //    Serial.print("Up:");
    //    Serial.println(up);

  }
  stepper.move(1 * MOTOR_STEPS * turn_dir);

}


void loop() {
  Serial.println("start");
  up = digitalRead(5);
  down = digitalRead(6);
  
  // variables to store temperature values
  float testPixelValue = 0;
  float hotPixelValue = 0;
  int hotPixelIndex = 0;

  // for each of the 64 pixels, record the temperature and compare it to the 
  // hottest pixel that we've tested. If it's hotter, that becomes the new
  // king of the hill and its index is recorded. At the end of the loop, we 
  // should have the index and temperature of the hottest pixel in the frame
  for(unsigned char i = 0; i < 64; i++){
    testPixelValue = grideye.getPixelTemperature(i);
      if(testPixelValue > hotPixelValue){
        hotPixelValue = testPixelValue;
        hotPixelIndex = i;
      }
  }

  // Print the result in human readable format
  Serial.print("The hottest pixel is #");
  Serial.print(hotPixelIndex);
  Serial.print(" at ");
  Serial.print(hotPixelValue);
  Serial.println("C");

  // toss in a delay because we don't need to run all out
  delay(500);
  
  if (hotPixelValue > 20.50)
  {
    while (up == 0 && down == 0) {
      stepper.move(turn_dir);
      up = digitalRead(5);
      down = digitalRead(6);
    }
    stepper.move(-1 * MOTOR_STEPS * turn_dir);
    turn_dir = turn_dir * -1;
    delay(2000);
  }

}

A Flipped Plate: repeated ambivalencesUntitled file

Arduino
No preview (download only).

Credits

Yoona Yang

Yoona Yang

1 project • 0 followers

Comments