Mini Apple II-“Surprise” Machine for Halloween

834

2

Introduction: Mini Apple II-“Surprise” Machine for Halloween

About: Hi,I'm from DFRobot, a dream factory for robo-holics to make a better world.

I always get startled easily. I had tried to stop feeling scared by little things all the time. But, well, it’s so hard to change one’s nature, so at last, I decided to take it. One day, at the office, I was working in front of my computer with all my attention focused on the screen, a voice from nowhere suddenly drummed in my ears, and gave me a great fright. It turned out to be my colleague, he didn’t mean to spook me, but I don’t want this happening again. So I need a device to prompt me that somebody is coming to me when I am immersed in my work so I will not get frightened. Besides that, Halloween is coming, I am gonna make something fun. I have a rough idea in mind. Generally, it goes like this: first use some intriguing images to attract people to come closer, when the person is in a certain range, the device enters scary mode with frightening pictures appearing abruptly. If someone wants to give me some “surprises” on Halloween, then I will be using this device to treat him.

As for the appearance of the device, I want to make it like an Apple II. Some of you may have heard of this computer, it is launched in 1977, regarded as one of the most successful personal computers. The case of Apple II was designed to look more like a home appliance than a piece of electronic equipment. I fell in love with this computer the first time I met it in my History of Design class. And it is always on my dream product list. Now I think it is a great opportunity. So basically this is where the idea of my mini Apple II “surprise” machine comes from.

Supplies

  • Hardware List

1. Firebeetle Board-M0 (V1.0) X1
2. 2.8” 320x240 IPS TFT LCD Touchscreen with MicroSD

3. Gravity: URM09 Analog Ultrasonic Sensor

4. Four Feet Button Switch

5. 220Ω Resistor

6. Dupont Wires

7. Gravity 3P Wire

8. GDI Wire-30cm

9. Type-c Cable

  • Software

1. Arduino IDE

2. Image2LCD

Step 1: Connection Diagram

Solder Pin header to M0 board. Here we need an analog pin and a digital pin(P3 is digital, for connecting with the button; A3 is analog, for connecting to the ranging sensor ).

Add a 220Ω resistor when soldering GND wire to the button switch.

Step 2: Process Images

Download 7 suitable images from internet, cut and rotate 4:3, and name them as 1 to7.

Download and install Img2Lcd. Open up and import images into it, set the size of images 1 and 7 to 120*160, set 2 to 6 to 60*80, then we will get 7 .c files.

Step 3: Download GDL Screen Library File.

Download GDL screen library file. Unzip the file and copy it into Arduino Library.

Step 4: Program Flowchart

The function of the program is as Shown Above.

Step 5: Revise Code

