Introduction: Electronic Dream Catcher
Are your kids affraid of getting a nightmare ??
The Electronic Dream Catcher will find and destroy those nasty dreams...
Watch the video
https://youtu.be/F4Jhq9ucp9Y
The Electronic Dream Catcher will find and destroy those nasty dreams...
Watch the video
https://youtu.be/F4Jhq9ucp9Y
Step 1: Parts
Well, This is rather easy one, you'll need very few things :
-3 220ohm Resistors
-White led
-Red led
-Orange led
-Piezo speaker
-Arduino Pro Mini
-a Switch
-and some battaries.
-A Project Box
-Tubes
-Papper Clip
-Shrinking Tubes
The connections are very simple, you can follow the diagram.
The "Special Dream Catcher part is constuct of 3 Leds, one inside each tube, held together withe the papper clip.
At bouth sides of the tubes i made a closer using shrinking tubes and glue it all together to the box.
-3 220ohm Resistors
-White led
-Red led
-Orange led
-Piezo speaker
-Arduino Pro Mini
-a Switch
-and some battaries.
-A Project Box
-Tubes
-Papper Clip
-Shrinking Tubes
The connections are very simple, you can follow the diagram.
The "Special Dream Catcher part is constuct of 3 Leds, one inside each tube, held together withe the papper clip.
At bouth sides of the tubes i made a closer using shrinking tubes and glue it all together to the box.
Step 2: The Code...
#define orangePin 11
#define redPin 9
#define whitePin 10
#define SPKpin 3
int pinChange;
volatile int BadDreamsCount, DCounter;
void setup() {
pinMode (orangePin, OUTPUT);
pinMode (redPin, OUTPUT);
pinMode (whitePin, OUTPUT);
pinMode (SPKpin, OUTPUT);
pinMode (2, INPUT_PULLUP);
Serial.begin (9600);
randomSeed(millis());
BadDreamsCount = random (1, 5);
}
void loop() {
randomSeed(millis());
dreamsScan();
if (random (1,100) <= 10 && DCounter <= BadDreamsCount) {
CND();
DCounter ++;
Serial.print ("BadDreamsCount = ");
Serial.print (BadDreamsCount);
Serial.print (" DCounter = ");
Serial.println (DCounter);
}
zero();
noTone (SPKpin);
}
// Catch and Destroy animation procedure
void CND() {
randomSeed(millis());
// Closing on the dream
for (int a=200; a>=30; a=a-10) {
Serial.println (a);
digitalWrite (orangePin, HIGH);
digitalWrite (redPin, LOW);
tone (SPKpin, 500-a);
delay (a);
digitalWrite (orangePin, LOW);
digitalWrite (redPin, HIGH);
delay (a);
//noTone(SPKpin);
}
// Holding it
tone (SPKpin, 300, 4000);
for (int a=1; a<=50; a++) {
digitalWrite (orangePin, HIGH);
digitalWrite (redPin, LOW);
delay (30);
digitalWrite (orangePin, LOW);
digitalWrite (redPin, HIGH);
delay (30);
//noTone (SPKpin);
}
// ZAPPING it
for (int a=1; a<= random (10, 50); a++) {
analogWrite (whitePin, random (10, 255));
tone (SPKpin, random (20,300));
delay (30);
}
noTone (SPKpin);
zero ();
}
// Turning all lights off
void zero() {
digitalWrite (orangePin, LOW);
digitalWrite (redPin, LOW);
digitalWrite (whitePin, LOW);
}
// Scan for deam animation procedure
void dreamsScan() {
tone (SPKpin, 2000, 100);
for (int i=9; i<=11; i++){
/* digitalWrite (i, !digitalRead(i));
digitalWrite (i, !digitalRead(i));
digitalWrite (i, !digitalRead(i));
Serial.println (i);
delay (200); */
digitalWrite (orangePin, HIGH);
digitalWrite (redPin, LOW);
delay (400);
digitalWrite (orangePin, LOW);
digitalWrite (redPin, HIGH);
delay (400);
}
}