Search This Blog

Monday, January 27, 2020

Fixing my Weller WESD51 soldering iron - quality not found

I went to the only local electronic part store eons ago to buy replacement part for my older soldering iron. It was a decent iron that lasted such a long time that the store no longer carry the replacement parts.  I bought the WESD51 as it was on a back to school sale and Wellers parts and accessories was easier to find. It was a lemon. Ironically the serial number happens to be 0404 (Quality not found!?)

4 hidden screws under the rubber feet
Right from the start I had a lot of issues with the iron not reading its temperatures correctly. I thought it was a connector issue, but later I found that it was a manufacturing quality problem.  They change a PTC fuse into a larger package (green 2X2 at top of PCB) but didn't do a good job of touching up the soldering on the mismatched footprint.  So I had to fix it up in the first few months.

Control PCB
A trimpot has limited cycles, so personally I wouldn't use it for a temperature control knob. It did last a very long time, but obviously not long enough vs the rest of the iron.  A few months ago,  the temperature setting started jumping beyond my set point due to wiper contact issues. I knew I had to repair it.

PCB back side
As I was opening it up, I found out that they didn't do a proper crimping job on the AC leads of the power transformer as they tried to crimp a tinned wire instead of bare wires!?  Solder is soft, so eventually the wire came loose.

Poor crimp job
Here is the cheese knob for the trimpot.  It was held together with a self tapping screw. I had to put in some hot glue to hold the screw.

Cheap plastic knob for the temperature control
 I ordered the smallest 10K linear potentiometer I can find and they arrived today.  I couldn't find any 2K pots.  Since it is to provide a 0V to Vcc to the ADC. The increase in source impedance could affect the ADC result. One way to fix it it to wire a 0.1uF cap from wiper to Gnd, but that is not needed here.

They are not the greatest quality, but I got a bag of 5 for cheap. They came with washer and a nut.  I use a pencil to trace the outline of the washer on the PCB and milled out a notch for the locating pin.

Modification to the PCB
I mounted the pot onto the PCB and soldered the pins to the existing pads with wires.
Pot connections
I had to remove a bit of the material in front case to clear the mounting hardware for the pot.

Making room for the mounting hardware
I use a reamer to enlarge the hole, so that the PCB can be mounted flush.

Old Radio Shack reamer
It ain't pretty as it is soft plastic. The hole is hidden away by the knob.  The shaft is barely long enough.

The big hole I made
I broke off the cheesy plastic off the knob.  I got some cheap plastic knob from China that is small enough to fit inside the cavity.

Temperature control knob
It wasn't tall enough nor wide enough, so I had to improvise.  I melted about 1/2" of hot glue stick with my hot air tool set at 120C in the cavity.

Hot glue to the rescue
I pushed the plastic knob into the molten hot glue and wait for it to set.  I filed down the knob so that it is flush.  I added some extra hot glue for support on the sides as well.

Improvised knob
One of the things I did to prevent the plastic mounting post from splitting was to use a piece of cable around it.  I wish they would use threaded inserts.


Sunday, January 12, 2020

STM8 LED Clock - Part 2

Go to Part 1

The regular AT-cut crystal has a temperature variation that can be modeled by a cubic equation. Variations from the ideal angle produces the following curves centered around 25C.

AT - cut frequency-temperature characteristics.
If the temperature variation is small enough, then a regular AT-cut crystal might be good enough.
e.g. home with heater during the winter set to 21C and air conditioner set to 25C for the summer. The temperature variation is roughly 4C.

 For a wide temperature range or lower temperature dependency, you might want to use a TCXO (Temperature compensated crystal oscillator).

There are a few  ways of making an accurate clock out of an oscillator:
  1. Use an external accurate clock source and/or resync. the time e.g. GPS or internet time
  2. Try to adjust the clock frequency of the oscillator by changing the load capacitance. This is difficult and the adjustable range might not be enough.
  3. Try to compensate for the tolerance by changing the frequency divider.
I am using the last approach as it is the least expensive and provide a finer repeatable adjustment than what is possible a trimmer capacitor.  The CPU clock is divided down to generate IRQ for the software real time clock.

In my Timer project, I used a hardware timer set to overflow every 60,000. By changing this value,  I can tweak the IRQ by ~ 1/60000 which should be good enough for +/-0.72 sec/day accuracy after calibration. 

This time, I generate a 20Hz IRQ and further divide down the frequency to 10Hz for the RTC using a 24-bit Numerically Controlled Oscillator (NCO). The NCO allows for very fine frequency.adjustments.

The 3 lines NCO code is actually much simpler than the firmware that would be required to extend the hardware timer divider beyond 16 bits.
DDS Code
So far I have calibrated the clock by simply comparing when the clock changes vs https://time.is/ - whether it is faster or slow and by using a binary search algorithm to find the value. This doesn't require any additional coding or equipment, but it takes a bit of time.

The latest calibration is less than +/-1 sec/month after 7-8 turns of such adjustments.  I measured 1 second difference after 4 weeks 6 days.

Additional Reference:
User Interface
The clock and display time:
The arrows key switches between the time and date display.  The date display uses a different format to distinguish the modes.  The 7 segment LED can only show a limited set of characters and have to make the closest approximations. 
e.g. Th(ursday) 16 Jan is shown below.
The user interface is still work in progress as the display is very limited. Here is how to set the time.
How to set time
Alternately, Hold the Menu for ~1 second to exit the setting mode.

