Show Posts
Pages: 1 [2] 3
16  Community / Exhibition / Gallery / Fairy Tale Phone on: December 13, 2013, 02:16:22 am
Hello Arduino Community

Here's my recent project as a X-Mas gift for my daughters. Using an old telephone with dial wheel and build in a Pro Mini with SD Card to play fairy tales over the ear phone.
I am not yet finished since I am waiting for the SD break out. Until now I soldered some pins on a MicroSD Adapter and a L78L33 regulator to get the stuff working properly

Here's some impressions:




Fist try to catch the impulse signal from the dial wheel and count them. Also playing with tone().


Prototype with all components


And here's the code with the TMRpcm library
Code:
/*
=============================================================================================
Fairy Tale Phone 1.0
by ReDiculum (Oct. - Dez. 2013)
-------------------------------
X-Mas 2013 Arduino project.
Using an old Zellweger Modell 70 (anno 1982) telephone with dial wheel.
The wheel can be spinned to count impulses and then playing one of ten different
audio fairies stored as 8bit 16.000khz mono WAV files named from 1.wav to 10.wav

SD Card > Arduino pinout:

CS (1)   -> Pin 4 (Chip select)
MOSI (2) -> Pin 11
MISO (7) -> Pin 12
SCK  (5) -> Pin 13

Ear phone  -> Pin 9 (protect with Diode against Pin 3) and GND
Dial wheel -> Pin 2 and GND
 
=============================================================================================

TMRh20's pcm library for Arduino
https://github.com/TMRh20/TMRpcm
*/
#include <SD.h>
#include <TMRpcm.h>
#include <SPI.h>

#define IMPULSE_PIN 2 // Digital Pin 2
#define PHONE_PIN 3 // Digital Pin 3 (PWM)
#define SD_CHIPSELECT_PIN 4  // SD
#define LED_PIN 13 // Digital Pin 13
#define TIME_WAIT 2000 // Waiting 2sec during dial wheel turns. Sufficient to catch 10 impulses
int countImpulse = 0;
unsigned long timeWait = 0;

TMRpcm music;  // Create object "music" from class "TMRpcm"

/* Sum of running millis and TIME_WAIT.
Must be long integer if kids are not dialing quickly :)
*/
unsigned long timeWaitEnd = 0;

void setup() {
  Serial.begin(57600); // Set console to 57600 baud
  Serial.println("=== FairyTalePhone based on TMRpcm ===");  

  pinMode(LED_PIN, OUTPUT); // onboard LED
  
  music.speakerPin = 9; // Set Pin for SD card audio output

  /* Turn on internal pullup resistor, because we pull the pin to ground.
  When the wheel gives impulse, the contact is opened (no current). That's
  when we have a digitalRead = 1.
  */
  digitalWrite(IMPULSE_PIN, HIGH);

  Serial.println("Ready to dial ...");

  // Play tone and wait here until the dial wheel has sent his first impulse
  tone(PHONE_PIN,420);
  while (digitalRead(IMPULSE_PIN) == 0) {
    delay(1);
  }
  noTone(PHONE_PIN); // Pssht! Here we go!

  Serial.print("Counting impulses ");
  timeWaitEnd = millis() + TIME_WAIT; // Summarize already passed millis since Arduino runs and TIME_WAIT.

  // Count all the dialed impulses until timeWaitEnd has reached
  while (millis() < timeWaitEnd ) {      
    if (digitalRead(IMPULSE_PIN) == 1) {
      /* Increment the amount of impulses if the contacts are opened.
      The wheel pulses with an interval of approx 70ms
      */
      countImpulse++;
      Serial.print(".");
      digitalWrite(LED_PIN, HIGH); // Blink LED ...
      tone(PHONE_PIN,1000); // ... and short tone (70ms) of 1khz to fill the gap
      delay(70);
      digitalWrite(LED_PIN,LOW);
      noTone(PHONE_PIN);
    }
  }

  Serial.println(" "); // New line

  /* If the dial wheel has been turned more than once by nervous kids
  and the amount of counted impulses exceeds 10, we just restart Arduino
  */
  if (countImpulse > 10) {
    Serial.print("Count exceeded 10 ("); Serial.print(countImpulse); Serial.println("), restarting");
    hangOff();
    asm volatile ("  jmp 0"); // Soft Reset
  } else {    
    Serial.print("Preparing fairy tale number "); Serial.println(countImpulse);
    
    // Initialize SD Card with library SimpleSDAudio
    if (!SD.begin(SD_CHIPSELECT_PIN)) {
      tone(PHONE_PIN,100); delay(250); noTone(PHONE_PIN); delay(400);
      tone(PHONE_PIN,80); delay(600); noTone(PHONE_PIN);
      Serial.println("Error initializing SD Card");
      while(1);
    }

    /* define a char array with an index size of 6 and convert
    integer "countImpulse" to char "track" using utoa() function
    http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html
    */
    char track[6];
    utoa(countImpulse,track,10);
    // Append the suffix .wav to the char array
    strcat(track, ".wav");
    
    // Play the audio file
    music.play(track);
    Serial.print("Playing..."); Serial.println(track);
    while (music.isPlaying() == 1) {
      true; // play WAV file number and wait until it's finished
    }
    hangOff(); // That's it, we jump into loop() function    
  }
}

