Author Topic: NodeMCU ESP8266 delay slowing down  (Read 774 times)

0 Members and 1 Guest are viewing this topic.

Offline dusterthefirstTopic starter

  • Newbie
  • Posts: 5
  • Country: us
NodeMCU ESP8266 delay slowing down
« on: April 21, 2020, 07:02:06 pm »
I have recently purchased a NodeMCU (1.0) ESP8266 and connected it up to a speaker that I salvaged from an old alarm clock, pictured below. I connected the red wire to pin0 and the black wire to ground, as I assumed it would work. and started playing around with tones using the Arduino library (tone()) with delay()s between them to play a song. At first it worked very well, and kept almost perfect time. But listening to it today, it is playing the tones noticeably slower than it used to. I thought I might have drawn too much current from the board and blew a component, causing the clock to somehow slow. But i have no idea how to check or fix the problem. Any other ideas would be welcome. (I have tried to cut the times in half and it gets back to playing about the right tempo, but I am still perplexed as to what caused the issue.

 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1109
  • Country: lt
Re: NodeMCU ESP8266 delay slowing down
« Reply #1 on: April 21, 2020, 07:53:00 pm »
Well, you should never connect a speaker directly to MCU. Not only it is too big load, but it is also inductive. Back EMF of an inductive load can do unpredictable things for such a delicate chip. Maybe clock dividers failed, thats hard to say.
 

Offline ozcar

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: au
Re: NodeMCU ESP8266 delay slowing down
« Reply #2 on: April 22, 2020, 06:00:48 am »
As Manul said, not a good idea to connect the speaker directly, but did you perhaps change the "crystal frequency" setting in the IDE?
 

Offline dusterthefirstTopic starter

  • Newbie
  • Posts: 5
  • Country: us
Re: NodeMCU ESP8266 delay slowing down
« Reply #3 on: April 22, 2020, 01:16:32 pm »
I thought about that, but the changing it from 80MHz to 140MHz just causes the output pins to go haywire and does not speed it up at all
 

Offline ozcar

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: au
Re: NodeMCU ESP8266 delay slowing down
« Reply #4 on: April 22, 2020, 06:32:43 pm »
... changing it from 80MHz to 140MHz just causes the output pins to go haywire and does not speed it up at all

I was wondering if you had changed the "Crystal Frequency" rather than the "CPU Frequency" that you are talking about (80MHz vs 160MHz actually). However, I just checked, and I notice that you only get the option to change the crystal frequency (26MHz vs 40MHz) if you select a generic board, like say "Generic EP8266 Module" rather than a specific known board like "NodeMCU 1.0". So, scrap that theory, assuming you have not selected a generic board.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf