Home › Forums › Sparkfun MP3 Shield Library Support Forum › cuckoo clock: sparkfun MP3 Player with motors and Servo Motor
Tagged: cuckoo clock, motors, servo motor, sparkfun mp3
- This topic has 6 replies, 3 voices, and was last updated 11 years, 1 month ago by Michael P. Flaga.
-
AuthorPosts
-
July 25, 2013 at 8:55 pm #2764AnonymousInactive
I am making a cuckoo clock with arduino UNO which takes time from Time.h. It consists of operation of a Motor which moves fwd and backwards using a H Driver. It also operates a Servo in between. I tried to make it work with Sparkfun MP3 Shield to play music tracks during various phases of movement. For the motor I have used pins not being used by the Sparkfun Shield. However, the project behaves un-predictably with while using MP3 Player. I am using SFEMP3Shield.h by bill porter to drive the Sparkfun MP3 Player.
Does anyone have experience in such a project, are there any conflicts, should I use a different timer, or a RTC board. Is there any other method of playing music during various movements. I am attaching the sketch I have used. I would be grateful for any assistance.August 4, 2013 at 10:32 am #2802Michael P. FlagaMemberI suspect an interrupt issue. You may want to configure the SFE MP3 library to run in polled mode, rather than interrupt. By changing USE_MP3_REFILL_MEANS to USE_MP3_Polled in SFEMP3ShieldConfig.h
August 4, 2013 at 8:20 pm #2809AnonymousInactiveThanks for the guidance. I attempted to carry out the above change in the file, I was unable to decipher as to which line it is to be changed as USE_MP3_REFILL_MEANS appears at a number of places. Sorry for my ignorance.
May I also know as to what will be the implication on the program, possibly two actions cannot be simultaneous.
regards
August 5, 2013 at 7:40 am #2810Michael P. FlagaMemberchange line 195 of SFEMP3ShieldConfig.h from
#define USE_MP3_REFILL_MEANS USE_MP3_INTx
to
#define USE_MP3_REFILL_MEANS USE_MP3_Polled
This changes the driver not to use Interrupts, but rather the main loop() will
MP3player.available();
will do the refill. This however, requires the main loop() not to be blocking.
August 5, 2013 at 8:14 pm #2812BillMembermandeep replied to the email notification instead of posting here. The message:
Thanks for your consideration.I tried the above configuration as suggested by you. It does work when the loop is running without any delays. However, in the loop I have other actions, like the servo motor running, an Op of DC motor which incorporates a delay in the loop. The music does not play in that case , it is brief and intermittent. Any suggestions please.thanks and regardsAugust 5, 2013 at 11:01 pm #2813Michael P. FlagaMemberSuch delays are blocking, until finished preventing the refills of the MP3 from SdCard. It takes time to read the SdCard and it takes time and to service the motors..
you could try adding the following command of sei(); just after line 1696 http://mpflaga.github.io/Sparkfun-MP3-Player-Shield-Arduino-Library/_s_f_e_m_p3_shield_8cpp_source.html#l01696
…
1696 void SFEMP3Shield::refill() {
1697 sei();
1698 //Serial.println(F(“filling”));
1699
1700 while(digitalRead(MP3_DREQ)){
…August 5, 2013 at 11:04 pm #2814Michael P. FlagaMemberIt was implied, but may not be obvious that change line 195 of SFEMP3ShieldConfig.h was changed back to…
#define USE_MP3_REFILL_MEANS USE_MP3_INTx
this should allow the interrupt for the motor timers to interrupt during the SdCard Fill.
There has been limited success with this. It may cause other issues. Rumor is that it will work. -
AuthorPosts
- You must be logged in to reply to this topic.