Modding an aquarium LED controller with an ESP8266 - Page 1
Forum section: electronics / beginners

author: zensilence
author_rank: Newbie
timestamp: March 03, 2020, 03:20:02 am
content: Hi Folks!Long time viewer first time posterI have done hobbyist electronics for a while now but mainly building my own projects. I have never modded an existing board before. Below is the LED touch control board from my Aquarium. The buttons are contact touch pads and it cycles between several patterns of the LED array.Button 1On / Off if tapped once5 levels of increase or decrease of brightness if heldButton 2Each Tap Cycles the light pattern1 Full Daylight2 Afternoon Light3 Full Daylight4 Moon Light5 RedThe two interesting IC's on the board are:BS802B - Contact Touch ControllerI think all this does is debouncing and delay then forwards the signal to the main micro controllerData Sheet:https://pdf1.alldatasheet.com/datasheet-pdf/view/320430/HOLTEK/BS802B.html8S103F2P6 - MicrocontrollerThe number is hard to read on this one but I'm pretty sure its this oneData Sheet:https://www.st.com/resource/en/datasheet/stm8s103f2.pdfI have the code written for the ESP8266 and tested with a single LED's just for debugging.My questions are:1) I have no idea where to attach the ESP8266 output pin to.2) Should the output pin be high or low to activate the circuit.3) I don't really know if I should link the grounding pin from the ESP8266 to this board.Im pretty sure I can remove a lot of these chips and just control this with a relay but ideally i want the original buttons to still work for manual control and I don't know if the IC has some custom logic to control which pattern of LEDS lights up.Thanks in advance for any input or comments

author: floobydust
author_rank: Super Contributor
timestamp: March 03, 2020, 08:35:26 am
content: Welcome to the forums!I think your project should be fun and I did a cheesy sketch of something that might be a starting point.One problem is the aquarium LED controller board runs off 5V and the ESP8266 is a 3.3V MCU. So you need to not mix and match signals without using a level-translator.You can see the Touch sensor IC has two open-drain outputs, which means you could add your two ESP8266 output connections to the aquarium LED controller MCU by using a pair of extra N-ch mosfets such as BSS138. So both could get along (ESP8266 and touch buttons) and control things.I would also add a RESET output so you can reset the LED MCU because if the aquarium MCU gets out of sync, i.e. someone touches a button then your code does not know this happened - unless you also want to add hardware to read the touch buttons to follow.Possible I/O assignment:ESP8266_GPIO4 to assert button 1ESP8266_GPIO5 to assert button 2ESP8266_GPIO14 to assert MCU resetOutputting a logic 1 (pulse) would turn on the mosfet which pulls down (to 0V) the STM8 MCU signal to assert it. All three are active low, meaning a logic 0 activates that line on the STM8. This is just from looking at the PC board and guessing how they did it.I would confirm the LED power supply is properly isolated from AC mains and has extra capacity if you want to use it to also power the ESP8266. I guess it is maybe 9V or 12V which is too much so you need something to lower it to power the 3.3V ESP8266. If the aquarium LED/MCU power supply is properly isolated from mains (it should be) then you can tie the two circuit GND's together.It's just that some really cheap aquarium LED setups use a "mains capacitive dropper" power supply which is not safe to connect to. It depends on how many LED's there are.

author: zensilence
author_rank: Newbie
timestamp: March 04, 2020, 04:32:32 am
content: Thank you floobydust for the quick and detailed response!I can't seem to find a though hole package for the BSS138 some googling seems to say that the 2N7000 might be an option and easy to get off amazon even if they are on the expensive sidehttps://www.amazon.com/FAIRCHILD-SEMICONDUCTOR-2N7000-CHANNEL-MOSFET/dp/B00M1GP3X0QuoteI was planning on powering the ESP off its own dedicated power supply rather then tap into the controller. Would it be easier to tap into the controller power?There are a fair amount of LEDs run by this board its a salt water aquarium for growing corals so they are fairly beefy also. It has two independent power supplies that both feed into this board you can see the mains lines coming into the board on the bottom right corner one set of red and white wires for each power supply.I will see what numbers and voltages I can read off them when I get home.