Photon Animator Board

0 37043 Medium

Particle Photon with DFPlayer along with animatronic drivers for Gemmi Frogz, Furby, Billy Bass, and other creatures.

 

Photon Animator Board

Things used in this project

 

Hardware components

HARDWARE LIST
1 DFRobot DFPlayer
1 Particle Photon
1 STMicroelectronics L9110H
1 MPSA13
1 PAM8403
3 Resistor 10k ohm
3 22K ohm resistor
3 33K resistor

Story

 

 

About

 

I got inspiration for this project from a variety of sources.

 

My 3 year old grandson threw his Gemmi Frogz from the second story balcony, destroying its battery case and electronics, so I put this animal on the shelf for a while until the right opportunity came along to re-animate this creature with better music and abilities.

 

Gemmi Frogz

 

Gemmi Frogz

 

I had already used the Particle Photon in an Alexa controlled Hanukkah menorah, so I was moderately familiar with iOT services, and the invention of the Blynk drag-and-drop user interface made the difficult easy in doing this sort of project.

 

The "Talking Skull" project in Nuts and Volts was an addition inspiration, and informed me about the DFRobotic DFPlayer but this project had no internet connections.

 

The Photon Animator Board replaces the PIC with a Particle Photon and uses the DFPlayer library as well as the Blynk library for the Photon IDE as well as some simple application firmware to control the frog.

 

 

The board design also could control a Furby, the Billy Bass talking fish, as well as the latest Star Wars Porg.

 

The DFPlayer uses a microSD card to store MP3 and WAV coded sounds or music. a typical use allows for 99 numbered folders for music or sounds, a folder for "mp3" and a folder for "advertisements". We can put a 32 Gbyte micro SD card into the module which means hours of stored music. the module has a stereo audio output as well as a built in 1 watt monophonic speaker amplified. One Watt is certainly loud enough to entertain and annoy your intended audience, but I also put the foot prints for two versions of carrier boards for the PAM8403 3 watt stereo class D amp. A library of commands are available for the DFPlayer that are sent to it via the auxiliary UART pins on the Photon. When an ADVERT command is sent the file chosen interrupts the current audio program and plays the advertising file after which the current program resumes.

 

Blynk is a Platform with iOS and Android apps to control Arduino, Raspberry Pi, ESP8266, ESP32, and the Particle Photon and the likes over the Internet.

 

It's a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets.

 

Blynk Dashboard for this project

 

Blynk Dashboard for this project

 

A Blynk Slider is attached to a short program which sends Volume control commands to the DFplayer through virtual pin V2.

 

A Blynk Step Control is used to select the main audio track , there are 99 steps and each time the step control is actuated the value is sent to the DFPLayer to loop through that folder through virtual pin V4.

 

A Blynk Button is used to send the ADVERT command through virtual pin V1 when the advert command it sent, it also starts the Frog moving.

 

There are two motors in the Frog. One moves the arms, and the other moves the head back and forth through a cam. The Arm actuator needs to be operated forwards and reverse, which is why the L9110H is used so the motor can be reversed.

 

The Blynk timer is set to one second interrupts. When the ADVERT command is set it starts moving the arms up and down for a set period of time. Right now this is set to 15 seconds, but the time could be changed for each advertisement to match its duration.

BOM

 

Bill of Material for

On 12/16/2017 at 12:13:32 PM

Comment Pattern Quantity Components

------------------------------------------------------------------------------

1.0uf RADCAP-0.2 1 C3 Capacitor

100nf RADCAP-0.2 4 C4, C6, C7, C8 Capacitor Monolithic Ceramic 0.1µF 50V ±10%

1N4007 DO-35 3 D1, D2, D3 High Conductance Fast Diode

1uf RADCAP-0.2 2 C2, C5 Cap Ceramic 1uF 25V X7R 10%

200K AXIAL-0.4 1 R1 Resistor Carbon Film 200k Ohm 1/4 Watt 5%

22K AXIAL-0.4 4 R3, R8, R9, R11 Resistor Carbon Film 22k Ohm 1/4 Watt 5%

2PIN-POW OSTTC02 3 P3, P4, P5 Terminal Block 2 pos 5mm

33K AXIAL-0.4 3 R7, R10, R12 Resistor

33pf RADCAP-0.2 1 C1 Capacitor Ceramic Disc 33pF 50V

5PIN-SIL_1 SIP-5 1 P1 5 Pin Single In line .1 Inch centers

8PIN-POW OSTTC08 1 P2 Terminal Block 8 pos 5mm

8PIN-SIL SIP-8 1 P6 8 Pin Single In line .1 Inch centers

DFPlayer DFPLAYER 1 M2

JP3 SIP-3 1 JP1 3 PIN JUMPER

L9110H DIP8 1 U3 Singe channel Motor Driver

MPS13 TO92 3 Q1, Q2, Q3 NPN General Purpose Amplifier

MSGEQ7 DIP8 1 U2 7 band Spectrum analyser

PAM8403MOD PAM8403_MOD 1 AMP2 3W Sterio Class D Am module

PAM8403ODD PAM8403_ODD 1 AMP1 3W Sterio Class D Am module

Photon PHOTON 1 Radio1

PWR_2.1MM_NOSW PWR-5.1_THRU_NOSW 1 J2 CONN PWR JACK 2X5.5MM SOLDER

