Author Topic: what's your recent fail?  (Read 7962 times)

0 Members and 1 Guest are viewing this topic.

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
what's your recent fail?
« on: April 20, 2021, 06:27:43 pm »
Hi folks,

I just made a combo fail. One is, I assumed that in complimentary bjts (like 2n3904 and 2n3906) the smaller part number means NPN. Turned out not to be the case in case of 2SD882 (npn) and KSB772 (pnp).

The second is, I installed transistors backwards. That's because I got pinout from my new transistor tester the wrong way. Turned out contacts on the ZIF socket numbered not the way I expected.

What's your recent fail?

PS transistors and my expensive opamp which I have in single quantity (lt1468) survived the abuse thanks to limiting current when I power the circuit. The opamp tried to sink current from the output, got hot, I noticed that and fixed the circuit.
 

Offline harerod

  • Frequent Contributor
  • **
  • Posts: 449
  • Country: de
  • ee - digital & analog
    • My services:
Re: what's your recent fail?
« Reply #1 on: April 20, 2021, 07:55:20 pm »
Sadly, most likely, your poor, mistreated LT1468 will not match its spec anymore. Better get a invest 12€ in a couple of replacement with the next parts order.
But you knew that already...
« Last Edit: May 03, 2021, 07:56:28 am by harerod »
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #2 on: April 20, 2021, 08:02:02 pm »
Yep, measured offset is 15mV. Either it's oscillating (will check tomorrow), or I fried it. I usually buy at least two ICs of each kind to eliminate doubts when things don't work as expected, but Idk why I have only one of it.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: what's your recent fail?
« Reply #3 on: April 20, 2021, 08:37:58 pm »
Burned four old RF transistors trying to make a buffer amp with them. Seems they don't like running on the edge of ratings (which I don't have, but based on behavior they're somewhere around 20V 200mA -- TO-39 metal can, and I'd even gone to some trouble to heatsink them well!).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #4 on: April 21, 2021, 07:12:48 am »
Burned four old RF transistors trying to make a buffer amp with them. Seems they don't like running on the edge of ratings (which I don't have, but based on behavior they're somewhere around 20V 200mA -- TO-39 metal can, and I'd even gone to some trouble to heatsink them well!).

What were their part numbers, if I may ask?
 

Offline DTJ

  • Frequent Contributor
  • **
  • Posts: 997
  • Country: au
Re: what's your recent fail?
« Reply #5 on: April 21, 2021, 08:31:24 am »
Killed yet another DMM fuse by trying to measure voltage with the test leads in the wrong hole.

I guess manufacturers know this is going to happen and then make the fuses expensive!
 

Offline PartialDischarge

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: 00
Re: what's your recent fail?
« Reply #6 on: April 21, 2021, 09:35:54 am »
Burned four old RF transistors trying to make a buffer amp with them. Seems they don't like running on the edge of ratings (which I don't have, but based on behavior they're somewhere around 20V 200mA -- TO-39 metal can, and I'd even gone to some trouble to heatsink them well!).

Tim

That is completely your fault, next time use a triode and care no more about ratings.

 
The following users thanked this post: Ed.Kloonk, Cyberdragon, RJSV, duckduck

Offline station240

  • Supporter
  • ****
  • Posts: 967
  • Country: au
Re: what's your recent fail?
« Reply #7 on: April 21, 2021, 09:52:40 am »
Measuring waveforms around a circuit I made, and the breadboard test rig I'm using to test it, got very noisy 50V P-P waveforms.
1. Scope probe ground was connected to the wrong ground point (hence the noise).
2. Scope probe had been been bumped out of x10 down to x1 (hence 50V on a 5V circuit)
3. Circuit is more reliable if everything is powered from one 5V source (some of the noise).

So while I suspected I was seeing 50V floating from my isolated 5V supply and changed the setup, it fixed a problem but not the one I had in mind.
The circuit has optoisolators, hence the need to have the scope ground probes on the correct location.

 

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: what's your recent fail?
« Reply #8 on: April 21, 2021, 10:32:21 am »
I forgot to put the charger on a car battery yesterday so a car would be ready for today.

iratus parum formica
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: what's your recent fail?
« Reply #9 on: April 21, 2021, 12:24:15 pm »
What were their part numbers, if I may ask?

TRW / 201 (top)
PT4578 / 7922 (side)

Not new, as you can see. :)


That is completely your fault, next time use a triode and care no more about ratings.

