The YOUYUE 858D+ I have in my possession uses an AVR ATmega8 microcontroller to control the fan-speed, drive a 7-segment display, read 2 buttons and drive the TRIAC via an opto-isolator.
I will not reverse-engineer the schematic 100%, I don’t care for the analog stuff too much, or the HV side of things (safety first!), but I’ll go far enough to treat most of the circuit as a black box and only care for what is directly connected to the ATmega8.
So out the ATmega8 goes, and in goes a spare ATmega168. Reading the potentiometer and 2 buttons is just a matter of minutes, translating that into fan-speed (hopefully using a PWM pin) shouldn’t take much longer. Then I’ll have a go at figuring out how to drive the display. Once all of the UI stuff works, I’ll look into reading the temperature sensor (presumably using another ADC input). Calibration and tweaking will be done later. Then I’ll very very carefully look into driving the heater (probably with PID control). Will I have to deal with zero-crossing detection, I’ll find out!
If all of the standard features work, I might look into adding useful extras: a fan-test would be nice. A non-intrusive way to do this would be to turn turn on the fan at low speed, then the heater for a second or two and check for a temperature increase. If no temperature rise is detected, either the fan or the heater are broken / not connected.
Step 1: DC power + a lot of guesswork
The power supply part (fan + mcu) was pretty easy to figure out. A couple of diodes + 7805 + caps are involved. The two switches directly connect to two AVR GPIO pins and pull them down to GND – as expected.
Please note that some capacitors etc. may not show up in the above schematic. It just covers the bare minimum to understand how it works.
It seems the air-speed is not directly controlled by a PWM pin (sadly). The fan itself is switched by a TIP122 (NPN darlington), which is used as a high-side switch (why?). There are quite a lot of SOT23 transistors (assumption) in the vicinity. Maybe they’re used to supply the base with a higher voltage… It is also strange that some capacitors are rated at 35V, although the rectified AC for the fan is about 37V. The fan itself is rated for 24VDC. Hmmmm. There are way too many small parts next to the TIP122 for just simple switching. I’ll have to investigate further. Maybe it does monitor the fan current?
I have a feeling this will take more time than expected. So for now I’ll turn my attention towards getting the 7-segment display working. That should be doable in a day.
Step 2: 7-segment display
The common anode 7-segment display is directly driven by the MCU. Three GPIO pins are dedicated as current sources to activate each of the three digits, relying on persistence of vision for a steady display. Another 8 GPIO are used to drive the 7 segments plus the decimal points (just one is used).
The 7-segment pins are:
- PB0: 7-seg digit 1
- PB7: 7-seg digit 2
- PB6: 7-seg digit 3
- PD0: 7-seg top
- PD1: 7-seg bottom left
- PD2: 7-seg bottom
- PD3: 7-seg top left
- PD4: 7-seg dot
- PD5: 7-seg bottom right
- PD6: 7-seg middle
- PD7: 7-seg top right
Datasheet: SM310401K – note: pin-# in datasheet: (1…5) – (7…12)
Step 3: Buttons & reed switch
Step 4: Fan control
The MCU can stop the fan by pulling the base of the power transistor (TIP122) low. This is done with the help of a small SOT23 transistor and pin PC3. The MCU can also measure the emitter voltage (via PC5 / ADC5 / pin #28) of the TIP122, most likely to detect fan issues (no fan / stall). I will have to verify that.
R4 and Z1 form a crude reference voltage generator. Together with U7, this forms a comparator of sorts.
When the TIP122 is on (pull-up-resistor R5), C7 gets charged to a voltage set by the potentiometer (which is derived from the 122’s emitter voltage. As long as that voltage is higher than the Zener-voltage of Z1 (plus one base-emitter drop of about 0.7V of U7), U7 turns on and reduces the base current of the TIP122. The fans slows down. This forms a basic speed control mechanism for the fan.
At first I thought this circuit would oscillate, but I was mislead by the zener-diode + U7 “comparator”. If you forget about Z1 etc, this is just a simple current limiter. If U7’s V(BE) voltage is too high, too much voltage drop across the load, it turns on and “tames” the power transistor.
They could easily have driven the fan directly from the MCU, but maybe they wanted to make sure the fan always runs, just in case the MCU locks up. However, hardware PWM is very reliable… and the MCU drives the TRIAC as well. Who knows…
Step 5: Heater control (ON / OFF)
Step 6: A mystery
Step 7: FIRST LIGHT
What works so far:
- reading the 2 buttons
- reading the wand sensor (reed contact)
- fan ON / OFF override
- crude heater control – just ON / OFF
- read the thermo-couple voltage from the OP-7
- implement a control loop for the temperature (most likely PID) + sensible calibration
- read the fan status signal (not quite sure what it is)
Continue reading: Part II