Hiss & Sudden Stops?

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
IanLukeFinley
 
Posts: 21
Joined: Fri Jun 17, 2022 2:14 pm

Hiss & Sudden Stops?

Post by IanLukeFinley »

Hey there Wise People,
So, I have a fairly complicated setup, and it's producing two issues that make me a little nervous, so I wanted to run them by you.
Stygia.JPG
Stygia.JPG (62.24 KiB) Viewed 151 times
Setup: I've made a replica of the Stygian Blade from Hades. There are two strips of 25 lights on the inside rim, and two strips of 45 lights on the outside rim, for a total of 140 NeoPixels (maybe you see where this is going). They are controlled by an ItsyBitsy 32u4 5v. Power comes from a LiPo 3.7V 2000mAh battery that is running into a PowerBoost 1000 Basic - 5V USB Boost @ 1000mA from 1.8V+. The outside strips get their power directly from the PowerBoost (the 5V and GND pins), while the inside strips get their power from the ItsyBitsy (the 5V and GND pins), which in turn gets it's power from the PowerBoost (the + and - output where the USB connector would typically go, since I'm not using that connection). Additionally, there is a switch hooked up to another small board with two resistors and a wire running to GND on the ItsyBitsy that has wires to Pins 2 & 4 to act as switch controls. Finally, the LEDs are controlled by Pins 6 & 8. What this all does is give me a switch with three positions: one turns off the lights, one turns all the lights on (green inside, white outside), and one animates the lights (two different animations, inside and outside). It's pretty cool.

Having typed all that out, I realize that it would probably be a lot easier to try to diagram all this. So I guess my first question is, are there any easy pieces of software to diagram connections like this? I'm a noob. Forgive me.

The Code: See bottom of this post.

Question 1: The first concerning thing is that when the lights are in the All On position there is a quiet but discernable hiss coming from either the ItsyBitsy or the PowerBoost. When the lights are in the Animation position, that hiss is noticeable too, but only during the part of the animation when the lights are brightest. So, is this a sign of something dangerous? Am I drawing too much power through this system? Should I ignore it?

Question 2: This is a bigger deal. Sometimes, this system runs just great for 10 or 20 or 30 minutes. And sometimes it stops suddenly after just a few minutes. In that instance, if I unplug the battery from the PowerBoost and reconnect it, it typically starts back up again, but that seems like a thing I should try to figure out what it's happening.

Ok. So thats where I am. Again, please forgive me, I'm very new to all of this, and have likely made a lot of mistakes. I will be grateful for any guidance you can give!


Code: Select all

#include <Adafruit_NeoPixel.h>

int brightness=0;
int fadeAmount=10; // 25 gives 8 per cycle, 20 9, etc

 Adafruit_NeoPixel stripIN(25, 6, NEO_GRB + NEO_KHZ800);
 //LED_COUNT, LED_PIN, Gobbledygook
 Adafruit_NeoPixel stripOUT(45, 8, NEO_GRB + NEO_KHZ800);
 //LED_COUNT, LED_PIN, Gobbledygook

 const int buttonAPin = 2;     // the number of the pushbutton pin
 int buttonAState = 0;         // variable for reading the pushbutton status

 const int buttonBPin = 4;     // the number of the pushbutton pin
 int buttonBState = 0;         // variable for reading the pushbutton status
 
// the setup routine runs once when you press reset:
void setup() {                
  stripIN.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  stripIN.show();            // Turn OFF all pixels ASAP
   stripOUT.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  stripOUT.show();            // Turn OFF all pixels ASAP
  pinMode(buttonAPin, INPUT);
  pinMode(buttonBPin, INPUT);
}
 
// the loop routine runs over and over again forever:
void loop() {
    buttonAState = digitalRead(buttonAPin);
    buttonBState = digitalRead(buttonBPin);
    if (buttonAState == HIGH) {
          colorWipeIN(stripIN.Color(0,  255,   0), 50); 
          colorWipeOUT(stripOUT.Color(255,  153,   153), 50); 
          } else 
          { 
           if (buttonBState == HIGH)
            {
            meteorRain(0,255,0,10, 64, true, 10);
            stripOUT.setBrightness(brightness);
            colorWipeOUT(stripOUT.Color(255,255,153),0);
            brightness=brightness+fadeAmount;
            if(brightness<=0||brightness>=100)
              {fadeAmount=-fadeAmount;}
           }
           else {
               colorWipeIN(stripIN.Color(0,  0,   0), 0); 
               colorWipeOUT(stripOUT.Color(0,  0,   0), 0);
                }
          }
     }

//STRIP IN FUNCTIONS

// Fill the dots one after the other with a color
void colorWipeIN(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<stripIN.numPixels(); i++) {
    stripIN.setPixelColor(i, c);
    stripIN.show();
  }
}