Res2 AXIAL-0.4 4 22K, R4, R5, R6 Resistor Carbon Film 22k Ohm 1/4 Watt 5%

USB_B USB_B 1 J1 Single USB B Receptacle

 

Schematics

 

Pdf File for design

icon spark-fish_bzCfyruspA.zip 171KB Download(2)

Code

 

02_blynk_DFPlayer

Arduino

Using Particle photon, DFPlayer, along with the Blynk graphical IOT platform

CODE
/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  No coding required for direct digital/analog pin operations!

 *************************************************************/

#define BLYNK_PRINT Serial  // Set serial output for debug prints
//#define BLYNK_DEBUG       // Uncomment this to see detailed prints

#include <blynk.h>
#include "DFRobotDFPlayerMini.h"
DFRobotDFPlayerMini myDFPlayer;
WidgetLED led1(V3);
BlynkTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "d26797d1efd7401fb18713ca41e25ef6";
boolean  froggymotion = false;
boolean  froggyarms = false;
int INApin = 0;
int INBpin = 1;
int TAILpin = 2;
int HEADpin = 3;
int ASSpin = 4;
int MRSTpin = 5;
int MSTBpin = 6;
int MOTIONpin = 7;

int advertnumber =1;
int trackset=1;
int oldstate=0;
int newstate =0;
int froggymotiontime =0;

void setup()
{
    Serial1.begin(9600);
    Serial.begin(115200);
    Serial.println();
    Serial.println(F("DFRobot DFPlayer Mini Demo"));
    Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
    
    pinMode(INApin, OUTPUT);
    pinMode(INBpin, OUTPUT);
    pinMode(TAILpin, OUTPUT);
    pinMode(HEADpin, OUTPUT);
    pinMode(ASSpin, OUTPUT);
    
      if (!myDFPlayer.begin(Serial1)) {  // use Serial1 to communicate with mp3.
          Serial.println(F("Unable to begin:"));
          Serial.println(F("1.Please recheck the connection!"));
          Serial.println(F("2.Please insert the SD card!"));
          while(true);
    }
    
    delay(4500); // Allow board to settle
    
    Serial.println(F("DFPlayer Mini online."));
      
      myDFPlayer.setTimeOut(500); //Set serial communictaion time out 500ms
      
      //----Set volume----
      myDFPlayer.volume(10);  //Set volume value (0~30).
      myDFPlayer.volumeUp(); //Volume Up
      myDFPlayer.volumeDown(); //Volume Down
      
      //----Set different EQ----
  myDFPlayer.EQ(DFPLAYER_EQ_NORMAL);
  myDFPlayer.loopFolder(6);
  


  Blynk.begin(auth);
  timer.setInterval(1000L, blinkLedWidget);  // one second interval
}


void blinkLedWidget(){   // 1 second interrupt 

	newstate = digitalRead(WKP);

  	if (newstate ==1) {			//if the pin is high the DFPlayer is not playing
	Serial.println("LED on V1: off");
	//froggymotion = false;
	digitalWrite(HEADpin, LOW);
	digitalWrite(INApin, LOW);
	digitalWrite(INBpin, LOW);
	if (oldstate == 0) led1.off();
  	} 
  else {
    led1.on();
    if (oldstate == 1) {
    Serial.print(newstate); 
    Serial.print(oldstate);
    Serial.println(" LED on V1: on");
    }
    if (froggymotion==true) { 

    	Serial.print(froggymotiontime);
    	Serial.println("froggymotion");
    	digitalWrite(HEADpin, HIGH);
    	if (froggyarms == true){
		digitalWrite(INApin, HIGH);
    		digitalWrite(INBpin, LOW);
    		}
    	else {
  		digitalWrite(INApin, LOW);
    		digitalWrite(INBpin, HIGH);
    		}  
    	froggyarms = !froggyarms;
    	
    	if (froggymotiontime++ >15) {
    		froggymotion = false;
    		froggymotiontime =0;
    		digitalWrite(INApin, LOW);
    		digitalWrite(INBpin, LOW);
    		digitalWrite(HEADpin, LOW);
    		}
    
  		}
	}
	oldstate = newstate;
}


// Attach a Step widget  and play files in folder 0 = mp3 folder 01-99 are normal folders 
BLYNK_WRITE(V4) {
      trackset = param.asInt();\

    	if (trackset == 0 )  myDFPlayer.enableLoopAll(); //loop all mp3 files.
    	//if (trackset < 0 ) trackset =99;
    	else  myDFPlayer.loopFolder(trackset);	
    	Serial.print(trackset) ;
    	Serial.println(F(" Loop track"));
    }


// Attach a Button widget (mode: Push) to the Virtual pin 1 - and advertise!  advertise turns on the frog 
BLYNK_WRITE(V1) {
    if (param.asInt() == 1) { // On button down...
        myDFPlayer.advertise(advertnumber);
        if (advertnumber++ > 18) {
        advertnumber = 1;
            }
        froggymotion = true ;
        }
        
    }


// Attach a slider to  Virtual pin 2 - and control the volume!
BLYNK_WRITE(V2) {
	int volset = param.asInt();
	myDFPlayer.volume(volset);
   
	}

void loop(){
      Blynk.run();
      timer.run();
      
    }

The article was first published in hackster, February 6,  2023

cr: https://www.hackster.io/advanced-risc/photon-animator-board-02d4fd

author: Arthur Sobel

License
All Rights
Reserved
licensBg
0