Go to Part 3 for my new alarm clock.

Sunday, November 3, 2019

STM8 LED Clock - part 1

I always wanted a VFD clock, but the tubes I have that can fit inside the case I have only have 4 digits. I have recently bought some green 7 segments display that I can find from China. There wasn't any data, but they were cheap. They turn out to be a bit bigger for something else I had in mind, so I might as well put them in good use.
Clock in reused CallerID case
I used a 74HC595 for driving the LED segments. I could have rearranged the GPIO in USB Meter modding to reshuffle the pins for external crystal. 
LED Clock PCB
The I/O assignments are for ease of routing on a single sided home brew PCB. The toner transfer wasn't ideal, but I managed to get it to work.
Segment driver
This driver circuit is on a separate power supply away from the STM8 isolated by D1.  This makes it easier to control the brightness and power backup. 
Power supply
The problem working with undocumented parts is that you have no idea how much current they need until you are committed. I have originally planned to use a zener diode and NPN transistor. 

Luck would have it that 3.3V gives me the right brightness while not overloading the STM8 GPIO used as common cathode driver. I ended up using a XC6206P332MR LDO as it is cheaper than the zener diode + transistor

STM8
The STM8 circuit is pretty boring. GPIO PB4-5 and PD4-6 can be used for expansion. There are 6 common cathode drivers which double up as button inputs and power sense.

The button pulls the pin low via a 10K series resistor (to avoid display artifacts).The firmware changes the GPIO pin to an input with internal pull up during polling. The input supply is sensed via a voltage divider such that leakage voltages (SPI to Vin via the LDO parasitic diode) if present is less than the VIH threshold.

Buttons and Vin sense
STM8S003 has a minimum operating voltage of 2.95V and it resets below 2.8V. So a schottky diode after the 3.3V LDO would not leave much headroom. Also the I/O have higher current rating at 5V. 

STM8 GPIO characteristic
Bare in mind that it is for up to 8 segments leaving less than 2.5mA per segments. I would have needed a driver in the old days. Thankfully even the cheap Chinese LED are efficient. The overall power of the display and the STM8 is around 20mA.

The SPI pins are set as open drain drivers and three 4.7K pull-ups to 3.3V are used for level shifting and isolation. That was the theory.


It turns out the "Slope Control" circuit fires up a P-Buffer for a cycle even in Open Drain mode. When the firmware detects the main supply is off, it bypasses the LED refresh code. This reduced the SPI leakages and dropped STM8 standby power from 5mA to 2mA.

The VDD rail can be backup using a supercap and/or a battery. The regular CR2032 won't work as its voltage would sag below 2.8V at 2mA drain.


A 1F supercap would  in theory gives me around 13 minutes of backup.
 t = (C*dV)/I where I = 2mA, C=1F, dV = (4.7V - 0.3V - 2.8V) = 1.6V 

Tthe 2mA exceeded the datasheet1mA max discharge rate, so the lifetime and backup time would be reduced.

I reused the case of a Caller ID for the clock. The I/O connectors are mounted on a PCB supported by a standoff.

I/O connectors at the back side of the case
I broke out the Power, SWIM, Serial, I2C and a GPIO to a set of 0.1" headers. I kept the original caller ID PCB for mechanical support and connected to the traces  for the buttons.

Wiring the PCB to the I/O panel and supercap
The hardware is completed at this stage.
Clock is assembled
I'll have to work on the firmware and that'll take a while.  There are additional features that I want to work on. The user interface code have to be rewritten due to limited amount of information that can be displayed.

Go to part 2

Files: https://github.com/FPGA-Computer/LED-Clock

Friday, October 4, 2019

USB meter modding - Part 3

The PCB I have ordered from OSH Park arrived.

PCB vs original SOIC-18 microcontroller
The milling wasn't completely perfect, but it is good enough for my needs.  The drill hole is small 0.0197" (0.5mm). One side of the milling was at the mid point of the hole which is the edge of my outline.

Some of the copper were removed by the milling
The goal of the tiny PCB is to replace the hand wired mod.
Hand wired mod vs PCB
I taped down the PCB for soldering/hot air reflow.
I used 3 pieces of "Kapton" tape tohold down the PCB.
Side view f the solder joints
PCB soldered. Blue wires are for SWIM programming
It's alive!
Links: Part 1, Part 2
PCB can be ordered from https://oshpark.com/shared_projects/nWySOWYk 
It is a 2 layers 0.031" (0.8mm) thick PCB

Project file: https://github.com/FPGA-Computer/USB-Voltage-Current-Meter

Friday, September 20, 2019

Canada Post SUX

Once again, the local delivery person from Canada Post destroyed my package.

LED ring has metal backing, cardboard package with plastic.

It was bent really badly
enough to break the PCB traces
All this is because the local delivery person decided to bent the package trying to force it inside my mail box.  It is not like the community mailbox is more than 8 feet away from the mail room or that the person has to fill a 10 page forms to do it.  The person ended up doing it when he/she founds out that my package wasn't quite bendable.  By then it is too late.

Canada Post doesn't list an email contact on their website.  The only way is via social media.


Out of those, Twitter was the least invasive.  Not going to sign up with the rest.

I have decided to try to talk to a person.  It is hard as most companies don't want you to talk to them.  I filed a complain.