Teensy 4.0 Completely non-responsive

lankanmon

Member
Hi All,

I am new to the Teensy boards, but coming from Arduino, I am loving it so far.
This is my first official build with a Teensy board and I have been testing along the way. I tested my keys, then the rotary encoders and finally the RGB LEDs.
I fear that I may have killed my board though.

I had just finished my wiring and was completing testing of my LEDs.
I pushed my code to the Teensy and it stopped responding. I am not sure at what point it stopped.

The way I had my board mounted, I had to pry it up to get access to the reset button, but I tried pressing it and the red light near the usb port did not appear. I also read some suggestions and tried holding the button for 15 and 20 seconds respectively and also plugging it in with the button pressed. It is lifeless.

My biggest confusion is that I did not make any wiring changes or even move it between when it was working and when it became non-responseive, So it is hard to tell if something shorted out.

Please let me know if there is anything else I can do to try to revive it.
My code is below and also some pictures in my WIP project (it is a macro/utility keyboad).

Any help will be much appreciated.

Images:
https://imgur.com/a/v28O6jF

Code:
Code:
#include <Keypad.h>

//Setup Knobs
// Top (A)
int knobA_CLK = 23;
int knobA_DT = 22;
int knobA_SW = 21;
int knobA_counter = 0;
int knobA_currentStateCLK;
int knobA_lastStateCLK;
String knobA_currentDir ="";
unsigned long knobA_lastButtonPress = 0;

// Middle (B)
int knobB_CLK = 18;
int knobB_DT = 19;
int knobB_SW = 20;
int knobB_counter = 0;
int knobB_currentStateCLK;
int knobB_lastStateCLK;
String knobB_currentDir ="";
unsigned long knobB_lastButtonPress = 0;

// Bottom (C)
int knobC_CLK = 14;
int knobC_DT = 15;
int knobC_SW = 16;
int knobC_counter = 0;
int knobC_currentStateCLK;
int knobC_lastStateCLK;
String knobC_currentDir ="";
unsigned long knobC_lastButtonPress = 0;

// Setup LEDs

// LED A
int ledA_R = 8;
int ledA_G = 9;
int ledA_B = 10;

// LED B
int ledB_R = 11;
int ledB_G = 12;
int ledB_B = 13;

// LED C
int ledC_R = 34;
int ledC_G = 28;
int ledC_B = 24;

// LED D
int ledD_R = 33;
int ledD_G = 29;
int ledD_B = 25;

// Setup Keys
const byte ROWS = 4; 
const byte COLS = 4; 

char hexaKeys[ROWS][COLS] = {
  {'A', 'E', 'I', 'M'},
  {'B', 'F', 'J', 'N'},
  {'C', 'G', 'K', 'O'},
  {'D', 'H', 'L', 'P'}
};

byte rowPins[ROWS] = {4, 5, 6, 7}; 
byte colPins[COLS] = {0, 1, 2, 3}; 

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup(){
  // Setup Serial Monitor
  Serial.begin(9600);
  
  // Set encoder pins as inputs
  pinMode(knobA_CLK,INPUT);
  pinMode(knobA_DT,INPUT);
  pinMode(knobA_SW, INPUT_PULLUP);
  
  pinMode(knobB_CLK,INPUT);
  pinMode(knobB_DT,INPUT);
  pinMode(knobB_SW, INPUT_PULLUP);
  
  pinMode(knobC_CLK,INPUT);
  pinMode(knobC_DT,INPUT);
  pinMode(knobC_SW, INPUT_PULLUP);
  
  // Read the initial state
  knobA_lastStateCLK = digitalRead(knobA_CLK);
  knobB_lastStateCLK = digitalRead(knobB_CLK);
  knobC_lastStateCLK = digitalRead(knobC_CLK);

  //RGB Leds
  pinMode(ledA_R, OUTPUT);
  pinMode(ledA_G, OUTPUT);
  pinMode(ledA_B, OUTPUT);
}
  
void loop(){
  // Read the current state of CLK
  knobA_currentStateCLK = digitalRead(knobA_CLK);
  knobB_currentStateCLK = digitalRead(knobB_CLK);
  knobC_currentStateCLK = digitalRead(knobC_CLK);

  // Knob A
  if (knobA_currentStateCLK != knobA_lastStateCLK  && knobA_currentStateCLK == 1){
    if (digitalRead(knobA_DT) != knobA_currentStateCLK) {
      knobA_counter --;
      knobA_currentDir ="CW";
    } else {
      knobA_counter ++;
      knobA_currentDir ="CCW";
    }
      RGB_color(0, 255, 0); // Green


    Serial.print("Direction: ");
    Serial.print(knobA_currentDir);
    Serial.print(" | Counter: ");
    Serial.println(knobA_counter);
  }

  knobA_lastStateCLK = knobA_currentStateCLK;

  int knobA_btnState = digitalRead(knobA_SW);

  if (knobA_btnState == LOW) {
    if (millis() - knobA_lastButtonPress > 50) {
      Serial.println("Button pressed!");
    }
    knobA_lastButtonPress = millis();
      RGB_color(255, 0, 0); // Red
  }

  // Knob B
  if (knobB_currentStateCLK != knobB_lastStateCLK  && knobB_currentStateCLK == 1){
    if (digitalRead(knobB_DT) != knobB_currentStateCLK) {
      knobB_counter --;
      knobB_currentDir ="CW";
    } else {
      knobB_counter ++;
      knobB_currentDir ="CCW";
    }
      RGB_color(0, 255, 0); // Green


    Serial.print("Direction: ");
    Serial.print(knobB_currentDir);
    Serial.print(" | Counter: ");
    Serial.println(knobB_counter);
  }

  knobB_lastStateCLK = knobB_currentStateCLK;

  int knobB_btnState = digitalRead(knobB_SW);

  if (knobB_btnState == LOW) {
    if (millis() - knobB_lastButtonPress > 50) {
      Serial.println("Button pressed!");
    }
    knobB_lastButtonPress = millis();
      RGB_color(255, 0, 0); // Red
  }

  // Knob C
  if (knobC_currentStateCLK != knobC_lastStateCLK  && knobC_currentStateCLK == 1){
    if (digitalRead(knobC_DT) != knobC_currentStateCLK) {
      knobC_counter --;
      knobC_currentDir ="CW";
    } else {
      knobC_counter ++;
      knobC_currentDir ="CCW";
    }
      RGB_color(0, 255, 0); // Green


    Serial.print("Direction: ");
    Serial.print(knobC_currentDir);
    Serial.print(" | Counter: ");
    Serial.println(knobC_counter);
  }

  knobC_lastStateCLK = knobC_currentStateCLK;

  int knobC_btnState = digitalRead(knobC_SW);

  if (knobC_btnState == LOW) {
    if (millis() - knobC_lastButtonPress > 50) {
      Serial.println("Button pressed!");
    }
    knobC_lastButtonPress = millis();
      RGB_color(255, 0, 0); // Red
  }

  delay(1);


  // Keypress
  char customKey = customKeypad.getKey();
  
  if (customKey){
    Serial.println(customKey);
    Keyboard.press(customKey);
    RGB_color(0, 0, 255); // Blue
    delay(10);
    Keyboard.releaseAll();
  }

//BB
//  RGB_color(0, 0, 255); // Blue
//  delay(1000);
//  RGB_color(0, 255, 0); // Green
//  delay(1000);
//  RGB_color(255, 0, 0); // Red
//  delay(1000);
//  RGB_color(255, 255, 125); // Raspberry
//  delay(1000);
//  RGB_color(0, 255, 255); // Cyan
//  delay(1000);
//  RGB_color(255, 0, 255); // Magenta
//  delay(1000);
//  RGB_color(255, 255, 0); // Yellow
//  delay(1000);
//  RGB_color(255, 255, 255); // White
//  delay(1000);

RGB_color(0, 0, 0);
}


void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
 {
  analogWrite(ledA_R, red_light_value);
  analogWrite(ledA_G, green_light_value);
  analogWrite(ledA_B, blue_light_value);

  analogWrite(ledB_R, red_light_value);
  analogWrite(ledB_G, green_light_value);
  analogWrite(ledB_B, blue_light_value);

  analogWrite(ledC_R, red_light_value);
  analogWrite(ledC_G, green_light_value);
  analogWrite(ledC_B, blue_light_value);

  analogWrite(ledD_R, red_light_value);
  analogWrite(ledD_G, green_light_value);
  analogWrite(ledD_B, blue_light_value);
}
 
Note: The following snippet of code was uncommented and running in the teensy when commented it out and tried to push the above code (but I am not sure if the above code made it in)
Code:
//BB
//  RGB_color(0, 0, 255); // Blue
//  delay(1000);
//  RGB_color(0, 255, 0); // Green
//  delay(1000);
//  RGB_color(255, 0, 0); // Red
//  delay(1000);
//  RGB_color(255, 255, 125); // Raspberry
//  delay(1000);
//  RGB_color(0, 255, 255); // Cyan
//  delay(1000);
//  RGB_color(255, 0, 255); // Magenta
//  delay(1000);
//  RGB_color(255, 255, 0); // Yellow
//  delay(1000);
//  RGB_color(255, 255, 255); // White
 