void loop() {
  ;// Nothing to do
  //asm volatile ("  jmp 0"); // Soft Reset
}

void hangOff(){
  // Hang off tone 5x
  delay(1000);
  tone(PHONE_PIN,450); delay(250);
  noTone(PHONE_PIN); delay(250);
  tone(PHONE_PIN,450); delay(250);
  noTone(PHONE_PIN); delay(250);
  tone(PHONE_PIN,450); delay(250);
  noTone(PHONE_PIN); delay(250);
  tone(PHONE_PIN,450); delay(250);
  noTone(PHONE_PIN); delay(250);
  tone(PHONE_PIN,450); delay(250);
  noTone(PHONE_PIN); delay(250);
}
17  Topics / Interactive Art / Re: Project - LASERino (Laser Staging Box) on: March 21, 2013, 03:16:28 am
Here here's almost the final result:
Top view


Front view


Rear view


Running live:
18  International / Deutsch / Re: Mit welchem Arduino soll ich anfangen? on: February 22, 2013, 06:01:59 pm
Wir Schweizer haben als Eselsbrücke unseren Kanton Uri  smiley-yell smiley-yell
19  Topics / Interactive Art / Re: Project - LASERino (Laser Staging Box) on: February 21, 2013, 02:59:06 am
Another 3h spent in drilling and soldering. The stepper and the 400rpm DC motor arrvied

Here's the ULN2003 driver just next to the laser driver. Above the LM7805 with its cooling unit. All cables will be attached at the end.




The Nano has all its necessary wires attached. Screwed to the bottom and USB is now pluggable from outside


This will be the final position of the DC and stepper (the stepper mirror is not adjusted yet)


The 400rpm DC motor with its mirror glued


And here's an updated version of the Fritzing schema
20  International / Deutsch / Re: Anfaenger Frage zu Arduino Projekt (LED / IR / Touchscreen) on: February 20, 2013, 10:15:16 am
D) Kappt das mit der Spannungsversorgung? Arduino hat 3,3V die Stips / LEDs sprechen 5V. Muss ich das noch hochsetzten?
Eher runtersetzen. Z.b 9V oder 12V Eingangsspannung und dann:
- LF33CV fürs DUE
- LM7805 für die Stripes
21  Using Arduino / Motors, Mechanics, and Power / Stepper store position while power off on: February 20, 2013, 08:46:31 am
Hi, I tried to search for an existing topic but could not find anything.

If a stepper motor has to start on a specific angle when starting up Arduino but has been powered off at random angle, is there a way to ensure the start angle is always the same? Like start position? Servos for example are always controled by degrees, but not steppers.
I was thinking about using EEPROM or is there another way? I hope you guys understand what I mean.
22  International / Deutsch / Re: Mit welchem Arduino soll ich anfangen? on: February 18, 2013, 03:45:11 am
Viel Spaß und Warnung: 'Arduino kann süchtig machen! Pflegen Sie weiterhin zwischenmenschliche Kontakte.' smiley
Oh ja, und die Nacht ist auch zum Schlafen da!  smiley-yell

Wenn wir schon bei Conrad Produkten sind. Das Widerstands-Set find ich echt praktisch. Musste ich mir auch bestellen.
23  Topics / Interactive Art / Re: Project - LASERino (Laser Staging Box) on: February 15, 2013, 05:25:14 pm
Here some updates:

Part of cabling soldered on the Nano. D13 Laser TTL, D12 Servo signal, 5V and ground