I would gladly, if I had one that offered even a fraction of the bandwidth and ran on the voltages available in circuit. :(

And not for lack of familiarity, or trying: here's a 6LB6 being pulsed at a cool 3kW or so (1270V into 500 ohms).  But as you can see, it's terribly, terribly slow.  Plate capacitance is just way too much.  (Top: plate, 100x, AC coupled; bottom: grid, 10x.)



Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline nicknails

  • Regular Contributor
  • *
  • Posts: 59
Re: what's your recent fail?
« Reply #10 on: April 21, 2021, 12:47:00 pm »
Connected power backwards and damaged 6 IC's  :palm:
 

Offline YurkshireLad

  • Frequent Contributor
  • **
  • Posts: 365
  • Country: ca
Re: what's your recent fail?
« Reply #11 on: April 21, 2021, 02:10:12 pm »
I recently got new glasses, I also now need reading glasses. Of course, I decided not to use the new reading glasses and accidentally connected the ground pin of an AHT10 to 5V input. No magic smoke, but poof! Luckily a minor mistake to a minor component. I'm being more careful and I'm using my reading glasses now too!  :palm:
 

Offline Melt-O-Tronic

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: us
  • Brilliant with a slaughtering iron in my hand!
Re: what's your recent fail?
« Reply #12 on: April 21, 2021, 03:46:48 pm »
I had been injecting power into a circuit with DMM probes connected to my 66309D power supply.  I had another set of probes plugged into a DMM.  A few hours later, working on a completely separate circuit, I picked up the wrong probes to check for the presence of mains voltage.   :palm:

God was merciful.  It only blew a small fuse on the 66309D's motherboard and I had spares.  Ugh.  This is how I learn bad practices.
 

Offline mindcrime

  • Supporter
  • ****
  • Posts: 394
  • Country: us
Re: what's your recent fail?
« Reply #13 on: April 21, 2021, 05:30:22 pm »
My most recent "D'oh, fail!" moment was a few weeks ago. I was playing around with one of those 4-pin crystal oscillators on a breadboard, and getting a reading of a very weak 60hz signal on the scope, even though the part was supposed to be something like 24mhz or something. It didn't take long to figure out that the oscillator wasn't outputting anything, and that what I was seeing on the scope was just line-noise from the 60hz mains in the room. But why wasn't the oscillator oscillating? :scared: :wtf:

Well... it turns out that sometimes when you are looking at a part bottom-side down on the bread-board, and simultaneously looking at the datasheet on a PC screen that's a couple of feet away, and you're not really paying attention to how the part in the diagram is oriented, you can get crossed up on which pins are which. I had wired the thing up like it was upside-down basically. D'oh.  |O  :palm:

Flipped all the connections around and got my signal as expected.   :-+
« Last Edit: April 21, 2021, 05:32:44 pm by mindcrime »
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: what's your recent fail?
« Reply #14 on: April 22, 2021, 12:21:05 am »
I powered up one of my old legacy PCs to copy the BIOS off for someone.  It had been partially disassembled while I decided whether to refurbish it and without the fan noise, I did not realize that I left it on.  By the next day, overheating had apparently damaged it because it no longer starts the POST.
 

Offline artag

  • Super Contributor
  • ***
  • Posts: 1070
  • Country: gb
Re: what's your recent fail?
« Reply #15 on: April 22, 2021, 03:08:17 pm »
Ordered some SMA right-angled sockets. Didn't notice until I'd soldered them in that they were the reverse sort with a pin where the hole should be. Evil things !
 

Offline mindcrime

  • Supporter
  • ****
  • Posts: 394
  • Country: us
Re: what's your recent fail?
« Reply #16 on: April 22, 2021, 06:20:25 pm »
Last night I was soldering headers on a new Arduino 33 IoT board. Got the first side done fine, then started on the other side. Got down to where I had about 4 more pins to solder when I realized that when I inserted the row of headers I misplaced it by one hole, so the D13 pad was empty, and one of my header pins was sticking through the mounting hole.  :palm:

Luckily I was able to cut the "extra" pin off, and then successfully get it solder in place on D13. I tell ya what though... to me, soldering headers like that is one of the most challenging things I ever do, and that's doing a full row where the thing is supported once you tack a couple in place. But soldering a single header pin by itself like that? ^@#!@#&#$%@@#!!!!!  Not fun. If you guys know the "trick" to doing that, please share.
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #17 on: April 22, 2021, 07:33:37 pm »
If you guys know the "trick" to doing that, please share.

I insert headers into the breadboard, this way it's trivial to solder. This also guarantees that after soldering pin headers will fit the breadboard.

It might be difficult to remove the the device after soldering. For this I use IC puller/remover.

If the board is too big to fit the breadboard then I insert only one side, and make a support for the other side.
 
The following users thanked this post: mindcrime, duckduck

Offline duckduck

  • Frequent Contributor
  • **
  • Posts: 408
  • Country: us
  • 20Hz < fun < 20kHz, and RF is Really Fun
Re: what's your recent fail?
« Reply #18 on: April 22, 2021, 07:35:52 pm »
Posted my fail (with "after" picture) 5 days before you asked:

https://www.eevblog.com/forum/beginners/should-i-power-a-device-with-the-leads-hooked-up-backwards-on-the-power-supply/msg3549908/#msg3549908

Oh, the replacement signal generator didn't work. Damn cheap crap off of Amazon...
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #19 on: April 22, 2021, 08:43:16 pm »
Posted my fail (with "after" picture) 5 days before you asked:

Wow, that's quite some explosion!

while I decided whether to refurbish it

I guess the decision has been made :)


