element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino Projects
  • Products
  • Arduino
  • Arduino Projects
  • More
  • Cancel
Arduino Projects
Blog The Switch of Enlightenment - a Talking Useless Box for Arduino Day 2021
  • Blog
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: robogary
  • Date Created: 27 Mar 2021 10:52 PM Date Created
  • Views 2104 views
  • Likes 9 likes
  • Comments 2 comments
  • arduino
  • arduino projects
  • attackofthedronesch
Related
Recommended

The Switch of Enlightenment - a Talking Useless Box for Arduino Day 2021

robogary
robogary
27 Mar 2021

For celebrating Arduino Day 20201 , here is an amazing mashup project: a Talking Useless Box called the Switch of Enlightenment.

 

Like all useless boxes, throwing the switch will cause a servo controlled arm to turn the switch back off after a random time delay.

In my build version, an ISD1760PY voice recorder is also triggered to utter some useless, but funny, comments  or sound effects.

 

The ISD1760PY is unique as the voice recordings can be changed on the fly.

The ISD1760PY demo board has switches and a Electret microphone build in.

I did have to cobble the ISD1760PY so it could be hardwired to the Arduino Nano.

 

This version has a strobing bar LED to bring attention to the switch.

 

Here is the video showing it in action. The video also shows how the useless box was built and tested.

https://www.youtube.com/watch?v=ZeozFojEMJg

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Here is the schematic

image

 

The code:

 

/*

  TalkingUselessBoxWorks.ino

*/

 

 

#include <Servo.h>

 

 

Servo myservo;  // create servo object to control a servo

// twelve servo objects can be created on most boards

 

 

int pos = 7;    // variable increment LED Bar segment

int SwitchIsOn = LOW; //initiale var to LOW

int SwitchIsOnLastScan = LOW; //initiale var last scan's value to LOW

int RDY = HIGH ; //initiaze READY signal from ISD170 PY

long randNumber; // random number for servo to wait to flip switch

 

 

void setup() {

  myservo.attach(4);  // attaches the servo on pin 9 to the servo object

 

  pinMode(2, OUTPUT);   // falling edge triggered output to ISD1760PY voice card FWD input, selects next track. Pull LOW to trigger

  pinMode(3, OUTPUT);  //  falling edge triggered output to ISD1760PY voice card PLAY input. Pull LOW to trigger

  pinMode(5, INPUT);   // ISD1760PY Ready signal. Pulled LOW when ISD is playing or busy. HIGH when available

 

  pinMode(6, INPUT);   // panel mounted toggle switch input. TRUE means Closed and starts the circus

 

 

  pinMode(7, OUTPUT);  //LED BAR segment 1

  pinMode(8, OUTPUT);  //LED BAR segment 2

  pinMode(9, OUTPUT);  //LED BAR segment 3

  pinMode(10, OUTPUT);  //LED BAR segment 4

  pinMode(11, OUTPUT);  //LED BAR segment 5

  pinMode(12, OUTPUT);  //LED BAR segment 6

  pinMode(13, OUTPUT);  //LED BAR segment 7

 

 

  randomSeed(analogRead(1));//generate a random #

}

 

 

void loop() {

   digitalWrite(3, HIGH); //start off with no chatting

   digitalWrite(2, HIGH);

   myservo.write(0);

 

  for (pos = 7; pos <= 14; pos += 1)

    {

    digitalWrite(pos, HIGH);   // sets the "scanner" LED bar segment on

  

    SwitchIsOn = digitalRead(6);   // read the input pin value to start operation

  

    RDY = digitalRead(5);   // read the input pin 5 value ,connected to RDY signal of ISD1760PY. TRUE is ready to play

  

    if ((SwitchIsOn == HIGH) && (RDY==HIGH)) ///may need to one shot the switch input

        { 

          // blank the LEDs while the cycle executes

              digitalWrite(7, LOW);   //

              digitalWrite(8, LOW);   //

              digitalWrite(9, LOW);   //

              digitalWrite(10, LOW);   //

              digitalWrite(11, LOW);   //

              digitalWrite(12, LOW);   //

              digitalWrite(13, LOW);   //

 

 

 

 

          // PLAY TRACK

                     

           digitalWrite(3, LOW);   // trigger sound card message , pull PLAY input to ground

          delay (50); //set trigger width, debounce time = 192/Fs, figure worst case = .048msec

           digitalWrite(3, HIGH);   // trigger sound card message falling edge

         

           randNumber = random(1500,5000);

           delay(randNumber); // add some small randomness for turning off the main switch, give the soundtrack some time to start playing

         

           HitSwitch(); // turn the switch off

     

             // wait for track to finish

           RDY = digitalRead(5);   // read the input pin value of the ISD1760PY Ready signal TRUE is Ready

           while (RDY == LOW)  // keep checking to see of track is done playing

                {delay (5);

                RDY = digitalRead(5);

                }

 

 

             // increment to next track when ready

           

                FWDtoNextMessage();   // pulse output to FWD

       

          }

         delay (30);  //on time of LED bar segment

         digitalWrite(pos, LOW);   // turns off LED segment

      }

  }

 

 

 

 

void HitSwitch ()

{

    myservo.write(0);

    delay(5);   // spaceholder for inserting randomness to speed and response time

    myservo.write(90);              // tell servo to go to trip switch  position

    delay(300);                       // waits 15ms for the servo to reach the position

    myservo.write(0);                  // tell servo to go back to home position

  }

 

 

void FWDtoNextMessage()

{

            digitalWrite(2, LOW);   // increment to next sound card message, pull FWD input to ground

            delay (40); //set trigger width, debounce time = 192/Fs, figure worst case = .048msec

            digitalWrite(2, HIGH);   // sound card message falling edge

            delay(100); // LED flash time head start for 1760PY to load in new signal

}

  • Sign in to reply

Top Comments

  • robogary
    robogary over 4 years ago +1
    How original !
  • dubbie
    dubbie over 4 years ago +1
    Gary, I like the way the 'off' process is implemented - very subtle. Dubbie
  • dubbie
    dubbie over 4 years ago

    Gary,

     

    I like the way the 'off' process is implemented - very subtle.

     

    Dubbie

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • robogary
    robogary over 4 years ago

    How original !

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube