Ir para conteúdo
3DFinder
Entrar

Você está no 3DFinder

Buscamos em Thingiverse, MakerWorld e Printables ao mesmo tempo para te dar o melhor de cada uma.

Buscar mais como este
Modelo 3D Interactive Tiny Ghost Figure por rudiniemeijer no Thingiverse

Descrição

Small ghost figure to be used with LEDs and a piezo element, driven by an ATtiny85 or whatever. The LEDs are connected to a PWM port, so that light effects are possible. The piezo element can be used as either input or output, so that the figure can respond to its surroundings. Total cost, including LEDs, wood, breadboard, piezo element and ATtiny, is somewhere around $10 / €7.

The original idea of this figure comes from http://www.littlerobotfriends.com. Those 'Little Robot Friends' are probably way more complex and versatile, using a full blown ATmega328. This one, of course, is much more fun to build and to program.

Instruções

  • Print this design
  • Prepare two LED and fasten with hot glue
  • Fasten a piezo element with a dab of hot glue
  • Use double sided tape to fix the figure
  • Use two 22 ohm resistors in series with the LEDs
  • Connect ATtiny and battery box
  • Design appropriate software
  • Enjoy!

I've created the following Processing code, suitable for an ATtiny85 or equivalent:

/*
Source name: Interactive Ghost Figure
Author: Rudi Niemeijer
Copyright: Use as you like
Description: Light and sound effects for interactive ghost
Target: ATtiny85
_______
RESET ADC0 PB5 x|1 ^ 8|x VCC (+)
PWM ADC3 PB3 x|2 7|x PB2 ADC1
PWM ADC2 PB4 x|3 6|x PB1 PWM
(-) GND x|4_____5|x PB0 PWM

*/

// Constants for Arduino
// const int speakerPin = A5; // pb2 on pin 7
// const int eyeLeft = 3; // pb3 on pin 2
// const int eyeRight = 5; // pb4 on pin 3

// Constants for ATtiny85
const int speakerPin = 2; // PB2 on pin 7
const int eyeLeft = 1; // PB1 on pin 6
const int eyeRight = 0; // PB0 on pin 5

// Generate a frequency of 1/period Hz with duration in ms
void beep(int period, int duration) {
for (int i = 0; i < duration; i = i + (period / 1000l)) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(period/2);
digitalWrite(speakerPin, LOW);
delayMicroseconds(period/2);
}
}

// Duo-tone going up, LEDs light up as well
void siren() {
int t;
for (t = 440; t < 600; t++) {
beep((1000000/t), 5);
beep((1000000/(1040 - t)), 1);
analogWrite(eyeLeft, t - 440);
analogWrite(eyeRight, t - 440);
}
}

// White-noise kind of sound, LEDs light up as well
void burst() {
int p, d, t, l;
l = random(5, 60);
analogWrite(eyeLeft, l * 3);
analogWrite(eyeRight, l * 3);
for (int t = 0; t < l; t++) {
p = random(1000, 2000);
d = random(1, 1);
beep(p, d);
}
delay(random(100,2000));
}

// Scan the analog port for sound on the piezo element
void waitforSound(int timeout) {
int m = millis();
int val, knock = false;
int treshold = 90;
analogWrite(eyeLeft, 0);
analogWrite(eyeRight, 0);

beep((1000000/440), 50);

pinMode(speakerPin, INPUT);

while ((m + timeout > millis()) and knock == false) {
val = analogRead(speakerPin);
if (val >= treshold) {
knock = true;
}
}
pinMode(speakerPin, OUTPUT);
beep((1000000/880), 50);
}

void setup() {
pinMode(speakerPin, OUTPUT);
pinMode(eyeLeft, OUTPUT);
pinMode(eyeRight, OUTPUT);
siren();
}

void loop() {
waitforSound(180000);
delay(1000);
siren();
delay(1000);
for (int i = 0; i < 30; i++) burst();
for (int i = 180; i >= 0; i--) {
analogWrite(eyeLeft, i);
analogWrite(eyeRight, i);
delay(50);
}
delay(30000);
}

Thingiverse

Interactive Tiny Ghost Figure

12
Curtidas
0
Downloads
11
Coleções
1
Impressões
Licença Creative Commons - Attribution - Share Alike
Arquivos (1)
ghostfigure.stl 331.9 KB
Ver no Thingiverse (abre em nova aba)