all | audio | badgelife | breakout | clocks | displays | experiments | feather | handhelds | home automation | howto | LED art | misc | props | robots | sewing | software | tools | no_category

USB cable tester

I want something usb stick thingy-ish to check a usb cable

A little ATtiny45, some LEDs and transistors - battery powered. It scans through the cable with some blinking LEDs, then goes to sleep.

USB cable tester | New Revision

2021-07-19 00:35:03

Today I went sorting through some USB cables, but before I could test anything, I had to solder the third and last of the boards that I had ordered years ago. The micro-B USB socket held for 15 cables before I had to add glue because it got loose [log for board 2]. So I decided to update some parts on the PCB and shift things around. 

Check out this old space ship of a schematic:

And here is the (hopefully improved) new schematics, I think it's more readible, but not everyone is a fan of too many labels. 

There's still one pin left on the Attiny, anyone any ideas for it?

https://cdn.hackaday.io/images/6715191626649071002.png
https://cdn.hackaday.io/images/9784611626647418806.png
https://cdn.hackaday.io/images/6574721626647418815.png

USB cable tester | New Revision

2021-07-19 00:35:03

Today I went sorting through some USB cables, but before I could test anything, I had to solder the third and last of the boards that I had ordered years ago. The micro-B USB socket held for 15 cables before I had to add glue because it got loose [log for board 2]. So I decided to update some parts on the PCB and shift things around. 

Check out this old space ship of a schematic:

And here is the (hopefully improved) new schematics, I think it's more readible, but not everyone is a fan of too many labels. 

There's still one pin left on the Attiny, anyone any ideas for it?

https://cdn.hackaday.io/images/6715191626649071002.png
https://cdn.hackaday.io/images/9784611626647418806.png
https://cdn.hackaday.io/images/6574721626647418815.png

USB cable tester | yay :)

2017-08-26 07:59:34

so cool to see one in the wild!

USB cable tester | yay :)

2017-08-26 07:59:34

so cool to see one in the wild!

USB cable tester | Board 2 is running

2016-12-06 09:16:47

Since the USB micro connector broke off of the first board I had to solder one again. Still have to check if the consumption still is that low and all the code really works as intended.

Also - Resin / 2K epoxy!

https://cdn.hackaday.io/images/3566291481012192210.png

USB cable tester | Board 2 is running

2016-12-06 09:16:47

Since the USB micro connector broke off of the first board I had to solder one again. Still have to check if the consumption still is that low and all the code really works as intended.

Also - Resin / 2K epoxy!

https://cdn.hackaday.io/images/3566291481012192210.png

USB cable tester | uh wait, that fits the 1kB contest

2016-12-04 14:08:36

noice! It compiles with arduino! https://hackaday.io/project/6858-usb-cable-tester/log/24876-verify-your-results

I will test the circuit when I get home! I'm glad I just went through my projects list and that there's a USB port broken. yeah!

USB cable tester | uh wait, that fits the 1kB contest

2016-12-04 14:08:36

noice! It compiles with arduino! https://hackaday.io/project/6858-usb-cable-tester/log/24876-verify-your-results

I will test the circuit when I get home! I'm glad I just went through my projects list and that there's a USB port broken. yeah!

USB cable tester | woohoo

2016-03-16 17:06:38

Yay, this project got featured on the OSHPark blog :)

http://blog.oshpark.com/2016/03/15/draft-usb-cable-tester/

USB cable tester | woohoo

2016-03-16 17:06:38

Yay, this project got featured on the OSHPark blog :)

http://blog.oshpark.com/2016/03/15/draft-usb-cable-tester/

USB cable tester | Mark III boards are in

2015-09-24 12:17:13

I'll try to toaster oven solder them in the near future.

https://cdn.hackaday.io/images/632561443089790694.jpg

USB cable tester | Mark III boards are in

2015-09-24 12:17:13

I'll try to toaster oven solder them in the near future.

https://cdn.hackaday.io/images/632561443089790694.jpg

USB cable tester | verify your results

2015-09-09 09:38:53

So the code from last time didn't work at all, when I woke up the blue LEDs where totally dim. I've check the datasheet for the attiny45 and noticed once again - what works on an arduino must not work on a board using non-atmega328s. I hooked up my new UNI-T UT61E and measured 200uA - not the 0.1uA I've expected to see. With the help of the gist from JChristensen I verified (read copied) my code for the power down and measured a success - yes it's measurable - 0.1uA !

/* 
Things to safe power, according to datasheet:
 - turn off adc (not needed for LEDs)
 - turn off brown out detection (BOD)
 - turn off analog comparator
 - turn off internal voltage reference 
 - turn off watchdog timer
 - disable port pins per register
 
With the help of JChristensen/AVR Sleep
https://gist.github.com/JChristensen/5616922

*/

#include <avr/sleep.h>
#define BODS 7                     //BOD Sleep bit in MCUCR
#define BODSE 2                    //BOD Sleep enable bit in MCUCR

int leds[] = {4,0,1,2};
void setup() 
{
  for (int i=0; i<4; i++)
  {
    pinMode(leds[i], OUTPUT);
    digitalWrite(leds[i], HIGH);
    delay(200);
    digitalWrite(leds[i], LOW);
    delay(200);
  }
  die_until_reset();
}

void loop() { }

void die_until_reset()
{
  byte  mcucr1, mcucr2;

  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  MCUCR &= ~(_BV(ISC01) | _BV(ISC00));      //INT0 on low level
  ADCSRA &= ~_BV(ADEN);                     //disable ADC
  cli();                                    //stop interrupts to ensure the BOD timed sequence executes as required
  mcucr1 = MCUCR | _BV(BODS) | _BV(BODSE);  //turn off the brown-out detector
  mcucr2 = mcucr1 & ~_BV(BODSE);            //if the MCU does not have BOD disable capability,
  MCUCR = mcucr1;                           //  this code has no effect
  MCUCR = mcucr2;
  sleep_cpu();
}

USB cable tester | verify your results

2015-09-09 09:38:53

So the code from last time didn't work at all, when I woke up the blue LEDs where totally dim. I've check the datasheet for the attiny45 and noticed once again - what works on an arduino must not work on a board using non-atmega328s. I hooked up my new UNI-T UT61E and measured 200uA - not the 0.1uA I've expected to see. With the help of the gist from JChristensen I verified (read copied) my code for the power down and measured a success - yes it's measurable - 0.1uA !

/* 
Things to safe power, according to datasheet:
 - turn off adc (not needed for LEDs)
 - turn off brown out detection (BOD)
 - turn off analog comparator
 - turn off internal voltage reference 
 - turn off watchdog timer
 - disable port pins per register
 
With the help of JChristensen/AVR Sleep
https://gist.github.com/JChristensen/5616922

*/

#include <avr/sleep.h>
#define BODS 7                     //BOD Sleep bit in MCUCR
#define BODSE 2                    //BOD Sleep enable bit in MCUCR

int leds[] = {4,0,1,2};
void setup() 
{
  for (int i=0; i<4; i++)
  {
    pinMode(leds[i], OUTPUT);
    digitalWrite(leds[i], HIGH);
    delay(200);
    digitalWrite(leds[i], LOW);
    delay(200);
  }
  die_until_reset();
}

void loop() { }

void die_until_reset()
{
  byte  mcucr1, mcucr2;

  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  MCUCR &= ~(_BV(ISC01) | _BV(ISC00));      //INT0 on low level
  ADCSRA &= ~_BV(ADEN);                     //disable ADC
  cli();                                    //stop interrupts to ensure the BOD timed sequence executes as required
  mcucr1 = MCUCR | _BV(BODS) | _BV(BODSE);  //turn off the brown-out detector
  mcucr2 = mcucr1 & ~_BV(BODSE);            //if the MCU does not have BOD disable capability,
  MCUCR = mcucr1;                           //  this code has no effect
  MCUCR = mcucr2;
  sleep_cpu();
}

USB cable tester | code and me whining and winning

2015-09-08 22:21:13

Using the attiny15 footprint/part in eagle from the atmel library for the attiny45 is not right, because B4 and B3 are reversed and it's not the first time I noticed that. But this time I just went in and changed the part in the library. Muahaha. Evil, I know. PCB is updated (again), "code" is here:

#include <avr/sleep.h>

int leds[] = {0,1,2,4};
void setup() 
{
  for (int i=0; i<4; i++)
  {
    pinMode(leds[i], OUTPUT);
    digitalWrite(leds[i], HIGH);
    delay(200);
    digitalWrite(leds[i], LOW);
    delay(200);
  }
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  sleep_mode();
}

void loop() { }

USB cable tester | code and me whining and winning

2015-09-08 22:21:13

Using the attiny15 footprint/part in eagle from the atmel library for the attiny45 is not right, because B4 and B3 are reversed and it's not the first time I noticed that. But this time I just went in and changed the part in the library. Muahaha. Evil, I know. PCB is updated (again), "code" is here:

#include <avr/sleep.h>

int leds[] = {0,1,2,4};
void setup() 
{
  for (int i=0; i<4; i++)
  {
    pinMode(leds[i], OUTPUT);
    digitalWrite(leds[i], HIGH);
    delay(200);
    digitalWrite(leds[i], LOW);
    delay(200);
  }
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  sleep_mode();
}

void loop() { }

USB cable tester | this project... like... so annoying

2015-09-08 14:10:15

I can't believe that I will say this, but there are some really annoying things with this design. The first and most obvious: the usb connectors and the battery connector aren't on the same side! The second one is that the connectors should be plane with the pcb, so that the micro / mini port would be useable with the USB A ports soldered on. I should stop calling designs "final".

I "redesigned" the battery part for eagle and by turning it 90 degrees I was able to save some space.

[UPDATE] Seems like I have connected the wrong pin of the battery holder - I took one of those 5 holes meant for plus, but not the centered one - good thing that I've redesigned that holder.

https://cdn.hackaday.io/images/1103321441707501066.jpg
https://cdn.hackaday.io/images/4262491441714162448.png

USB cable tester | this project... like... so annoying

2015-09-08 14:10:15

I can't believe that I will say this, but there are some really annoying things with this design. The first and most obvious: the usb connectors and the battery connector aren't on the same side! The second one is that the connectors should be plane with the pcb, so that the micro / mini port would be useable with the USB A ports soldered on. I should stop calling designs "final".

I "redesigned" the battery part for eagle and by turning it 90 degrees I was able to save some space.

[UPDATE] Seems like I have connected the wrong pin of the battery holder - I took one of those 5 holes meant for plus, but not the centered one - good thing that I've redesigned that holder.

https://cdn.hackaday.io/images/1103321441707501066.jpg
https://cdn.hackaday.io/images/4262491441714162448.png

USB cable tester | final design (almost)

2015-08-25 21:32:37

ordered... and just saw the mistake on the silkscreen... gnargh. Anyway, don't want to neglect this project - so I ordered them.

https://cdn.hackaday.io/images/7413371440530961914.png

USB cable tester | final design (almost)

2015-08-25 21:32:37

ordered... and just saw the mistake on the silkscreen... gnargh. Anyway, don't want to neglect this project - so I ordered them.

https://cdn.hackaday.io/images/7413371440530961914.png