Meanwhile my probe slipped and I shorted poor's lt1468 pins to a power rail. Now it's really dead, huh :(. Ordering four more just in case...
 

Offline mindcrime

  • Supporter
  • ****
  • Posts: 394
  • Country: us
Re: what's your recent fail?
« Reply #20 on: April 22, 2021, 09:10:17 pm »
If you guys know the "trick" to doing that, please share.

I insert headers into the breadboard, this way it's trivial to solder. This also guarantees that after soldering pin headers will fit the breadboard.

It might be difficult to remove the the device after soldering. For this I use IC puller/remover.

If the board is too big to fit the breadboard then I insert only one side, and make a support for the other side.

Oh, that's genius! Can't believe that thought never occurred to me. D'oh. Thanks for sharing. I am totally doing that from now on.  :-+ :-+
 

Offline harerod

  • Frequent Contributor
  • **
  • Posts: 449
  • Country: de
  • ee - digital & analog
    • My services:
Re: what's your recent fail?
« Reply #21 on: April 23, 2021, 05:10:25 pm »
exe on Yesterday at 20:33:37mindcrime on Yesterday at 19:20:25
If you guys know the "trick" to doing that, please share.

I insert headers into the breadboard, this way it's trivial to solder. This also guarantees that after soldering pin headers will fit the breadboard.

It might be difficult to remove the the device after soldering. For this I use IC puller/remover.

If the board is too big to fit the breadboard then I insert only one side, and make a support for the other side.

Oh, that's genius! Can't believe that thought never occurred to me. D'oh. Thanks for sharing. I am totally doing that from now on.  :-+ :-+
Just make sure to apply lots of heat, otherwise the plastic of the breadboard would melt. >:D
 

Offline mindcrime

  • Supporter
  • ****
  • Posts: 394
  • Country: us
Re: what's your recent fail?
« Reply #22 on: April 24, 2021, 08:43:24 am »
exe on Yesterday at 20:33:37mindcrime on Yesterday at 19:20:25
If you guys know the "trick" to doing that, please share.

I insert headers into the breadboard, this way it's trivial to solder. This also guarantees that after soldering pin headers will fit the breadboard.

It might be difficult to remove the the device after soldering. For this I use IC puller/remover.

If the board is too big to fit the breadboard then I insert only one side, and make a support for the other side.

Oh, that's genius! Can't believe that thought never occurred to me. D'oh. Thanks for sharing. I am totally doing that from now on.  :-+ :-+
Just make sure to apply lots of heat, otherwise the plastic of the breadboard would melt. >:D

FWIW, I was soldering headers on another Arduino Nano tonight and I tried this technique of jamming the headers in the breadboard. The board width wasn't just right for both rows to plug in, so I did one side, and just used a few wads of heat shrink tubing to support the other side. Worked a treat. Much nice than trying to tack them in place with glue or tacky blue loctite goop, etc., and then solder with the board elevated.

I'll definitely be using this in the future when dealing with header pins. Thanks again for sharing the tip, exe!
 

Offline Ice-Tea

  • Super Contributor
  • ***
  • Posts: 3070
  • Country: be
    • Freelance Hardware Engineer
Re: what's your recent fail?
« Reply #23 on: April 24, 2021, 09:03:16 am »
Needed a 1kV signal so hooked up my bench DMM to the source to tune it. Turned on the source.

...

The source goes up to 2kV and that was exactly what it was still set to. Hint: the bench DMM goes up to 1kV.
 
The following users thanked this post: bd139

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23024
  • Country: gb
Re: what's your recent fail?
« Reply #24 on: April 24, 2021, 09:05:49 am »
 :-DD. Reminds me of the BM22s I tortured a while back



Still works even when it got 2.1KV! Made some unpleasant noises though.
 

Offline Ice-Tea

  • Super Contributor
  • ***
  • Posts: 3070
  • Country: be
    • Freelance Hardware Engineer
Re: what's your recent fail?
« Reply #25 on: April 24, 2021, 09:08:45 am »
Yeah, well, I briefly saw something about temperature on the display and that was all she wrote.

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23024
  • Country: gb
Re: what's your recent fail?
« Reply #26 on: April 24, 2021, 09:11:17 am »
RIP  :-BROKE
 

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: what's your recent fail?
« Reply #27 on: April 24, 2021, 09:43:30 am »
Needed a 1kV signal so hooked up my bench DMM to the source to tune it. Turned on the source.

...

The source goes up to 2kV and that was exactly what it was still set to. Hint: the bench DMM goes up to 1kV.
I hoped you were going to tell us that the probe wires have a 500v loss across each one.
iratus parum formica
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #28 on: April 24, 2021, 05:43:42 pm »
Hint: the bench DMM goes up to 1kV.

What was the model of DMM?
 

Offline Ice-Tea

  • Super Contributor
  • ***
  • Posts: 3070
  • Country: be
    • Freelance Hardware Engineer
Re: what's your recent fail?
« Reply #29 on: April 24, 2021, 05:50:55 pm »
Rigol DM3058E

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #30 on: April 27, 2021, 09:37:09 am »
Oh boy, I think I bought lt1468-2 instead of lt1468. No wonder my circuit oscillated.

I found that lt1468 and lt1468-2 are confused in many places, including in the part's datasheet and ltspice. I reported errors to analog.com and mouser, will see if they fix them.
 

Offline Gribo

  • Frequent Contributor
  • **
  • Posts: 629
  • Country: ca
Re: what's your recent fail?
« Reply #31 on: April 28, 2021, 08:09:25 pm »
Connected the /wr line of AD8251 to the positive rail instead of the negative  |O
I am available for freelance work.
 

Offline galvanix

  • Contributor
  • Posts: 38
  • Country: de
Re: what's your recent fail?
« Reply #32 on: April 29, 2021, 02:18:54 pm »
My recent fail is thinking the global chip shortage isn't going to affect my small hobby project for some reason. I designed the PCB on the weekend and spec'd all the parts.
Got the message that the PCBs were shipped to day.
When ordering parts I find out that my chosen chip (TPS65253-5) is out of stock everywhere with 35 week lead time. :palm:

Well, at least I don't have to pay the import duties on the PCBs when I get a letter from the customs office. ;D
 

Offline WattsThat

  • Frequent Contributor
  • **
  • Posts: 766
  • Country: us
Re: what's your recent fail?
« Reply #33 on: April 29, 2021, 03:01:05 pm »
FWIW, TPS65253RHDR DigiKey has 4300 pieces in stock.

I’m putting in an order tomorrow. Can post them in a padded bag to Germany for cheap if it’s just a couple of pieces.
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #34 on: April 29, 2021, 03:19:38 pm »
When ordering parts I find out that my chosen chip (TPS65253-5) is out of stock everywhere with 35 week lead time. :palm:

Huh, I feel you here. I couldn't find opa2192 anywhere. Guess what, it showed up (but in weird qty of 24) in Mouser two days after I placed the order. It's so strange to see shortage on opamps, but it's not the first time. I found reports from 2018 that it was hard to get it. So, I'll try to substitute it for now.
 

Offline Ice-Tea

  • Super Contributor
  • ***
  • Posts: 3070
  • Country: be
    • Freelance Hardware Engineer
Re: what's your recent fail?
« Reply #35 on: April 29, 2021, 03:25:13 pm »
...(but in weird qty of 24)...

Tube?

Offline galvanix

  • Contributor
  • Posts: 38
  • Country: de
Re: what's your recent fail?
« Reply #36 on: April 29, 2021, 04:57:32 pm »
FWIW, TPS65253RHDR DigiKey has 4300 pieces in stock.

I’m putting in an order tomorrow. Can post them in a padded bag to Germany for cheap if it’s just a couple of pieces.

Thanks for the offer, but I actually had a typo in the part number. I was looking for a TPS652353 which is a voltage regulator specifically designed for universal LNBs. I wanted to make my own LNB bias tee for receiving the QO-100 amateur radio satellite using off-the-shelf universal LNBs.
 

Offline josh132

  • Contributor
  • Posts: 37
  • Country: us
  • OSCILLOSCOPE
Re: what's your recent fail?
« Reply #37 on: April 30, 2021, 12:58:17 am »
cap in reverse polarity.
bu du bu nu
 

Offline AndrewNorman

  • Contributor
  • Posts: 21
  • Country: au
Re: what's your recent fail?
« Reply #38 on: April 30, 2021, 08:47:49 am »
Getting 5V and 12V power supply outputs mixed up when playing with a LED/resistor pair to test brightness.

One very bright followed by one very dead LED later.
 

Offline mindcrime

  • Supporter
  • ****
  • Posts: 394
  • Country: us
Re: what's your recent fail?
« Reply #39 on: April 30, 2021, 01:51:45 pm »
As part of this reflow oven project, I bought an Adafruit MAX38556 breakout board for reading temperatures from a thermocouple. Last night I broke that out, soldered the headers on, and jumpered it to an Arduino and loaded the sample sketch. And BOOM, I got temperatures.

In Celsius.

I live in the USA. To us, Celsius barely exists... it's some weird abomination that's used by people from weird places like the UK, Europe, Australia, etc. So of course being the flag-waving nationalist that I am, I just had to convert the temperature to good ole Fahrenheit. So I wrote code that looked something like this:

Code: [Select]
Serial.println( ( maxtemp.readCurrentTemperature() * (9/5) ) + 32);

And none of the numbers that got displayed looked right. The thermocouple was apparently reporting the ambient temperature in the room as off by about 10°. Moving the thermocouple tip close to a lightbuib had the effect of sending the numbers higher, but still off by quite a bit.

Does everybody see my mistake? It's subtle in a sense, but very obvious in another sense.


.


.



.



.



.


.



.



.


.


.


.


.



.


.



.


.


The problem is integer division. Dividing an integer by an integer (9/5) yields an integer (1). To get the expected value there [1.8] I had to either make one (or both) of those literals a float, or cast one of them to float during the calculation. The easy fix was just to change that expression to (9.0/5.0). D'oh.


And of course I'm just kidding about the nationalist bit. But an (unfortunate?) side effect of having lived in the USA my whole life, is that using Fahrenheit does, indeed, come much more naturally to me. So when it comes to recognizing something like, say, the ambient temperature in the room, I can only really process something like that in F° without jumping through hoops to do conversions.

When implementing the reflow oven, I expect all the temperature stuff will be done in C° as that's probably how the solder paste manufacturer specifies their temperature profile.
« Last Edit: April 30, 2021, 01:53:33 pm by mindcrime »
 

Offline RichC

  • Contributor
  • Posts: 14
  • Country: gb
Re: what's your recent fail?
« Reply #40 on: April 30, 2021, 04:12:08 pm »
Laid out my board, got it made up (luckily a DIY job on the CNC not a fab) and mounted everything on it. It didn't work. Checked things over. I had swapped drain and source on a mosfet.  :palm:
I can't even easily fix it because it's half of a single package pair so it would mean swapping pin 2 to pin 4 (on a 6 pin package). Guess I'm making a new PCB for that one.
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: what's your recent fail?
« Reply #41 on: April 30, 2021, 11:08:06 pm »
Laid out my board, got it made up (luckily a DIY job on the CNC not a fab) and mounted everything on it. It didn't work. Checked things over. I had swapped drain and source on a mosfet.  :palm:
I can't even easily fix it because it's half of a single package pair so it would mean swapping pin 2 to pin 4 (on a 6 pin package). Guess I'm making a new PCB for that one.
Dead bug the IC, small bare wire and steady hands might let you test the rest of the board until your re-spin arrives
Never mind, you're cncing the pcb
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #42 on: May 01, 2021, 07:48:54 am »
I live in the USA. To us, Celsius barely exists... it's some weird abomination that's used by people from weird places like the UK, Europe, Australia, etc.

I can imagine how weird it is to use a "wrong" scale. When I was in the UK they measured my weight in ... stone. What is that, a measure system from the stone edge? (kidding).

I had swapped drain and source on a mosfet.  :palm:

Ouch, that must be painful  :'(
 

Offline harerod

  • Frequent Contributor
  • **
  • Posts: 449
  • Country: de
  • ee - digital & analog
    • My services:
Re: what's your recent fail?
« Reply #43 on: May 01, 2021, 03:32:32 pm »
mindcrime, if you don't mind a suggestion from an old German guy who went to uni in Konrad-Zuse-Strasse:
No need for float, if you can make sure that your integer accumulator is large enough.
Make sure to tell your MCU in which order to process the numbers. If you don't trust brackets and precedence, do:

int16_t accu; // (adequate till 2^15 / 9 )
accu = maxtemp.readCurrentTemperature();
accu *= 9;
accu /= 5;
accu += 32;
Serial.println( accu );

or:

Serial.println( (int)(( maxtemp.readCurrentTemperature() * (9./5) ) + 32));
 
The following users thanked this post: Ed.Kloonk, mindcrime

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: what's your recent fail?
« Reply #44 on: May 01, 2021, 07:30:45 pm »
You can even take the remainder (from the division) and, if it's 3 or 4, add 1 to the result to get correct rounding.

Or uh... add 2 before the division, I suppose.

Or to maintain accuracy, multiply by say 16 (or << 4), to get 12.4 fixed point -- this shift has to be un-done for printing, so it may be a bit inconvenient, or the 62mK resolution may simply be unnecessary.

That is:

Code: [Select]
accu = readCurrentTemperature() * 9;
accu <<= 4;
accu /= 5;
accu += 32 << 4;
printf("%d", accu >> 4);
printf(".%03d\n", ((accu & 0x0f) * 125) >> 1);

Or if you want to write out the print routine yourself, take the fractional part (accu & 0x0f), multiply by 10 to get a new digit above the decimal, print the digit, mask it off, and repeat:

Code: [Select]
for (...) {
frac = frac * 10;
printf("%d", (frac & 0xf0) >> 4);
}

Only a few digits are needed, since 4 bits of fraction = (0..15) / 16, which by itself doesn't fit into 1 digit (but the fifth in the present problem handily does), does easily fit into 2 digits (100ths), and terminates after 4 digits (0.0625000, etc.).

This is, in part, how you work with fixed point numbers.  Once you get a feel for them, it's not much harder to work with than floats in most problems, and goes much faster on most embedded platforms. :-+


I can report my own partial fail in this regard, as I had a recent problem with just too much dynamic range in play to handle easily even in 32 bit fixed point; as I couldn't justify spending time figuring it out, I fell back on floating point, which actually only added about 2kB to the binary, and my MCU had plenty of cycles to spare for the operation.  (This was math in the complex domain, a bit weightier than whole numbers -- that's already 64 bits per complex number.  Doing it with [32 bit] floats, takes up as much memory, but I don't have to pay any attention at all to dynamic range and shifting -- that's really what it's about, a "floating point" is literally just doing that every time.)

Tim
« Last Edit: May 01, 2021, 07:35:44 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: Ed.Kloonk

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1417
  • Country: ua
Re: what's your recent fail?
« Reply #45 on: May 01, 2021, 09:40:57 pm »
or:
Serial.println( (int)(( maxtemp.readCurrentTemperature() * (9./5) ) + 32));
Why not this (I'm not C, C++ developer):
Serial.println((int)(( (maxtemp.readCurrentTemperature() * 9)/5 ) + 32)); ?
« Last Edit: May 05, 2021, 12:40:34 pm by Vovk_Z »
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: what's your recent fail?
« Reply #46 on: May 01, 2021, 10:13:59 pm »
This is, in part, how you work with fixed point numbers.  Once you get a feel for them, it's not much harder to work with than floats in most problems, and goes much faster on most embedded platforms. :-+
A more natural way is to use a unit which has enough resolution by itself. Like milli-Fahrenheit in this case. It is a good practise to always use clear SI units in software.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: what's your recent fail?
« Reply #47 on: May 01, 2021, 10:56:37 pm »
I avoid units where possible, as numbers are just that: numbers, dimensionless and arbitrary.

For example, an ADC reading isn't any particular voltage or current or whatever: it's some ratio to whatever VREF was at that instant.  If VREF is very well known, it also corresponds to a meaningful (calibrated) value, but it's not necessary to track it as such.  And with the ADC reading being scaled to a power of 2, you're only going to lose dynamic range by using different units in software.  Most applications do eventually need to record or display units, but that can be done entirely at the end: a gain factor (and offset if applicable) before printing and you're set.

(So yes, I find those special-value references a bit amusing.  2.048V, 4.096V, who cares? ;D )

(I will add, this is particularly useful for core operations, heavy on numeric analysis and independent of application.  At higher levels -- especially if floats are heavily involved -- using units is probably a good idea.  Scientific computation for example.)

Tim
« Last Edit: May 01, 2021, 10:58:12 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: what's your recent fail?
« Reply #48 on: May 01, 2021, 11:10:32 pm »
I avoid units where possible, as numbers are just that: numbers, dimensionless and arbitrary.

For example, an ADC reading isn't any particular voltage or current or whatever: it's some ratio to whatever VREF was at that instant.  If VREF is very well known, it also corresponds to a meaningful (calibrated) value, but it's not necessary to track it as such.  And with the ADC reading being scaled to a power of 2, you're only going to lose dynamic range by using different units in software.  Most applications do eventually need to record or display units, but that can be done entirely at the end: a gain factor (and offset if applicable) before printing and you're set.
In theory yes, but software is much easier to maintain if the next person doesn't need to figure by what odd value a variable is scaled. When I read a value from an ADC I always convert it to Volts. That the reading is accurate to the extend of the quality of the reference should go without saying. Trouble shooting is much easier when the firmware says it is reading 3.22 Volts and the DMM connected to the input of the circuit says the same.
« Last Edit: May 01, 2021, 11:12:05 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: what's your recent fail?
« Reply #49 on: May 02, 2021, 07:18:13 pm »
while I decided whether to refurbish it

I guess the decision has been made :)

If it was only that simple.  After several days of randomly changing various things with no positive result, I was inspired to leave it powered up, and after several more days it POSTed.  Now it reliably POSTs, so far.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: what's your recent fail?
« Reply #50 on: May 02, 2021, 08:28:42 pm »
BTW: an interesting fail (not from my side) but I still think it is good to share: About a decade ago I have designed a PCB for a customer with a SoC and some DDR memory. For today's standards it is not a high density design. This board has always produced nicely without low numbers of failed boards but the customer changed to a different assembler and the number of failed boards increased massively. A lot of effort went into finding why the board failed and it turned out that when the DDR memory is cold a significant number of boards won't start. In the end the board itself remained the only suspect and it turned out the circuit board manufacturer had made the traces wider in order to produce it on a production process not quite suitable for the board. Probably some of the length tuned serpentine traces have a short between them creating a stub or timing error. The same components on a board made with a better etching process have no problems.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline rsjsouza

  • Super Contributor
  • ***
  • Posts: 5986
  • Country: us
  • Eternally curious
    • Vbe - vídeo blog eletrônico
Re: what's your recent fail?
« Reply #51 on: May 02, 2021, 10:51:31 pm »
Many decades ago on an internship I worked on a prototype board (an ISA PC card) that had two voltage voltage regulators (7805, 7812) vertically mounted (not my design).

Along the process of debugging the board and its firmware, I had to remove and put the board back a few times a day. Due to space constraints, this board could only be placed beside another board that controlled the Data I/O 8051 EPROM programmer.

One day in a distraction I put our board on its slot but did not realize the two voltage regulators were touching the other board... A silent but deadly zap took the EPROM programmer down. Needless to say that the design was changed and the regulators were put horizontally...
Vbe - vídeo blog eletrônico http://videos.vbeletronico.com

Oh, the "whys" of the datasheets... The information is there not to be an axiomatic truth, but instead each speck of data must be slowly inhaled while carefully performing a deep search inside oneself to find the true metaphysical sense...
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #52 on: May 03, 2021, 06:29:33 am »
After several days of randomly changing various things with no positive result, I was inspired to leave it powered up, and after several more days it POSTed.  Now it reliably POSTs, so far.

That's weird but... When I worked in a datacenter I had similar issues with motherboards that at first appeared to be dead. Like, I remember after a power outage I had to repair a very old server, in a crudely-made enclosure (replace and hdd or something like that). I dropped a screw on the motherboard. The server shut down itself immediately and denied to start again. Worse yet, I didn't have spare parts for old piece of junk it was. Lucky me, somehow it started after 15 minutes after tens of attempts to boot it.
 

Offline KE5FX

  • Super Contributor
  • ***
  • Posts: 1891
  • Country: us
    • KE5FX.COM
Re: what's your recent fail?
« Reply #53 on: May 03, 2021, 06:54:34 am »
BTW: an interesting fail (not from my side) but I still think it is good to share: About a decade ago I have designed a PCB for a customer with a SoC and some DDR memory. For today's standards it is not a high density design. This board has always produced nicely without low numbers of failed boards but the customer changed to a different assembler and the number of failed boards increased massively. A lot of effort went into finding why the board failed and it turned out that when the DDR memory is cold a significant number of boards won't start. In the end the board itself remained the only suspect and it turned out the circuit board manufacturer had made the traces wider in order to produce it on a production process not quite suitable for the board. Probably some of the length tuned serpentine traces have a short between them creating a stub or timing error. The same components on a board made with a better etching process have no problems.

Did you specify the stackup, or go with the fab's default?  It may have changed.  Some of the Chinese fabs have been using a single layer of prepreg between the L1 and L2 copper, which is obviously like putting a capacitor in parallel with every node on those layers.  Makes for nice skinny 50-ohm traces, at least until they reach a component pad...
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: what's your recent fail?
« Reply #54 on: May 03, 2021, 07:42:57 am »
BTW: an interesting fail (not from my side) but I still think it is good to share: About a decade ago I have designed a PCB for a customer with a SoC and some DDR memory. For today's standards it is not a high density design. This board has always produced nicely without low numbers of failed boards but the customer changed to a different assembler and the number of failed boards increased massively. A lot of effort went into finding why the board failed and it turned out that when the DDR memory is cold a significant number of boards won't start. In the end the board itself remained the only suspect and it turned out the circuit board manufacturer had made the traces wider in order to produce it on a production process not quite suitable for the board. Probably some of the length tuned serpentine traces have a short between them creating a stub or timing error. The same components on a board made with a better etching process have no problems.

Did you specify the stackup, or go with the fab's default?  It may have changed.  Some of the Chinese fabs have been using a single layer of prepreg between the L1 and L2 copper, which is obviously like putting a capacitor in parallel with every node on those layers.  Makes for nice skinny 50-ohm traces, at least until they reach a component pad...
The stackup is not very critical for this design but that wasn't the problem; the stackup was the same.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline mindcrime

  • Supporter
  • ****
  • Posts: 394
  • Country: us
Re: what's your recent fail?
« Reply #55 on: May 03, 2021, 01:10:34 pm »
mindcrime, if you don't mind a suggestion from an old German guy who went to uni in Konrad-Zuse-Strasse:
No need for float, if you can make sure that your integer accumulator is large enough.
Make sure to tell your MCU in which order to process the numbers. If you don't trust brackets and precedence, do:

int16_t accu; // (adequate till 2^15 / 9 )
accu = maxtemp.readCurrentTemperature();
accu *= 9;
accu /= 5;
accu += 32;
Serial.println( accu );

or:

Serial.println( (int)(( maxtemp.readCurrentTemperature() * (9./5) ) + 32));

Don't mind at all! This, and the ensuing discussion, has been enlightening for me. I've learned a new thing or two.

That said, in the actual code that will run on the oven controller, there won't be any need for this conversion stuff at all. Everything will be done in Celsius. This code was only a convenience for me so I could easily "eyeball" the numbers from the thermocouple and see if they looked right or not.

 
The following users thanked this post: harerod

Offline harerod

  • Frequent Contributor
  • **
  • Posts: 449
  • Country: de
  • ee - digital & analog
    • My services:
Re: what's your recent fail?
« Reply #56 on: May 04, 2021, 06:00:55 am »
mindcrime, thank you for your kind words. I kept my comment es short as possibly, as not to scare you off. Integer arithmetic is a huge and interesting topic, arguably worth a thread in the Microcontroller section.

One huge advantage of integers over floating point hasn't been mentioned yet:
The precision of integer arithmetics can be predicted more easily than that of floats. Automatic mantissa/exponent adjustment might be a good starting point for research.
This all leads to the classic fail, where a newbie compares two floats for identity to exit a loop...

T3sl4co1l, I like your extension to my remark.
I love the reference to 2.048V references even better, knowing that an ADR420A will come with 2.045..2.051V initial output voltage. In that context a REF2920 2.007..2.048..2.089V becomes outright hilarious, especially knowing that many designers won't read past the marketing text on page 1 of the datasheet.

Regarding accu size on integer machines - does anybody remember the DSP56K series? 24bit registers, leaving a lot of leeway for operations on 16bit audio. That was the bee's knees in 1990's embedded audio processing. I remember doing active noise cancelling with those. Taking DSP56K as a reference, doing DSP on a ARM Mx feels like a dream.
 

Offline harerod

  • Frequent Contributor
  • **
  • Posts: 449
  • Country: de
  • ee - digital & analog
    • My services:
Re: what's your recent fail?
« Reply #57 on: May 04, 2021, 06:14:21 am »
nctnico, regarding your PCB fail: I would be curious as how you followed up in that PCB issue. Stealthily "optimizing" designs is an absolute showstopper in my book. One of my customers recently found out that a manufacturer had adjusted my layout (fully specified PCB), without giving feedback. That was for a medical device, which carries medical EMI and safety certificates plus ETSI. I can pat myself on the shoulder that the design is robust enough to keep functioning, but this isn't the point. The point is that a manufacturer didn't produce what was ordered and thus potentially endangered patients.
 

Offline Humanoid

  • Regular Contributor
  • *
  • Posts: 88
  • Country: us
Re: what's your recent fail?
« Reply #58 on: May 05, 2021, 11:29:42 pm »
Small fail recently: Opened up a piece of used audio gear and was a little too forceful with removing a connector and tore the wires out of the solder points.  >:D The wires were frayed so I had to replace them anyway and the connector was unscathed, so it wasn't a big deal.

Also snapped a pin off a battery holder, but it was a flimsy piece of #%@^@& so I'm not hurt by it :P

 
The following users thanked this post: Ed.Kloonk

Offline twospoons

  • Regular Contributor
  • *
  • Posts: 228
  • Country: nz
Re: what's your recent fail?
« Reply #59 on: May 06, 2021, 03:41:26 am »
SPI - forgot that MOSI and MISO need to be crossed over (not MOSI to MOSI and MISO to MISO !) . So, another board revision needed. Stupid mistake.
 

Offline exeTopic starter

  • Supporter
  • ****
  • Posts: 2562
  • Country: nl
  • self-educated hobbyist
Re: what's your recent fail?
« Reply #60 on: May 06, 2021, 11:32:45 am »
SPI - forgot that MOSI and MISO need to be crossed over (not MOSI to MOSI and MISO to MISO !) . So, another board revision needed. Stupid mistake.

I'd say MOSI of master connects to MOSI of the slave, no? So, it's MOSI to MOSI. MOSI = "master out, slave in"
 

Offline harerod

  • Frequent Contributor
  • **
  • Posts: 449
  • Country: de
  • ee - digital & analog
    • My services:
Re: what's your recent fail?
« Reply #61 on: May 06, 2021, 11:40:13 am »
SPI:
1) at a slave the pins are usually called something like Serial Data Out / Serial Data In. That makes the whole setup much clearer.

