Electrical – Interfacing microcontroller with external circuit – detect LED and simulate and detect button press

interfacemicrocontrollerrelay

This is my first question on here. I am good at programming but am a little stuck when it comes to electronics and connecting two circuits together.
I would like to interface a spa controller with 3 basic elements – increase temperature button, decrease temperature button and “currently heating” LED.
The MCU I am using runs on 3.3V and the physical controller runs on low voltage (12v I think).

I can access the back of the PCB on the physical controller and can see the 2 push buttons pads behind each button.
I also have access to the + – controlling the red LED.
The voltage reading is 0.45v when the LED is turned on and -0.29v when the LED is turned off.
Logically to me there is a voltage change detected on my multimeter so there must be a way to interface this to an input of 1 or 0 on the micro.
Also not sure if it helps but I got a reading of 135mA across the two pads while the LED was off.

The button pads are joined when I hit the key on the front of the controller unit.
I would like the ability to simulate a button press from the micro (so I can change the temp up and down from the micro).
I would also like the ability to sense if someone has pressed the physical button so I can update the current temp stored in the micro to keep them in sync.
I realize this would require 4 pins (2 for input to the micro and 2 for output from the micro).

I have researched other questions here and on the net and am having trouble finding anything to do with interfacing with external circuits.
I have found some information on 4N35 optoisolators and also reed relays.

Thank you

Horatio

Best Answer

The voltage reading is 0.45 V when the LED is turned on and -0.29 V when the LED is turned off.

To make any sense of these readings we would need to know where in the circuit they were measured. In any case you need to find the circuit common or GND - usually DC negative and take all readings referenced to there. (Multimeter black COM lead on circuit GND for all readings.)

A better way to avoid any risk of damage with the original system is to isolate the control (buttons) and feedback (LED) between the spa controller and your micro.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. Spa interface schematic.

  • Micro OUT1 and OUT2 switch relays. Relay contacts in parallel with the original up and down buttons simulate button press.
  • For heating feedback an opto-isolator is wired in parallel with the original LED. The opto-isolator LED is infra-red and will have a forward voltage (1.2 V) which is lower than the visible LED on the original panel (1.8 to 2.0 V). The opto-LED will hog all the current and the original LED will not turn on brightly.

This scheme gives full electrical isolation between the two systems and saves trying to figure out how the original buttons and LED are monitored and controlled.

If you put the six interface wires on a plug connector you can restore original operation at any time by pulling the plug.

I would like the ability to simulate a button press from the micro (so I can change the temp up and down from the micro). I would also like the ability to sense if someone has pressed the physical button so I can update the current temp stored in the micro to keep them in sync. I realize this would require 4 pins (2 for input to the micro and 2 for output from the micro).

This isn't possible with my simple interface. Solving this aspect requires much more analysis of the original circuit.


The big flaw in the design is keeping the two systems in synch. On power up certain conditions would have to be assumed and problems with contact bounce, etc., would make keeping track very uncertain. It all sounds mildly dangerous as someone jumping in without checking the temperature could suffer severe scalding.


schematic

simulate this circuit

Figure 2. Opto version. Note polarity of wiring to opto-transistors.

To test whether the optos will work instead of relays make up a test connection as shown in Figure 3.

schematic

simulate this circuit

_Figure 3. Opto test circuit.