cancel
Showing results for 
Search instead for 
Did you mean: 

Please help me reverse engineer these buttons...

Rjohn.1
Associate II

Hi,

I am trying to figure out how a set of buttons interfaces with the microprocessor - an STM8S 003K3T6C ([url=https://www.st.com/resource/en/datasheet/stm8s003f3.pdf]datasheet[/url])

I am familiar with simple button config - you pull GPIOs high or low with the button and detect the change.

I don't understand what is going on with this circuit at all... I want to know so I can bypass the push buttons and control it programmatically using an external MP.

There are 6 buttons that control e.g. power on/off, fan direction, raise / lower a hatch etc.

I have traced them back to these pins on the microprocessor:

[img]https://i.ibb.co/zPvJR5X/pin-out.png[/img]

Fan Direction:

Button 1 connects 10 -> 32

Button 2 connects 8 -> 32 

Hatch up/down

Button 3 connects 10 -> 2

Button 4 connects 8 -> 2

Button 5 connects 10 -> 28 (Sensor on/off)

Button 6 connects 8 -> 28 (Power on/off)

So there is a pattern, either 10 or 8 is connected to 32 or 2 or 28

Supply to the processor is 3V.

If I measure each pin to ground, I get:

10 & 8 are 0.514V

32 & 2 & 28 are 1.04V

What i was hoping was that 10 and 8 were high & low!

Can anyone explain to me how this circuit might work? And how can I bypass the push buttons?

Thank you

5 REPLIES 5
Ozone
Lead II

Have you tried to measure/scope the voltage across the buttons during operation, i.e pressing ?

Using pin 2, by default assigned to quartz / clock generation, seems not the best idea to me. Or the design operates on the internal RC oscillator.

Pin 28 is also an ADC channel input.

I could imagine there is an R-network connected to to the buttons, so each pressed button adds acertain voltage (like an DAC ladder network).

Reading the voltage from the ADC, the firmware might try to deduce the pressed buttons from the sum voltage.

Just a guess.

Rjohn.1
Associate II

Hi, thanks very much for your help.

I have measured between each pin and found the following. I still don't understand it, but I am hoping you do!

0693W000003QJveQAG.png

Rjohn.1
Associate II

To add to this, pressing the buttons just shorts the signal e,g 10->2 goes to zero if I press Button 3

Ozone
Lead II

> I still don't understand it, but I am hoping you do!

Me neither ...

I would measure measure between pins and ground, negative voltages are irritating. I suppose there are no voltage below GND on the board.

>Fan Direction:

>Button 1 connects 10 -> 32

>Button 2 connects 8 -> 32 

>Hatch up/down

>Button 3 connects 10 -> 2

>Button 4 connects 8 -> 2

>Button 5 connects 10 -> 28 (Sensor on/off)

>Button 6 connects 8 -> 28 (Power on/off)

Rethinking this, it seems pins 10 and 8 outputs, and pins 32, 2 and 28 are inputs.

Having set pin 10 and 8 to reverse levels ( 10 = H and 8 = L, or 10 = L and 8 = H), the buttons would connect one of those output levels the the respective input.

For sure the original designer could answer that questions immediately ... but I know how such things use to play out.

Perhaps respective output can then be used to drive an attached switch (power MOSFET ?) directly. The pin 8 / 10 outputs might additionally be pulsed.

I would review the schematics, or, if not available, deduce the relevant part (buttons and MCU connections) from a real-life board.

Rjohn.1
Associate II

Thank you. Nothing is available unfortunately, however I am going to try optocouplers to connect the pins to see if I can mimic button presses.

I appreciate your thoughts!