2) in a situation like this one really starts to appreciate serial terminators

Coming from a guy who managed to confuse RX/TX on one interface on some board with 5 asynchronous interfaces and 1 SPI. Single FAILure on a PCB with 600 components...
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: what's your recent fail?
« Reply #62 on: May 06, 2021, 02:38:25 pm »
I much greatly prefer the MOSI/MISO terminology to RX/TX.  It's a shame it's not standard for async.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: artag, KE5FX

Offline Refrigerator

  • Super Contributor
  • ***
  • Posts: 1542
  • Country: lt
Re: what's your recent fail?
« Reply #63 on: May 06, 2021, 03:19:36 pm »
2AM me forgot to tidy up the silkscreen before i sent my files to the fab.
I have a blog at http://brimmingideas.blogspot.com/ . Now less empty than ever before !
An expert of making MOSFETs explode.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: what's your recent fail?
« Reply #64 on: May 06, 2021, 03:47:39 pm »
nctnico, regarding your PCB fail: I would be curious as how you followed up in that PCB issue. Stealthily "optimizing" designs is an absolute showstopper in my book. One of my customers recently found out that a manufacturer had adjusted my layout (fully specified PCB), without giving feedback.
Usually assemblers do give feedback about changes they want to make to PCBs and in most cases I change the design instead of having the assembler change the Gerber files. In this case I wasn't involved in outsourcing the design to it could be that the assembler has given feedback and the customer gave an OK or not. From the little information I have it seems the PCB manufacturer has changed the Gerbers on their own though. This came to light after ruling any other possibility out and the problem had to be the PCB itself. The assembler wanted to order PCBs from a local quick turn around outfit which promptly complained the clearances where way below of what they could produce. From there it got clear where the problem is quickly.