#include "SPI.h" #include #include "DFRobot_GDL.h" #define screen_CS 5 #define screen_DC 7 #define screen_LED 0 #define screen_RST 6 //DFRobot_ST7789_240x240_HW_SPI screen(/*dc=*/screen_DC,/*cs=*/screen_CS,/*rst=*/screen_RST); //DFRobot_ST7789_240x320_HW_SPI screen(/*dc=*/screen_DC,/*cs=*/screen_CS,/*rst=*/screen_RST); //DFRobot_ILI9341_240x320_HW_SPI screen(/*dc=*/screen_DC,/*cs=*/screen_CS,/*rst=*/screen_RST); //DFRobot_ILI9488_320x480_HW_SPI screen(/*dc=*/screen_DC,/*cs=*/screen_CS,/*rst=*/screen_RST); /* M0 mainboard DMA transfer */ //DFRobot_ST7789_240x240_DMA_SPI screen(/*dc=*/screen_DC,/*cs=*/screen_CS,/*rst=*/screen_RST); //DFRobot_ST7789_240x320_DMA_SPI screen(/*dc=*/screen_DC,/*cs=*/screen_CS,/*rst=*/screen_RST); DFRobot_ILI9341_240x320_DMA_SPI screen(/*dc=*/screen_DC,/*cs=*/screen_CS,/*rst=*/screen_RST); //DFRobot_ILI9488_320x480_DMA_SPI screen(/*dc=*/screen_DC,/*cs=*/screen_CS,/*rst=*/screen_RST); long time3; int sensorPin=A3; int buttonPin=3; int sensorValue=0; int buttonState; int lastButtonState = LOW; int n=0; const unsigned char *c[7]={ gImage_1, gImage_2, gImage_3, gImage_4, gImage_5, gImage_6, gImage_7 }; void setup() { // put your setup code here, to run once: pinMode(buttonPin,INPUT); Serial.begin(9600); screen.begin(); time3 = millis(); Serial.println(millis()-time3); } void loop() { // put your main code here, to run repeatedly: sensorValue = analogRead(sensorPin); Serial.println(sensorValue); int reading = digitalRead(buttonPin); if(sensorValue>300){ if(n>0){ for(int i=n;i>0;i--){ screen.zoomPicture((void*)c[i],2); delay(100); } } else{ screen.zoomPicture((void*)c[n],2); delay(100); } n=0; } else if(sensorValue>250){ if(n>1){ for(int i=n;i>1;i--){ screen.zoomPicture((void*)c[i],2); delay(100); } } else if(n<1){ for(int i=n;i<1;i++){ screen.zoomPicture((void*)c[i],2); delay(100); } } else{ screen.zoomPicture((void*)c[n],2); delay(100); } n=1; } else if(sensorValue>200){ if(n>2){ for(int i=n;i>2;i--){ screen.zoomPicture((void*)c[i],2); delay(100); } } else if(n<2){ for(int i=n;i<2;i++){ screen.zoomPicture((void*)c[i],2); delay(100); } } else{ screen.zoomPicture((void*)c[n],2); delay(100); } n=2; } else if(sensorValue>150){ if(n>3){ for(int i=n;i>3;i--){ screen.zoomPicture((void*)c[i],2); delay(100); } } else if(n<3){ for(int i=n;i<3;i++){ screen.zoomPicture((void*)c[i],2); delay(100); } } else{ screen.zoomPicture((void*)c[n],2); delay(100); } n=3; } else if(sensorValue>100){ if(n>4){ for(int i=n;i>4;i--){ screen.zoomPicture((void*)c[i],2); delay(100); } } else if(n<4){ for(int i=n;i<4;i++){ screen.zoomPicture((void*)c[i],2); delay(100); } } else{ screen.zoomPicture((void*)c[n],2); delay(100); } n=4; } else if(sensorValue>50){ if(n>5){ for(int i=n;i>5;i--){ screen.zoomPicture((void*)c[i],2); delay(100); } } else if(n<5){ for(int i=n;i<5;i++){ screen.zoomPicture((void*)c[i],2); delay(100); } } else{ screen.zoomPicture((void*)c[n],2); delay(100); } n=5; } else{ buttonState = reading; if (buttonState == HIGH){ if(n<6){ for(int i=n;i<6;i++){ screen.zoomPicture((void*)c[i],2); delay(100); } } else{ screen.zoomPicture((void*)c[n],2); delay(100); } n=6;} else{ if(n<6){ for(int i=n;i<=5;i++){ screen.zoomPicture((void*)c[i],2); delay(100); } } n=5; } lastButtonState= buttonState; } }

Step 6: Design and Assembly Enclosure

Apple II Model diagram:

Laser Cutting Diagram (Unit: mm)

Step 7: Burn Code and Display Effect

Okay, that’s all for my Surprise Machine, the related files are attached here. Welcome to share your opinion about this project, or DIY your own APPLE II Machine.

Be the First to Share

    Recommendations

    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Unusual Uses Contest

      Unusual Uses Contest
    • Cookie Speed Challenge

      Cookie Speed Challenge

    Comments