More stuff in the box. The small yellow board contains an 7805 voltage regulator to have 12V and 5V


Still waiting for the stepper and the dc motor to continue the work.
Additionally I am thinking about driving the DC motor through a PWN and transistor to regurlate the speed.
To calibrate the stepper mirror at startup I am thinking about an attached phototransistor on the side.
24  International / Deutsch / Re: Mit welchem Arduino soll ich anfangen? on: February 13, 2013, 03:48:19 am
StarterKits sind für den Anfang, also ein UNO:
http://arduino.cc/en/Main/ArduinoStarterKit

Wenn man jedoch gleich ein fix verbautes Projekt anfängt, sind Nanos, Minis und Lilypads sicher gut geeignet.
Ich persönlich habe mir 2 Nanos gekauft. Eines mit Pins fürs Breadboard zum testen und eines wird dann direkt verdrahtet.
25  International / Deutsch / Re: analogRead on: February 11, 2013, 06:11:41 am
http://arduino.cc/en/Reference/AnalogRead

Parameters
pin: the number of the analog input pin to read from (0 to 5 on most boards, 0 to 7 on the Mini and Nano, 0 to 15 on the Mega)

Der Parameter ist also eine ganze Zahl (Integer).
26  Topics / Interactive Art / Re: Project - LASERino (Laser Staging Box) on: February 06, 2013, 04:49:50 pm
My plan is to build a lasershow box too,but using a true x-y control with servos...
Ciao. I wish you a good start doing your laser box! smiley
But pay attention, galvos are the right stuff to produce what you want. Do not use servos. Check out Youtube for several videos how people build x-y axis controlled laser shapes, images or even scrolling text. Good luck
27  Topics / Interactive Art / Project - LASERino (Laser Staging Box) on: February 06, 2013, 05:49:53 am
Hello community

I'd like to share my first Arduino project with you. The aim is to create a small laser staging box with a green 20mw laser producing several shapes with mirrors. The main mirror glued on a servo is redirecting the laser beam to the target mirrors producing the shapes. The delay between the switch from one shape to the other is controllable by a poti.

Here's the part list I am using:
- Arduino Nano
- 20mW laser module from ebay
- Plastic Box 240 x 147 x 67 mm
- Power Jack for 12V input
- Fix voltage regulator 7805
- 500Ohm Poti
- 9g Servo from ebay
- Stepper motor with driver from ebay
- Geared DC motor with 400rpm from ebay
- Some square and round mirrors from handcraft shop
- Small electronic equipment like: Cables, solder, diodes, LEDs, resistors, capacitors, photoresistor, screws and glue
- Shutterfree hands and patience smiley

Here are some first impressions about how it should look like and some test videos with the laser module.

First prototype tries with servo and TTL of laser pulsing. Servo attached to pin D12 and TTL of laser on D13 (same as onboard LED)



Another try pointing the laser beam to a rotating mirror on a DC motor and pulse laser with 3ms TTL. This is not the final 400rpm DC motor I will use.


Begin of mounting the parts into the box


And here's an actual Fritzing schema. I am still missing the stepper (on delivery)



I will keep this thread updated when I progress in construction and will post the final Arduino code when the box is finished.
28  International / Deutsch / Re: Welche Schrauben fürs Nano on: February 04, 2013, 12:03:28 pm
Vielen Dank. Ja, M1.6 scheint 1.7mm zu sein. Conrad (888672 - 62) hat welche mit entsprechender Mutter (888715 - 62)
29  International / Deutsch / Welche Schrauben fürs Nano on: February 04, 2013, 08:58:35 am
Hallo Leute.

Welche Schrauben entsprechen den 0.07" (1.7mm) Löcher für das Verschrauben des Nano Boards? Sind das wirklich M2 Schrauben?
30  Using Arduino / Programming Questions / Re: Call dynamically created function name on: January 04, 2013, 07:19:36 am
Quote
   
Call dynamically created function name

I have a better idea: rather than just dynamically create function names, dynamically create a compiler that compiles your dynamically created code that is dynamically flashed into a dynamically powered arduino so that it dynamically responds to inputs that are dynamically applied to dynamically assigned pins with dynamically changing frequencies and dyanmically altered amplitude.

All dynamically done, all the way.

Ok, I got it  smiley-lol smiley-grin

Anyway thanks for all the help
Pages: 1 [2] 3