void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int SpeedDelay) {  
  setAll(0,0,0);
  for(int i = 0; i < 25+25; i++) {
    // fade brightness all LEDs one step
    for(int j=0; j<25; j++) {
      if( (!meteorRandomDecay) || (random(10)>5) ) {
        fadeToBlack(j, meteorTrailDecay );        
      }
    }
    // draw meteor
    for(int j = 0; j < meteorSize; j++) {
      if( ( i-j <25) && (i-j>=0) ) {
        setPixel(i-j, red, green, blue);
      }
    }
    showStrip();
    delay(SpeedDelay);
  }
}

void fadeToBlack(int ledNo, byte fadeValue) {
    uint32_t oldColor;
    uint8_t r, g, b;
    int value;
    oldColor = stripIN.getPixelColor(ledNo);
    r = (oldColor & 0x00ff0000UL) >> 16;
    g = (oldColor & 0x0000ff00UL) >> 8;
    b = (oldColor & 0x000000ffUL);
    r=(r<=10)? 0 : (int) r-(r*fadeValue/256);
    g=(g<=10)? 0 : (int) g-(g*fadeValue/256);
    b=(b<=10)? 0 : (int) b-(b*fadeValue/256);
    stripIN.setPixelColor(ledNo, r,g,b);
}

void showStrip() {
   stripIN.show();
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
   stripIN.setPixelColor(Pixel, stripIN.Color(red, green, blue));
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < 25; i++ ) {
    setPixel(i, red, green, blue);
  }
  showStrip();
}

//STRIP OUT FUNCTIONS

