0

AdaBox004 Music Player with IR remote
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

AdaBox004 Music Player with IR remote

by cemclellan on Wed Jun 28, 2017 6:41 pm

I am working with the sketch for the music player using the IR remote. Everything is working fine, but it occasionally reboots with the following message:

ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09f0c112
~ld
Can anyone help me to understand the message and what might be causing the reboot?

I am currently extending the code to use all of the remote buttons and adding extra functionality. I will post the updated code when I get it working.

The reboots happen using the code posted in the tutorial.

cemclellan
 
Posts: 20
Joined: Fri Aug 21, 2009 10:50 am

Re: AdaBox004 Music Player with IR remote

by mpc823 on Wed Jun 28, 2017 11:15 pm

WDT stands for WatchDog Timer. Though I haven't looked at the IR code specifically, the standard player they reference goes into a while (1) loop if the music is stopped. Likely what is happening is that you've stopped the music player, and went into the while (1) loop. The WatchDog Timer kicks in if you just sit in a loop and do nothing. WatchDog timers are used to ensure your processor hasn't gone into a weird state. You have to periodically set a bit in the WatchDog to let him know you're still alive. If you stop doing that, the WatchDog resets the system because it assumes you've crashed/gone into a bad state.

Don't go into a while (1) loop.

mpc823
 
Posts: 26
Joined: Thu May 05, 2016 9:10 am

Re: AdaBox004 Music Player with IR remote

by cemclellan on Thu Jun 29, 2017 6:02 pm

I now have the music player sketch playing tracks 0 - 9 from the SD card. As per the original sketch, the tracks must be named track00n.mp3.

I am attaching the updated code and the key codes from the IR remote.

Note: I am still getting occasional wdt reboots. I will work on fixing that next.

Ir Remote keycodes:

Button Hex (32 bit)
1 0x00FD08F7
2 0x00FD8877
3 0x00FD48B7
4 0x00FD28D7
5 0x00FDA857
6 0x00FD6897
7 0x00FD18E7
8 0x00FD9867
9 0x00FD58A7
0 0x00FD30CF
Vol+ 0x00FD40BF
Vol- 0x00FD00FF
Play/Pause 0x00FD807F
Setup 0x00FD20DF
Stop/Mode 0x00FD609F
Prev 0x00FDA05F
Next 0x00FDB04F
CH- 0x00FD10EF
CH+ 0x00FD50AF
Enter/Save 0x00FD906F
Return 0x00FD708F
Repeat Code (button held down) 0xFFFFFFFF
Attachments
IR_MusicPlayer.txt
(5.52 KiB) Downloaded 56 times

cemclellan
 
Posts: 20
Joined: Fri Aug 21, 2009 10:50 am

Re: AdaBox004 Music Player with IR remote

by sgarland413 on Sun Jul 02, 2017 8:02 pm

I too am getting a wdt reboot. It happens every time I interrupt a track that is playing to play a different track. Have you had any luck fixing the issue?

sgarland413
 
Posts: 6
Joined: Sun Oct 20, 2013 2:49 am

Re: AdaBox004 Music Player with IR remote

by adafruit_support_mike on Sun Jul 02, 2017 11:43 pm

The ESP8266 uses what's called a 'cooperative multitasking' operating system. The code that makes the Wifi work takes turns with the code you write.

In code you write, the function that gives the Wifi code a chance to take its turn is called yield(). That function also resets the watchdog timer. You need to call yield() periodically, especially in loops, to keep things running smoothly.

adafruit_support_mike
 
Posts: 53554
Joined: Thu Feb 11, 2010 2:51 pm

Re: AdaBox004 Music Player with IR remote

by cemclellan on Mon Jul 03, 2017 8:55 am

Thanks! I had seen the yield() command in some of the examples, but didn't understand it.

The Arduino reference didn't help, but after reading your comment I did some more research.

This article, along with your comment helped a lot - https://stackoverflow.com/questions/344 ... n#34498165

I put yield() at the end of the loop function, seems to have fixed everything!

cemclellan
 
Posts: 20
Joined: Fri Aug 21, 2009 10:50 am

Re: AdaBox004 Music Player with IR remote

by jcalvin on Mon Jul 03, 2017 2:20 pm

Thanks for the pointers. Grabbed your example code and played with it a bit. This version can play MP3s from sub-directories (like albums).

Cheers
Jim
Attachments
IRMP3.txt
(13.53 KiB) Downloaded 49 times

jcalvin
 
Posts: 22
Joined: Mon Jan 04, 2016 3:37 pm

Re: AdaBox004 Music Player with IR remote

by cemclellan on Mon Jul 03, 2017 4:10 pm

Jim,

I just took a look through your code. Some nice improvements, thanks!

cemclellan
 
Posts: 20
Joined: Fri Aug 21, 2009 10:50 am

Re: AdaBox004 Music Player with IR remote

by sgarland413 on Mon Jul 03, 2017 7:02 pm

Multitrack Music Player.txt
(5.52 KiB) Downloaded 45 times
Can someone let me know where best to insert the yield function in the code? I've tried inserting in a few places and I still get the wdt reboots each time I push a new track button while a song is currently playing. Here is a copy of the code:
Thanks!

sgarland413
 
Posts: 6
Joined: Sun Oct 20, 2013 2:49 am

Re: AdaBox004 Music Player with IR remote

by jolleylama on Tue Jul 04, 2017 1:26 pm

This was my first AdaBox, and it was really fun. I decided I liked the idea of a radio in the box, instead of the MP3 player. I took the IR code from the "IR Remote and Receiver" section and placed it into the code from "Streaming Internet Radio". It works pretty good. I think the volume up/down should go at a rate of +/- 4 or 5 instead of the +/- 1 that I currently have set.

Here's my code:
adabox_004_radio_player.txt
(4.53 KiB) Downloaded 45 times

My next part will be to set the numbered buttons to different radio stations from somafm.com, so I can change the station. That should be easy enough. I also have to poke the IR receiver out of the box.

I do have one question: I'd like to use the remote's play/pause button to actually work for the station. I know I can set the volume to 0/last_volume, which sort of works. I'd really like to pause the station and stay at that point of the song until I hit play again. Does anyone know if that's possible?

jolleylama
 
Posts: 1
Joined: Tue Jul 04, 2017 1:14 pm

Re: AdaBox004 Music Player with IR remote

by sirivias on Tue Jul 04, 2017 1:28 pm

Put the yield at the end of your loop function - right before the "delay(1);"
sirivias
 
Posts: 1
Joined: Thu Dec 26, 2013 12:25 am

Please be positive and constructive with your questions and comments.