In a broader sense having changes made to PCBs layouts by an assembler is a bit of a grey area. You'd say soldering is soldering but every assembler I have come across so far seems to have a specific setup / workflow. PCBs one assembler can solder without any problems are a nightmare to solder for the other (using the manufacturer specified land patterns and paste mask).
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline harerod

  • Frequent Contributor
  • **
  • Posts: 449
  • Country: de
  • ee - digital & analog
    • My services:
Re: what's your recent fail?
« Reply #65 on: May 06, 2021, 05:24:52 pm »
nctnico, thanks for the feedback. Just my observation: for series production, the PCB has to be optimized for the actual manufacturing process. The structures on the PCB plus the components must fit the solder profile. The series manufacturer will try to improve troughput by using the shortest time profile possible.
I see a similar thing with certain cable harness manufacturers, who turn the solder temperature way up, to reduce solder time.

A prototype manufacturer has most of the overall effort in setting up the production, so they  can take it easier on the speed. Tombstones are nonexistent when I solder with my lab equipment, rare with prototype manufacturing, but will appear in in series production.

I prefer to run prototypes in the series process. Since other restrictions apply (budget, time), I can rarely do this nowadays.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: what's your recent fail?
« Reply #66 on: May 07, 2021, 11:51:12 pm »
After several days of randomly changing various things with no positive result, I was inspired to leave it powered up, and after several more days it POSTed.  Now it reliably POSTs, so far.

