Audio file from SD (audio shield) stops before end of file while using motors

Status
Not open for further replies.

voidstar

New member
Overview
  • Using Teensy 3.1
  • Using Audio shield and SD card
  • SD library optimization activated
  • 3 DC motors, each controlled by an H Bridge stepper driver (Teensy pins 3+4, 5+6, 21+20)amazon link
  • Controlled by battery: Anker Powercore 20000
  • Currently everything is run off of one of the battery’s power ports. There is a second one available. I am not sure yet if these are independent ports or if they are bridged.
  • "billy" is an array that stores the three different motor objects running different animation behaviors based off of audio level.
  • have not yet been able to test with simple motor on/off signals but will do so later, posting here first to get feedback ASAP since this is on a deadline for a show.

Symptom
Audio plays back / loops indefinitely as intended when motors are not connected. When motors are connected, audio sometimes stops (code continues running without resetting). If the code is written to start playback when audio is stopped, then these dropouts manifest as the audio file restarting once the code detects the audio file is no longer playing. It typically happens after audio has been playing for more than a minute or two.

Suspected cause:
The battery pack is not supplying enough current. I have not yet been able to test this but am on my way home to do so. Posting in case there is something else I am missing, or if someone can confirm that this might be consistent. I think I mistakenly thought it could supply 3A from each port but it is in fact only capable of supplying either 3A total from either, or possibly 1.5A from each max.

I can post the circuit board that connects all the peripherals together if it seems relevant. There is also a radio module but I am able to reproduce that issue without the radio module involved as in the code below (radio module works fine with audio playback by using different CS pins and only checking if radio data is available when audio is not playing). Have not been able to test yet with a more minimal version of the motor action.
 

Attachments

  • audio.ino
    3.1 KB · Views: 36
  • BillyBass.h
    883 bytes · Views: 38
  • BillyBass.cpp
    4 KB · Views: 34
Use separate power for the motors, sharing ground. Its very common to see spikes/noise/dropouts on the supply
if trying to power motors from the logic 5V rail - I strongly recommend separate power for the motor/driver.

If you have a 'scope you can see the noise or dropouts on the rail for yourself to see how bad it is, but otherwise
you'll be in ignorance till bad things happen like you are seeing.

Its not clear if using both output ports, one for logic, one for motor, would constitute separate enough
supplies, but it might be a simple thing to try.
 
Yeah that was my first thought and what I am getting set up now.

The thing that I am surprised by is this:

I guess I would have expected the Teensy to reset in this case. It doesn't reset, it's just as if the audio stopped playing, indicated the SD card or something on the audio shield lost power but not the whole thing. Does that seem consistent?

Will report back soon once I have separated the motor power. Unfortunately +5V is on a fill so I will probably have to just desolder the motor drivers.
 
You may have crashed the SDcard. An SDcard is just a microcontroller with more flash...
 
Status
Not open for further replies.
Back
Top