Final Project¶
Idea: Neghtening box¶
My Idea comes from the experience with my little boys. When we practice tennis ball in the evening, we can hardly see if the ball is pass the net or not. So I want to build a tool which can help us know if the ball touch the net or not and create some fun.
Process¶
-
Design
-
Programing
#include<math.h>
#include<stdio.h>
#define A_Z 1
#define LED 4
int val_z,val_pre;
//double b;
void setup()
{
pinMode(A_Z,INPUT);
pinMode(LED, OUTPUT);
Serial.swap(1);//for updi ftdi
Serial.begin(19200);
for (int i=0;i<50;i++)
{
val_z+=analogRead(A_Z);
}
val_z=val_z/50;
val_pre=val_z;
}
void loop()
{
for (int i=0;i<50;i++)
{
val_z+=analogRead(A_Z);
}
val_z=val_z/50;
delay(300);
Serial.print(" Z_Axis: ");
Serial.print(val_z);
Serial.println(" ");
// add led / /
if (val_z<(val_pre+2)&&val_z>(val_pre-2)) {
// turn LED off:
digitalWrite(LED, LOW);
Serial.println(val_pre);
} else {
// turn LED on:
digitalWrite(LED, HIGH);
delay(1000); // wait for a second and blink
digitalWrite(LED, LOW);
delay(1000);
digitalWrite(LED, HIGH);
delay(1000); // wait for a second and blink
digitalWrite(LED, LOW);
delay(1000);
digitalWrite(LED, HIGH);
delay(1000); // wait for a second and blink
digitalWrite(LED, LOW);
delay(1000);
val_pre=val_z;
}
// end of led //
}
- Design PCB
- Design and Create the holding case
Video¶
Problem¶
- the Neghtenling box is sensitive to the strong wind, so if we play outside in a windy day, the flash light would be activated.
- The case of the box is still needed to be changed to allow user see the flash light more clearly.
File Board
File trace.rml
File outline.rml
File hole.rml
File mid_part.ai
File code
File case
Last update: June 13, 2021