Animated Edward Hopper Painting

by karel.opteynde in Circuits > Arduino

195 Views, 0 Favorites, 0 Comments

Animated Edward Hopper Painting

IMG_20210512_150031.jpg

With this tutorial I’ll be showing you how to make an animated
Hopper painting with moving shutters, Led-lights and background city noise by using an Arduino, an Adafruit soundboard and basic electronics.

Supplies

1x Arduino Uno

1x yellow LED

1x 680ohm resistor

1x Adafruit audio fx sound board + 2x2w amp

1x speaker

2x pushbutton

Copper wire

Soldering equipment

General equipment (screwdriver, ...)

Build the Box

IMG_20210512_150038.jpg

Sepperate the Hopper painting in three planes (woman,
room and city) with Photoshop or any other general editing software and print these out. Glue them onto the cardboard or foamboard and cut them out. Assemble them by building a bow with the same material and placing the three planes at an adequate distance. Use a fold down the middle of the mid-plane to give the illusion of a corner in the room.

Make sure to cut out the window so the background becomes visible through the mid-plane.

Arduino Assembly

Capture.PNG

Connect the LED, the Servo motor and the pushbutton to the Arduino using the schematic above.

Use the following code to program your Arduino.

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
#define servoPin 3 //~
#define pushButtonPin 2 

int angle =1;    // initial angle  for servo (beteen 1 and 179)
int angleStep =5;
const int minAngle = 0;
const int maxAngle = 95;

const int type =2;//watch video for details. Link is at the top of this code (robojax)

int buttonPushed =0;

int pin = 2;
int led = 5;

volatile long last = 0;
volatile bool turnOff = false;
volatile long offAt = 0;

void isr()
{
    if( (millis() - last ) > 20 ) //if at least 20 ms has passed since last press, this is not a dup
    {
        last = millis(); //note the time, for ignoring duplicate presses
        turnOff = true;
        offAt = millis() + 20000; //save a variable of now + 20 seconds
        digitalWrite(led, HIGH); //turn on
    }
}

void setup() {

  pinMode(pin, INPUT_PULLUP);
  pinMode(led, OUTPUT);
  attachInterrupt(0, isr, FALLING);
  
  // Servo button demo by Robojax.com
  Serial.begin(9600);          //  setup serial
  myservo.attach(servoPin);  // attaches the servo on pin 3 to the servo object
  pinMode(pushButtonPin,INPUT_PULLUP);
   Serial.println("Robojax Servo Button ");
   myservo.write(angle);//initial position
}

void loop() {

if(turnOff)
  {
   if(millis() >= offAt)
    {
       digitalWrite(led, LOW); //turn off led
    } 
  }
  
  if(digitalRead(pushButtonPin) == LOW){
    buttonPushed = 1;
  }
   if( buttonPushed ){
  // change the angle for next time through the loop:
  angle = angle + angleStep;

    // reverse the direction of the moving at the ends of the angle:
    if (angle >= maxAngle) {
      angleStep = -angleStep;
        if(type ==1)
        {
            buttonPushed =0;                   
        }
    }
    
    if (angle <= minAngle) {
      angleStep = -angleStep;
       if(type ==2)
        {
            buttonPushed =0;       
        }
    }
    
    myservo.write(angle); // move the servo to desired angle
      Serial.print("Moved to: ");
      Serial.print(angle);   // print the angle
      Serial.println(" degree");    
  delay(500); // waits for the servo to get there
   }

  
}

Assemble Soundboard

1890-06.jpg
076c-2210-05-0-1-1000x667.jpg

Connect the pushbutton to the groundport and port number 1 on
the Adafruit soundboard.

Connect the speaker to the left (or the right) channel of the audio output on the board.

Connect the board to your pc with a micro-USB cable and open the folder like any other flashdrive. Drag an audiofile of city noise into the folder. Make sure to use a .ogg file (compressed) or .wav file (uncompressed). As the soundboard only has limited memory I Would recommend opting for a .ogg file. Name the file T01 (T for trigger and 01 for pin number 1).

Disconnect the board from your pc and plug it into a power supply (powerbank or outlet). You can't run the soundboard while connected to your pc.

Test the soundboard by pressing the button. A red light should turn on and the designted sound should start playing.

Insert Electronics Into Box

IMG_20210512_153943.jpg

Make two holes on top of the box and insert the pushbuttons of
the soundboard adn the microcontroler into the foamboard. They should be easally accessable.

Place the microcontroler and soundboard on the inside of the box and mount the motor behinde the mid-plane of the painting, Right next to the top of the window, leaving about five centimeters of space between the window and the servo.

the powercables to reach the inside of the box.

Glue the LED's next to the window.

Connect the Curtains to the Motor

IMG_20210512_154043.jpg

Cut out a rectangle that will function as the
curtains of the windows that are just slightly bigger then the window itself. Mount these behind the window but allow them to slide up and down buy making two rails in whoch the reclangle can freely move up and down. Make these out of the same foambaord as the box. Make a small hole in the top of the rectangle and pull a wire through. Tie one side of teh rope to the window and the other to the servo. use a scrap piece of formboard to make a curved latch above the window, guiding the rope upwards and then toward the motor.

Finishing the Box

Clean up any unfinished edges and close the back with a pieve of foamboard. When pressing the button, the curtains should freely move up and down, the sound should be audible and the LEDs should light up and dim again.