I don't see how differences between MK1841 and MK1840 really matter here. Pin-compatibility of the MCU doesn't mean an adapter will work correctly with a given board. What matters is the layout of the board.
This is the schematic and pinout for this the 06 board:
https://www.eevblog.com/forum/reviews/youyue-858d-some-reverse-engineering-custom-firmware/msg1349350/#msg1349350floobydust also posted details of an adapter specifically for the D06
https://www.eevblog.com/forum/reviews/youyue-858d-some-reverse-engineering-custom-firmware/msg1206460/#msg1206460Keep in mind that the pin assignments on the AVR correspond to the TQFP package, not the PDIP package.
I don't remember the specifics of what those other adapters went to. The OSH park link is incomplete,
You'll basically have to look at the adapter layout and figure out what nets connect to the AVR pins.
EDIT: The board made by wguibas in your second link won't work for the D06 board. Assignment of pins 2 and 7 are swapped between the D06 and whatever board he was using. You may be able to make it work if you change pin assignments in the firmware.
EDIT AGAIN: If you want a summary of board and adapter compatibility, check here:
https://www.eevblog.com/forum/reviews/youyue-858d-some-reverse-engineering-custom-firmware/msg1418224/#msg1418224These are my own notes for this board. Might want to double check your physical board, but it's easier than trying to sort through this entire thread and all the myriad incompatible bits of information:
map for MCU adaptation (D06 BOARD)
NAME ATMEGA168 MK1840D3
PB0 digit 1 14 2
PB1 triac drive 15 6
PB2 down switch 16 9
PB3 NC 17
PB4 reed switch 18 4
PB5 up switch 19 8
PB6 digit 3 9 7
PB7 digit 2 10 3
PC0 ADC temp sense 23 11
PC1 NC 24
PC2 NC 25
PC3 fan on/off 26 10
PC4 NC 27
PC5 fan sense 28 FAN SENSE CKT
PD0 A 2 15
PD1 E 3 16
PD2 D 4 17
PD3 F 5 14
PD4 DP 6 5
PD5 C 11 18
PD6 G 12 19
PD7 B 13 13
VCC 7 20
AVCC 20 20
GND 8 1
AGND 22 1
AREF external vref 21 AREF CKT
RST 1 terminate
AREF needs to be provided:
- VCC/2 divider (no supply rejection)
- LPF+TL431 or similar (e.g. LM336) (see schematic of
original board (below) for example)
https://github.com/madworm/Youyue-858D-plus/blob/master/Docs/Datasheets/858D_RevEng_Schematic.pdfADAPTING THE CODE:
using TC amplifier output range for D06 board (from schematic pdf)
round([0 1.217 2.44] * 1024/2.5) = [0 498 999]
this demonstrates conversion of the full range of the pin voltage to the full range of register values
use this to adjust lines 104,105 in youyue858d.ino and the default value in the .h file (and possibly other values i missed)
by calculating the relevant intermediate register values for min/max/default, etc
the original board (and default code) assumes raw adc values are scaled to be equivalent to degrees C!
the required rescaling factor is based on amp output slope (4.88mV/K) (see schematic pdf)
4.88E-3 * 1024/2.5 = 1.9988
this scaling factor needs to be used for adjusting the calculation of temp_inst on line 197 in youyue858d.ino
temp_inst = (adc_raw / 1.9988) + temp_offset_corr.value; // approx. temp in °C
similarly, FAN SENSE needs to be provided based on whether you're measuring fan voltage or current.
the min/max register values have to be set accordingly
if measuring the fan voltage using a voltage divider:
given original version voltage divider (10k and 330R) for [9 32] volt range on Vfan (again, from the schematic pdf)
adc register value range is: round([9 32]*330/10330 * 1024/2.5) = [118 419]
if using the current sense mod:
fan current sense mod is a 1R resistor in the ground connection for the fan
default limiting adc register values are [30 71], coresponding to [74 174] mA (lines 155,156 in the .h file)
if the range of fan currents extends beyond these min/max values, or if a different resistor value is used, the min/max values have to be recalculated to correspond to your hardware
i don't really see that by default FAN SENSE is used for anything other than startup testing and PV snooping via the display
so i don't really see the point unless you're out to make some more complicated calculations based on the fan state.
also, all these calculations are based on an assumed 2.5v reference voltage
everything should be adjusted based on actual AREF provided by the adapter board.