Purpose of a strange diode/resistor combination - Page 1
Forum section: electronics / beginners

author: mwalle
author_rank: Newbie
timestamp: June 28, 2024, 08:06:08 pm
content: Hi,After googling for an alternative firmware for my cheap chinese hot plate UYUE 946 I've stumbled across the following website:https://www.weigu.lu/microcontroller/uyue_946_hack/index.htmlSomeone already reverse engineered the PCB. Most makes sense (although the uC could also be a CH32V003) but I cannot make any sense of the D1/R1 combination. D1 is also a through hole component, you can look at the backside picture. If you have a look at the schematics, the diode is connected to Pin 3 of the uC which might be an analog input. I could just image that this is some kind of voltage reference. But the uC should also have an internal voltage reference...Does anyone have an idea what that might be for?-michael

author: MK14
author_rank: Super Contributor
timestamp: June 28, 2024, 08:18:50 pm
content: My guess would be a temperature sensor. Silicon diodes, usually reduce the voltage drop (Vf) across the silicon diode, by around 1.8 millivolts per degree C. Especially useful for seeing relative temperature changes, as the initial voltage drop (at room temperature), can vary between devices, to a small degree.More about it here:https://en.wikipedia.org/wiki/Silicon_bandgap_temperature_sensorThe bandgap is a more sophisticated version, but I was referring to the low cost, single diode method.Quote

author: Phil1977
author_rank: Frequent Contributor
timestamp: June 28, 2024, 08:20:56 pm
content: To read out a thermocouple you need a reference temperature.Is it possible the circuit is reading the forward voltage of this diode for the absolute temperature measurement? I didn't see any NTC or comparable part.

author: mwalle
author_rank: Newbie
timestamp: June 29, 2024, 08:33:22 am
content: Thanks for your guessesQuoteMight be. But then it will be a very crude one because the voltage directly feeds into the ADC and if the reference of the ADC is 5V (just a guess, it might also be switchable to an internal generated voltage), 3mV will be in the range of a few digits with a 12bit ADC.QuoteCould you elaborate a bit more on that? Doesn't a thermocouple return a specific voltage for a given temperature? Also, like above the reference would be very inaccurate for the same reason as above. Whereas the voltage change of the thermocouple is amplified by the opamp.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: June 29, 2024, 08:49:33 am
content: Quote from: mwalle on June 28, 2024, 08:06:08 pmIt's almost certainly not - as the linked page suggests - an STM8, nor a CH32V. It's probably one of any number of STM8S003 pin-compatible asian-brand microcontrollers that are typically 8051 or Cortex M0+.Looking at the reverse-engineered schematic on the linked page, one thing stands out to me that can dismiss the STM8 and CH32V, and possibly narrow down the potential candidates: that there aretwosignal lines from the microcontroller that go to the programming header. Neither the STM8S nor CH32V003 need this - they each only have a single data line for programming. In fact, an STM8S could not work in the configuration shown, because it requires a capacitor on the VCAP pin for the internal voltage regulator (CH32V does not have such a thing; pin 8 is a regular GPIO).One microcontroller that I am aware of that has a TSSOP-20 '003 compatible pin-out and that has programming signals on pins 8 and 18 is theWHXY CW32F003F4P7ARM Cortex M0+ micro. Pin 8 is SWDIO and pin 18 is SWCLK. It's probably not this exact chip, but some other that also has clock/data programming lines on those pins.By the way, adatasheet for the SZ2525Cwas easy to find on LCSC.Edit:I think I may have found a candidate for the MCU.TheWisesun WS51F0030. It's an 8051-based microcontroller. Has the programming clock/data pins in the aforementioned locations. Also runs on 5V (some ARM MCUs are not a match as they only run on 3.3V). And, according to the pictures on LCSC at least, has no top markings.

author: Phil1977
author_rank: Frequent Contributor
timestamp: June 29, 2024, 10:03:26 am
content: Quote from: mwalle on June 29, 2024, 08:33:22 amNo, a thermocouple circuit just allows you to measure the voltage difference between two points in its circuit where the different materials touch (=junctions).That´s why each thermocouple-meter needs its own absolute temperature reference. In good old days of school physics labs you put the reference junction into a bath of ice water so you knew it was 0°C. In all modern equipment you have a NTC or some other form of absolute temperature sensor near to the instrument-side junction.If the ADC has 12bits and measures from 0 to 5V, it roughly has 2mV resolution. That´s enough to measure the forward voltage if a diode and get a temperature with a few °C of tolerance. A solder station does not need single-°C-tolerance so that generally should be okay.The thermocouple on the hot side needs the opamp because the thermocouple voltages are much lower than the diode forward voltage and also full of common mode noise/voltage. The opamp is a perfect tool to amplify the low voltage and get rid of common mode stuff.

author: xvr
author_rank: Frequent Contributor
timestamp: June 29, 2024, 10:18:49 am
content: QuoteYes, but there is physically more than one thermocouple junction. A thermocouple consists of two different wires (as the name suggests). If you manage to connect both of them to the PCB pads made of the same material, then it will be only 1 thermocouple. But this is impossible - wires of different materials will be connected to the same wires going into the system (I think copper). This will form 2 more thermocouples when connecting the output wire. So you have 3 thermocouples in series. 1 at measuring temperature and 2 at room temperature (connected in opposite direction). You should compensate voltage of the last 2.

author: mwalle
author_rank: Newbie
timestamp: June 29, 2024, 05:02:31 pm
content: Thanks for all the explanations and the research what uC it might beFWIW, I've just disassembled mine, removed the uC and had a look underneath. There's a number, but its probably just a batch or date code. In any case, i've also verified the schematics and found some errors. I might get around to draw my own one soon.I was thinking about replacing the uC with the winchiphead one because that one doesn't need the VCAP pin (instead of the STM8, dunno if theres a STM32 one with the same pinout). But I've already have enough projects on my stackSo maybe in the future..Btw, the forward voltage of D1 is 1.4V and the reverse one is 0.51V. I measured it in circuit, so there might also be clamping diodes on pin 3 of the uC..-michael

author: MathWizard
author_rank: Super Contributor
timestamp: June 29, 2024, 09:34:05 pm
content: I found a 1N4002 tucked away inside the cable bundle of a 750W PSU. It literally only went from 5V on the anode, and on the cathode was 12V output pin to the fan, and cap, the fan BJT output, and another diode pointing into this node. And they could have put the diode on the PCB, yet they ran a few inches of wire, on each end, to place it in the cable bundle.I reverse engineered the whole PSU, and in my case, I don't see why they put it like a temp sensor.

author: mwalle
author_rank: Newbie
timestamp: June 30, 2024, 02:51:37 pm
content: FWIW, these are my schematics. Take it with a grain of salt.