Chinese STM32 Oled soldering controller reverse engineer and custom firmware

By | February 7, 2018

Background story

Since I got a bigger place where I can have a projects area slash lab slash dumpster I have been upgrading the basic tools needed to get the job done.

One of the most valuable tools is a proper soldering iron, and since many years ago I have been  a fan of the JBC irons. Since I first tried one at work I wanted one for myself.

The problem

Now a JBC soldering station goes for a minimum of about 400EUR which due to my cheap nature and limited budget makes it as available as  unobtainium. The JBC handles on the other hand go for about 50EUR and I was sure I could get one used for free.

Thinking about the controller itself I pondered about designing something from scratch, order the pcb, sourcing the parts, assembling them, discovering the routing errors made at 2am while working with only one eye opened…

So I went the quick and dirty way, searched aliexpress for the cheapest piece of kit which kind of made what I wanted, and had the possibility of being improved upon with some custom firmware.

The problem with the solution

I found a controller made for the popular hakko T12 tips , featuring an STM32 (which I have quite an experience with), an Oled display (never used one but since they are cheap I can use the learning experience for the future) and a rotary encoder. Schematic was no available but for less than 20USD I couldn’t  go wrong.

Judging by the product picture to the right I was somehow convinced that the original firmware was garbage, the

Chinese soldering station controller

Chinese characters, and the fact that the only understandable writing was “error” may have had something to do with that idea.

With the plan strongly defined on ether I asked my wife’s permission to spend 30EUR and ordered myself one of these controllers, an hakko T12 handle and a couple of tips so I could test without ruining a much more expensive JBC tip.

The solution to the problem with the solution

After about on month a orders arrived and I quickly tested them, not surprisingly it didn’t work very well, with a set point of about 300ºC the pour T12 tip became red hot, which, even not being a soldering iron PhD, I don’t think should happen at that temperature.

Time to reverse engineer the controller schematic. For that I used my favorite technique of taking pictures of both sides of the board, opening them with gimp, assigning them to different layers, reversing the bottom layer, adjust skew and size so they perfectly overlap, and play with the top layer transparency so I can see what connects to what.

Combined layers using gimp

Time to start drawing the schematic while annotating the image with some info.

This was what I came up with:

Eagle Schematic of the soldering controller

An SWD connector so it will be easy to flash and debug, a DC-DC converter with an input of  4.5V to 28V, an exotic amplifier circuit for the thermocouple, a not so fast mosfet and driving circuit for the heating element, a buzzer, voltage input sensing trough voltage devides, ntc for ambient temperature sensing used for cold junction compensation, a bunch of passives, and a…hum…thing with a voltage reference going to an ADC pin (no idea, something to do with neutrinos protection probably).

Eagle file will be available from the github project soon.

Eagle file link

EDIT:Most of the passive values of the schematic are made up, I would have to remove them from the PCB for proper measurements, and it doesn’t really matter for what I’m trying to accomplish.

Next chapter

With the schematic at hand I will start writing the firmware for this thing, next post will be about the development environment and project setup I use for such a thing and the 3rd and final post will be presenting the finished firmware.

Bye

 

27 thoughts on “Chinese STM32 Oled soldering controller reverse engineer and custom firmware

  1. Roman

    Hi Jose,
    I was sooo happy i found your project. I was looking for some not very complex controller
    for JBC T245-A tip. But I was trying to find the same controller you use in your project,
    but am affraid there is no same controller available on aliexpress or ebay.I found similar:
    https://bit.ly/2HDZd2r and most common controller is https://bit.ly/2Fqyrc2
    I am sorry to trouble you with such a silly question but can you please advice me controller that
    would be suitable for you custom firmware for JBC T245 handle.Thanks a lot for your help.
    Regards,
    Roman

    Reply
  2. Roman

    Hi PT_Dreamer,
    I am building soldering iron for JBC and for Hakko tips according to your guide. But both firmwares seem to be the same regarding display symbols. Even pre-defined tips are the same in both version. I use iron_hakko_big_screen.zip and iron_jbc_big_screen.zip . Is that ok?

    So I would like to ask you to explain the display layout. So far I was using old school soldering irons, so this is pretty new for me. It may be helpful also for someone else. SoI have following questions:

    Left upper corner symbols can be following: SET, STB, BOO “Set” is supposted to be temperature settings. That is clear.
    What “STB” stand for? Is it Standby/Sleep setting? “BOO” symbol I guess is Boost mode. What for is boost feature? How do I use it?
    Right upper corner – “%” symbol. What is the purpose of this symbol?
    Left bottom corner – There are D24, BC2, DFLT, B symbols — I guess they are preset settings for tips. D24, BC2 – are they ksger/Hakko T12-BC2 and T12-D24 tips? Why D24 and BC2 need to have extra settings? “B” symbol – not sure. With Hakko firmware I would like to use T12-JS02. Shall I use DFLT settings?
    How about JBC T245A handle (C245tips)? What settings should I use for c245-903 or c245-029 tips ? (except appropriate firmware :))
    DFLT symbol- I guess it means “default”. What tips are covered by DFLT settins?
    Sorry for so many questions 😉
    Regards, Roman

    Reply
    1. jose Post author

      Hi,

      Even pre-defined tips are the same in both version. I use iron_hakko_big_screen.zip and iron_jbc_big_screen.zip . Is that ok?

      No that is not ok. Default settings and pre defined tips are different for both versions. What happens is that after you uploaded one version the second version detected that settings were already present and didn’t overwrite them. You should do a mass erase before you flash a different version.

      Left upper corner symbols can be following: SET, STB, BOO “Set” is supposted to be temperature settings. That is clear.

      SET for set temperature which means the system tries to keep the temperature you set. STB for standby, no power is sent to the iron. BOO boost the system sets the temperature defined on the boost settings. After the time specified on the same settings the temperature returns to the SET temperature. Boost can be triggered by long pressing with the temperature selected.

      Right upper corner – “%” symbol. What is the purpose of this symbol?

      That is the percentage of power currently fed to the iron.

      There are D24, BC2, DFLT, B symbols — I guess they are preset settings for tips.”

      Yes, presets for the Hakko tips I have.

      Why D24 and BC2 need to have extra settings?

      All tips are different so optimally each should be calibrated and have the PID tuned for it. There is nothing different about D24, BC2 and B tips, they just happen to be the tips I have.

      How about JBC T245A handle (C245tips)? What settings should I use for c245-903 or c245-029 tips ? (except appropriate firmware :))
      DFLT symbol- I guess it means “default”. What tips are covered by DFLT settins?

      With all new tips you need to create a new settings, run calibration, and tune the PID. You can use the default setting, but temperature will not be as accurate and the temperature response will not be as good.

      Reply
  3. Roman

    Hi Jose,
    first of all thank you for your patience and answering my questions. Thanks to your explanations I have made a big move forward and I finally figured out how to enter setup menu :o) From this point many things started to make sense.
    I figured out how to add new tips,calibration seems it does not require any interaction, so it’s pretty automatic. I figured out how to do it per each tip. But PID constants…
    I know PID cannot be explained by two sentences. But how did you get PID constants for your tips? If I need to tune it for each tip to get best performance, probably I cannot guess those numbers, trial error method. Yours PID constats for D24,BC2 and B are not even close to each other.
    So any advice, please?
    Regards, Roman

    Reply
    1. jose Post author

      Hi,

      For the first tests I did a step response test and logged the results trough the serial port (not easily available, some soldering is needed). From that I calculated the initial PID values.
      After that and for new tips I just increased P until I got oscillations (just by watching the temperature display) and then backed up a bit.
      For the I just touch an heat-sink or something with a big thermal mass with the iron tip and watch the temperature, If it never gets to the setpoint you need to increase I.

      Again don’t overthink this things, temperature response and accuracy is highly overrated. With current PCB quality (even the cheap ones from china) it doesn’t matter that much. If solder melts you are good to go 🙂
      I do like to have the thing as accurate and stable as I can but that’s more OCD than anything else.

      Reply
  4. Klaus

    Hi together,
    is there anyone that has yet ported Jose’s code to a CPU different to the one used by Jose (STM32F103CBT)?
    My Rework station (double for solder and hot air gun) came with a STM32F101CBT driwing two OLED displays, 2 rotary encoders, a solder iron, a hot air gun and optionally even valves.
    The newest (2018) KSGER model comes with a STM32F102CBT
    I´d like to get Jose’s firmware onto my STM32F101CBT. As this is a one way only direction, I would like to be 100% sure upfront that the rework station will work again after the migration.

    Reply
  5. Stefan Trethan

    Hi Jose,

    Thank you for your great work with this software.
    I am making a JBC soldering station powered by a 18V Makita battery, thanks to your software it was very easy.

    One feature that would be very useful for my application would be to display the battery voltage and possibly provide a low voltage warning option in the menu. It looks to me like there is already a voltage divider to PA4 on the PCB.
    I haven’t done any STM programming before and so far the development environment refuses to run, but I’m confident I can work this out if need be.
    But I wanted to ask if this might be something you would be interested in adding to the software for everyone. I think the battery powered iron for mobile use may be quite popular since there is no really good cordless iron on the market.

    Another small suggestion is to add a “reset to default” option to the calibration procedure. Due to a fault of my own I got trapped into a situation where it wanted to heat above 650°C for the 400°C step. It was quite a struggle until I found how to wipe the entire memory with ST-LINK and start fresh. Again this was totally my own fault but I think it might happen to other users as well.

    Thanks again for taking the time to document your work and provide the software for free.

    Stefan

    Reply
    1. jose Post author

      Hi,

      I already partially replied on the gitHub issue you opened https://github.com/PTDreamer/stm32_soldering_iron_controller/issues/3.
      About it being something I would be interested in adding to the software for everyone, off course it would be.
      The supply voltage is already being read by the ADC, that is implemented in the code, I just don’t do anything with it.
      The settings reset would also be something really easy to implement.
      The problem with both this things in terms of development is the UI part. It requires testing and tweaking to get right, and as I referred on the gitHub issue both my controllers are in use and in a case so I don’t have any controller I can easily play with.

      Reply
    1. jose Post author

      Hi, nice job! Let me know if I can help somehow.
      On my gitHub check the hot gun code for the needed changes to the OLED code. The one I used there should match the one on that controller.

      Reply
      1. jomat

        Attachment

        Hi,
        small update: found some time and got software i2c working (as this pcb layout doesn’t use the built in controllers) for the display.
        Still have to clean up some mess and merge the code, then I’ll push it to github. Nothing else is working yet, this is just a first step.
        Cheers,
        jomat

        Reply
  6. Fred

    Thank you for sharing Jose. This was such an interesting topic that I think I might just need to buy one of these soldering kits.
    I went to brush up on some control engineering because Jose (PTDreamer) said you could tune the PID parameters for a specific tip by turning off the I & D components and then increasing the P gain till the system becomes unstable and oscillation occurs. He was perfectly correct according to Ziegler-Nichols (1942) https://bit.ly/2Mk0sXo

    Sadly as a result of this huge value add from this open source firmware the sales have sky-rocketed and the Chinese have decided to put in a better effort and they have redesigned the board completely. Version 3.0 is now available and hopefully all this good work can be transferred to the new hardware. https://bit.ly/2sTrpbo

    I’m glad to see that jomat has already started to analyze the V2.1S board. I wish I could help but I don’t have the skills to understand this magic.

    Reply
    1. jose Post author

      Thank you for your kind words, I really appreciate it!

      Reply
  7. Fred

    It looks like KSGER fails to appreciate what a bonus this open source firmware is for its hardware. It sounds like they want to lock down the V3 firmware and then they will lose me (and many more) customers,

    ” The soldering station display will not need the code,only when buyer want to crack the program,it will need the code.so i want to warn you, donot want to crack the program,i will not provide the code for you.
    Donot ask me for the code.Because you are not honest buyer.”
    See this AliExpress product page https://bit.ly/2sTrpbo – scroll down to the red text.

    V3.0 hardware has moved the 5-pin connector back onto the display board which is a weak point in similar designs because the long connector puts great leverage on the panel mount and solder joints. https://youtu.be/S8BGkEnHetI

    Reply
    1. jose Post author

      Well sometimes the language barrier is a problem. I just spent 3 days exchanging messages with someone from that “Oficial Kseger store” to see if they could send me one of the new controllers for free so I could port the firmware. This is a copy of the discussion it sounds like a bad joke.

      aliexpress

      Reply
      1. Morten

        Rofl, thanks for your work Jose! I have the KSGER 2.1S and it’s acting a bit like a drunk squirrel, I’ll have a look at the hot air changes and see if I can get it going, though it’s sort of at the boundary of my current experience.

        Reply
    2. jose Post author

      Wait, I think there is some confusion about this code thing. I have received several PMs on EEVBlog about this, where others think that this kseger code prevents flashing the firmware posted here.
      There is no way that kseger or anyone else can prevent flashing a different firmware to this boards. If you mass erase the chip it becomes like brand new and you can do whatever you want.
      I have no way of knowing for sure, but that code is probably to prevent others from using their firmware with other boards.

      Reply
  8. Fred

    I have also been trying to contact KSGER on AliExpress but no luck. He does not realize that KSGER is just another “clone maker”, the huge bonus to KSGER is the addition of the expertise of PTDreamer and the open source community that will support his board rather than another STM32 OLED board.

    Quicko also produces a STM32 board and they have a much healthier customer support of 2 easily contactable people. https://bit.ly/2y498hj
    Bengu also makes one in a nice case but who knows what lurks inside the box?? https://bit.ly/2y46WGB

    My suggestion is One Leader (benevolent dictator) to direct the project. He can have a ‘Brains Trust’ of experienced engineers (Jomat??, +…) to help. He makes a list of features to ask from fabricators add (my suggestion, take the 5pin connector off the board and mount on sturdy front panel). Then we approach the clone makers to see who wants to cooperate. Maybe KSGER can make his own V3 board and a V3 (open source). See which one takes off like the RasPi of soldering stations 🙂
    Stunning work has been done with the TS100 soldering iron BUT it is not a project, you cannot tinker and modify it. Imagine if this project/kit is used for teaching, students build their own self repairable solder station, learn about control engineering. Even if you don’t learn much you will get an appreciation for what engineers and technicians do all day every day around the world to bring us the electrical goodies we love so much.

    I want to ask so many questions. Is EEVBlog the best place to start a thread?

    Reply
    1. jose Post author

      Hi,

      No idea who “One Leader” and “Jomat” are. This boards are overpriced, anyone who is willing to take some risks and has the money to invest can probably make some money with this. For the average joe it is difficult though, chinese fab houses quotes are always for large quantities.
      I have a forum setup, never advertised it or add it to the google index, if you want to use it you will be the first 🙂 forum
      EEVBlog is another option yes

      Reply
  9. Fred

    I am really excited to see “electronics in action” with this PID controller but Jose was right, KSGER is a bit expensive. I eventually bought the Quicko version of this kit for $40 instead of KSGER $60. Only difference is the MCU is STC15W408AS (Chinese 8051 http://www.stcmicro.com/datasheet/STC15F2K60S2-en.pdf). I doubt that I really have the skills to tinker with the code to tune the PID parameters for individual tips or change the fonts and screen layout.

    I made a mistake earlier, because I’m a noob, Quicko does not make a STM32 board only the STC mcu.
    I decided to go for the FX9501 handle because it lets you grip closer to the point and I think that will give better control for SMD work.

    Reply
  10. Travis

    Would it be practical to use the source code to make a version that can run on the STC based units like Fred mentioned above? Or has anyone already done so? I have purchased a similar or virtually identical unit that has the same STC 15F2K60S2, although it is branded as ShineNow on Amazon. It does work, but doesn’t have options to pick the type of tip in the unit.

    Reply
  11. Sebastian

    Hi guys!
    I decide to build whole station on my own. Well, I have some Nucleo64 Boards (STM32F103) on my bench, so, just started.
    Studied schematic find a huge error: R8 will never ever be 10R, it will just burn if you try. Cause it will be voltage devider together with small signal D2 Diode (that set OP input to max 0.8V as well). Looking on Gimp image exactly: R8 is 4.7k resistor.
    I build station for my T470 JBC, so, I not need to take care of it just because or JBC-catriges, but for Hakko&Co: please take care of R8 if building all on your own.
    Best regards,
    Sebastian

    Reply
    1. jose Post author

      Hi, it is written on the blog post ” Most of the passive values of the schematic are made up, I would have to remove them from the PCB for proper measurements, and it doesn’t really matter for what I’m trying to accomplish”. The schematic was created just as a mean to write the firmware, it was never intended to be used to build a controller from it.

      Reply
  12. Sebastian Kulik

    Attachment

    Hi guys,

    I lived comment allready, but its isnt here.
    I redrawed whole thermo-sensor preamp with corrected values (mostly all of resistors are wrong).
    I used in simulation OPA703 cause of less drift and better performance as well.
    Cheers,
    Sebastian

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.