All:
This is the best example I have see in a long time of terrible soldering work.
Notice the large solder blobs on the Teensy pins which usually indicates a bad solder joint.
Notice the melted insulation on the end wires which indicates way to much heat for to long.

Since my original training in the early 60's and subsequent NASA certification in the Navy in the 70's I have not seen a better example of how not to perform a solder job.

I'm surprised that this work did not create a smoking pile of wires and a smoked Teensy.

Regards,
Ed
 
All:
This is the best example I have see in a long time of terrible soldering work.

Yup, this looks like glued with solder, not soldered.

Lankanmon, these are "cold" blobs of solder, not heated both parts long enough. I think there is - or was - a short somewhere.
A "dead" Teensy is usually a hardware failure, not a programming issue.
 
can you not make a clearer picture of the Teensy?

I have added more close-up photos to the gallery

All:
This is the best example I have see in a long time of terrible soldering work.
Notice the large solder blobs on the Teensy pins which usually indicates a bad solder joint.
Notice the melted insulation on the end wires which indicates way to much heat for to long.

Since my original training in the early 60's and subsequent NASA certification in the Navy in the 70's I have not seen a better example of how not to perform a solder job.

I'm surprised that this work did not create a smoking pile of wires and a smoked Teensy.

Regards,
Ed

Thanks for the feedback. I certainly don't have your background or experience in soldering. I am very new to this space. I have mainly used breadboards for the majority of my projects in the past. This is one of the most compact things I have built so far and had to solder directly to the chip. I will look into bettering my soldering ability. I would definitely appreciate tips.

Yup, this looks like glued with solder, not soldered.

Lankanmon, these are "cold" blobs of solder, not heated both parts long enough. I think there is - or was - a short somewhere.
A "dead" Teensy is usually a hardware failure, not a programming issue.

Thank you! I am not familiar with the terminology but this is a good lead on where I can start to learn more. I have always worried that if I heat a part too long, I may kill it. Is that not the case?
I agree that this is probably a hardware issue. as a result of my poor soldering. I am baffled why it happened sometime after I had completed all the wiring and hardware work. It was about 30min after I completed everything, and it was running the led program and I was in the process of programming it. It must have been some sort of latent issue from my build phase. Based on feedback, most likely caused by my soldering. Any further advice on how to avoid this in the future or tips for better soldering?

I appreciate everyone's help!
 
I have added more close-up photos to the gallery



Thanks for the feedback. I certainly don't have your background or experience in soldering. I am very new to this space. I have mainly used breadboards for the majority of my projects in the past. This is one of the most compact things I have built so far and had to solder directly to the chip. I will look into bettering my soldering ability. I would definitely appreciate tips.



Thank you! I am not familiar with the terminology but this is a good lead on where I can start to learn more. I have always worried that if I heat a part too long, I may kill it. Is that not the case?
I agree that this is probably a hardware issue. as a result of my poor soldering. I am baffled why it happened sometime after I had completed all the wiring and hardware work. It was about 30min after I completed everything, and it was running the led program and I was in the process of programming it. It must have been some sort of latent issue from my build phase. Based on feedback, most likely caused by my soldering. Any further advice on how to avoid this in the future or tips for better soldering?

I appreciate everyone's help!

I would also question why you would use such large wire on a project like this. The Teensy is not capable of sourcing or sinking very much current so the use of 28 - 30ga kynar insulated wire would be a better choice for soldering to such a small pin.
Why would you solder at all? I seems that using crimp on female pins to the wires would be adequate for your use. You can buy these wires in all the usual places (amazon, eBay, aliexpress). They come in male to male, male to female, and female to female type connectors on the ends, and various lengths to suit your needs.
I am guessing that this is just experimental in nature so using temporary connections is a better way of connecting the Teensy to other peripherals.
If this setup that you show in the pictures is permanent than I suggest you will have a great deal of head-aches as time goes on caused by this terrible solder job.

Just remember when soldering, the cardinal rule is both pieces have to be hot enough or the solder will not flow properly and you will get a "cold solder joint" which means the two pieces are not electrically connected properly and will eventually fail.

Regards,
Ed
 
I would also question why you would use such large wire on a project like this. The Teensy is not capable of sourcing or sinking very much current so the use of 28 - 30ga kynar insulated wire would be a better choice for soldering to such a small pin.
Why would you solder at all? I seems that using crimp on female pins to the wires would be adequate for your use. You can buy these wires in all the usual places (amazon, eBay, aliexpress). They come in male to male, male to female, and female to female type connectors on the ends, and various lengths to suit your needs.
I am guessing that this is just experimental in nature so using temporary connections is a better way of connecting the Teensy to other peripherals.
If this setup that you show in the pictures is permanent than I suggest you will have a great deal of head-aches as time goes on caused by this terrible solder job.