That's weird but... When I worked in a datacenter I had similar issues with motherboards that at first appeared to be dead. Like, I remember after a power outage I had to repair a very old server, in a crudely-made enclosure (replace and hdd or something like that). I dropped a screw on the motherboard. The server shut down itself immediately and denied to start again. Worse yet, I didn't have spare parts for old piece of junk it was. Lucky me, somehow it started after 15 minutes after tens of attempts to boot it.

I have no explanation yet and it took a couple days before it POSTed.  I will be installing Windows 7 on it and maybe it will fail again with some indication of what is going on.
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: what's your recent fail?
« Reply #67 on: May 08, 2021, 12:54:22 am »
After several days of randomly changing various things with no positive result, I was inspired to leave it powered up, and after several more days it POSTed.  Now it reliably POSTs, so far.

That's weird but... When I worked in a datacenter I had similar issues with motherboards that at first appeared to be dead. Like, I remember after a power outage I had to repair a very old server, in a crudely-made enclosure (replace and hdd or something like that). I dropped a screw on the motherboard. The server shut down itself immediately and denied to start again. Worse yet, I didn't have spare parts for old piece of junk it was. Lucky me, somehow it started after 15 minutes after tens of attempts to boot it.

I have no explanation yet and it took a couple days before it POSTed.  I will be installing Windows 7 on it and maybe it will fail again with some indication of what is going on.