// Fill the dots one after the other with a color
void colorWipeOUT(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<stripOUT.numPixels(); i++) {
    stripOUT.setPixelColor(i, c);
    stripOUT.show();
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return stripOUT.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return stripOUT.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return stripOUT.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Hiss & Sudden Stops?

Post by adafruit_support_mike »

IanLukeFinley wrote:Having typed all that out, I realize that it would probably be a lot easier to try to diagram all this. So I guess my first question is, are there any easy pieces of software to diagram connections like this? I'm a noob. Forgive me.
No apologies necessary.. learning to draw good schematics is an art. It’s a process of drawing a few unholy messes to get all the connections right, drawing a few more versions to reduce the chaos, and usually quitting when you realize you can’t make the remaining inconvenient parts look better than they already do.

Even the gurus come up with things like these:
bob-pease-schematic.GIF
bob-pease-schematic.GIF (106.56 KiB) Viewed 141 times
jim-williams-schematic.JPG
jim-williams-schematic.JPG (76.85 KiB) Viewed 141 times
(the fact that Bob Pease and Jim Williams were giants in the industry means they could get away with publishing their rough versions)

As with all technical drawing, the best place to start is with a Sharpie and a ream of copy paper (total cost maybe $10). You want big, ugly lines you can’t erase, and a bigger pile of 2nd, 3rd, …, Nth chances. Get used to drawing while thinking, starting over when you come up with a better idea, and not trying to cram as much as possible into the smallest space. Avoid at all costs the temptation to fiddle with partial scematics.. software ‘editors’ make it easier to waste hours in a tweak-then-delete loop than to focus on solving design problems.

Try to keep all your inputs at the left, all the outputs on the right, and higher voltages above lower ones. Try very hard to keep all wire connections T-shaped (which only makes sense if there’s a connection), and only cross lines when they don’t connect. Don’t draw little half-circle hops when lines don’t connect.. if you cross several lines it looks like an inductor:
Your mileage will vary depending on whom you ask
Your mileage will vary depending on whom you ask
connections-and-skips.jpg (34.42 KiB) Viewed 141 times
The two principles work together: if you’ve obviously worked to make all connections T-shaped, a pair of crossed lines that connect look suspicious.

I use a dot (called a ‘meatball’) to indicate connections, but they’re subject to debate. After several generations of bad copies, all lines that intersect look like they have meatballs. Ultimately the lines and common sense dictate a schematic’s meaning, which is why T-shapes are so important.

Ideally lines that don’t connect would never cross, but it’s rare to be that lucky. Most non-trivial circuits have crossings you can’t avoid. In general though, a schematic with fewer crossings tends to look better than one with more. A big part of the sketch-and-iterate process involves finding the smallest number of crossings.

Once you’re comfortable drawing Sharpie-on-paper schematics you’ll be able to use any schematic editor or drawing program you want, and will gravitate toward the one that gets in your way the least.
IanLukeFinley wrote: The first concerning thing is that when the lights are in the All On position there is a quiet but discernable hiss coming from either the ItsyBitsy or the PowerBoost. When the lights are in the Animation position, that hiss is noticeable too, but only during the part of the animation when the lights are brightest. So, is this a sign of something dangerous?
That’s probably not dangerous, just annoying.

The sound probably comes from the PowerBoost. No matter how well an inductor is wound, there will always be microscopic amounts of flex in the wires (if there’s no flex, the wires will stretch until there is). Charging and discharging an inductor’s magnetic field induces physical force on the wires just like in an electric motor. The rapid changes in force create a vibration that gets transferred to the rest of the inductor and the PCB.

Surface-mount capacitors flex in a similar way, but for different reasons. Most are made from barium titanate, which has a high dielectric constant but is also piezoelectric: flexing the crystal makes it emit a pulse of current (you can use SMD caps as really bad microphone elements). The laws of physics are symmetric, so pumping a burst of current into a piezoelectric crystal makes it flex (you can also use them as -really- bad speakers).

The PowerBoost’s step-up converter operates at about 40kHz, which is enough to shake the inductor and major capacitors. Sometimes a part of the PCB will have a natural vibration frequency at some fraction of the boost frequency, and will filter the vibration down to a range humans can hear.

The vibration doesn’t hurt anything, it’s just a nuisance. You can try to damp things down with dots of hot-melt glue if you’re really determined, but it can be hard to find the spots that do any good.
IanLukeFinley wrote: Sometimes, this system runs just great for 10 or 20 or 30 minutes. And sometimes it stops suddenly after just a few minutes. In that instance, if I unplug the battery from the PowerBoost and reconnect it, it typically starts back up again, but that seems like a thing I should try to figure out what it's happening.
That sounds like an issue to troubleshoot, and the first step there is to collect information.

The most useful question in debugging is, “what’s the last thing the system did normally before the first thing that went wrong?” Any patterns you can find in that region are probably related to the problem. There’s usually a whole pile of subsequent evidence, but that’s like a marching band hitting a banana peel: only the first person to go down is relevant to the problem. The remaining carnage is just a chain of coincidental side-effects.

User avatar
IanLukeFinley
 
Posts: 21
Joined: Fri Jun 17, 2022 2:14 pm

Re: Hiss & Sudden Stops?

Post by IanLukeFinley »

Thank you!! What an incredibly thorough and gracious reply! I'm in your debt!

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”