Just remember when soldering, the cardinal rule is both pieces have to be hot enough or the solder will not flow properly and you will get a "cold solder joint" which means the two pieces are not electrically connected properly and will eventually fail.

Regards,
Ed

Thanks Ed! I mainly used the wires that I had on hand. I agree they are much thinker gauge than needed. I will get 28 - 30ga kynar insulated wire as you recommended. Can you explain the crimping method or point met to a resource for it? I am not familiar with it.

I have viewed the link to pauls soldering video provided by @el_supremo and have learned a lot. I will try to better my skills for the future.

I appreciate your advice!
 
Lankanmon:
The crimp pins I was referring to are for the .025" square pins that are commonly soldered into the Teensy board. You crimp these pins on the end of your wires and either put shrink tubing on the ends to protect from shorts or buy the hard plastic housings that the crimp pins slide into and lock. These are commonly available at all the usual places. You will need to also buy a crimp tool to crimp these pins onto the end of the stripped wire that you have. However these pins have a limited range of sizes generally between 22 to 28 AWG wire. Some people just use a pair of pliers to crimp them on, however this method does not always provide a sturdy connection.

The other method of interconnect that I mentioned is using the preassembled cabling with crimped on pins in housings that are readily available in all the usual places. These cables come in various lengths depending on the source.

I have included pictures of the pins, the cables, and the crimp tool at the bottom of this message.

Also remember and this is important always keep the wires (cables) as short as possible because when your wires are to long you can cause lots of problems with your project (RF radiation, capacitance, inductance, and other difficult to diagnose problems).

Regards,
Ed
 

Attachments

  • s-l225-1.jpg
    s-l225-1.jpg
    12.8 KB · Views: 141
  • s-l225-2.jpg
    s-l225-2.jpg
    6.8 KB · Views: 152
  • s-l225.jpg
    s-l225.jpg
    8.3 KB · Views: 152
Thank you Ed, I have ordered those to use in the future.

On another interesting note, when I attempted to power my Raspberry PI 2, I noticed that it was also not turning on. I was using the same USB cable that I used for the Teensy. This prompted me to use a different cable and it worked. So just to see, I tried using that cable with the Teensy and all of the sudden, it started working (it wasn't dead). It was the USB cable that I fried. I am glad that I did not burn out the Teensy, and I learned a lot of tips to avoid doing so in the future. I was just wondering, are there any tips to avoid burning out a USB cable? I don't know if I was drawing too much power or not, but I was doing the RGB LED test last. Any tips? I did have my code posted in my original post.

If this topic is beyond this post, I can definitely make another forum thread to discuss tips to avoid burning out my cables.

Thank you!
 
Thank you Ed, I have ordered those to use in the future.

On another interesting note, when I attempted to power my Raspberry PI 2, I noticed that it was also not turning on. I was using the same USB cable that I used for the Teensy. This prompted me to use a different cable and it worked. So just to see, I tried using that cable with the Teensy and all of the sudden, it started working (it wasn't dead). It was the USB cable that I fried. I am glad that I did not burn out the Teensy, and I learned a lot of tips to avoid doing so in the future. I was just wondering, are there any tips to avoid burning out a USB cable? I don't know if I was drawing too much power or not, but I was doing the RGB LED test last. Any tips? I did have my code posted in my original post.

If this topic is beyond this post, I can definitely make another forum thread to discuss tips to avoid burning out my cables.

Thank you!

Lankanmon:
Ahaaau, the USB cable problem!!!! Beware of cheap USB cables. Most of the USB cables on the market today are absolutely garbage.

I you got your teensy from PJRC it may or may not have come with a USB cable. If it did you will notice that it is thicker than mosts USB cables you may see that are for other general purpose, especially cell phone charging cables. Some of them have no data wires in them (if you search this board you will find several threads about this) and most of them have power wires that are to small for the length of the cable.
I would suggest you learn about some basic electricity/electronics facts from physics like this very useful PIRE wheel. It can help you decide if the wires in a cable are adequate for the amount of current that you intend to send thru the cable.
 

Attachments

  • PIRE Wheel.png
    PIRE Wheel.png
    120.1 KB · Views: 25
Last edited:
Thanks, Ed. I have switched to a thicker USB cable and have ordered a couple more in case I need them. I have also changed my code to reduce the max analog values to also help with reducing the output. For my use case, I don't need the less at full brightness, so in an attempt to improve the life of the components, I have made those changes.
 
Back
Top