I've just finished having similar issues.
My original rig died which required me to purchase a new power supply and motherboard. I had to go 2nd hand with the mother board so I didn't have to buy a new cpu.

The board would not power up after switching the power supply off or unplugging it. You have to wait several minutes after applying power to the psu before the power button would work.

I did some probing with the aid of a boardview file and found the 3VSB (standby) rail had a massive low frequency ripple from 3V to 1V at first and after some minutes it would stabilize to a solid 3V. At that stage it would work.

Initially I though it had something to do with the cmos battery which measured 3V but would drop to less than a volt if you loaded it with a handfull of mA's.
I replaced said battery and nothing changed.

I suspect a fault with the board somewhere that needs something to charge before the 3V rail comes good.

In this board the 3VSB rail is used to apply logic levels to the "super I/O" chip which handles pulling the psu's pwron pin low
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: what's your recent fail?
« Reply #68 on: May 08, 2021, 03:19:03 am »
I've just finished having similar issues.
My original rig died which required me to purchase a new power supply and motherboard. I had to go 2nd hand with the mother board so I didn't have to buy a new cpu.

The board would not power up after switching the power supply off or unplugging it. You have to wait several minutes after applying power to the psu before the power button would work.

I did some probing with the aid of a boardview file and found the 3VSB (standby) rail had a massive low frequency ripple from 3V to 1V at first and after some minutes it would stabilize to a solid 3V. At that stage it would work.

Initially I though it had something to do with the cmos battery which measured 3V but would drop to less than a volt if you loaded it with a handfull of mA's.
I replaced said battery and nothing changed.

I suspect a fault with the board somewhere that needs something to charge before the 3V rail comes good.

In this board the 3VSB rail is used to apply logic levels to the "super I/O" chip which handles pulling the psu's pwron pin low

I checked the voltages from the original power supply and found no problems, but changed the power supply anyway and it still did not work.  Then I messed with the CMOS battery and resetting the CMOS data without effect.  It finally POSTed after being left on for days and that was without the CMOS battery, but I have since put a new CMOS battery in and it still POSTs.

What I have not done is left it off since it first started POSTing again, but eventually that will happen.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf