Arduino Mega 2560 & Blynk Apps- Detect HVAC system warning sign by pilot lamp

Hi all.

I have a project to make HVAC system analog control panel smart using arduino Mega 2560 and blynk apps.

my method is to use the current sensor and tap at Pilot Lamp at control panel. because at control panel have a Green and red pilot lamp. each pilot lamp indicates system running (green) or down (red).

So each pair of the pilot lamps will connect to every protection system in the control panel. By using IOT to the control panel, we can monitor specific devices that down far from the site.

The method is - if device A down, the current will supply to Red Pilot Lamp and current sensor detects current will sent signal to Mega 2560. end of signal, Blynk will show the device down from the current detect at pilot lamp.

My coding: apps at blynk will show downtime and total running time. If the current sensor not install at the board, it will detect system down. Unless current sensor connected to Mega and detect current at red pilot lamp, so the system really down.

My problem:

  1. I have 3unit 3rd party arduino Mega 2560. when using each of the board, different faulty will found.
  • 1st unit will run perfectly (with all sensor connected to Mega) BUT after a few minutes, it will detect system down(which is detect current at the sensor, but it actually no current detected at all).

  • 2nd unit directly detect some system down( because i set 8 sensor to detect 8 device in the system) and it keep showing device down and change down and running each of the device during run the board.

  • 3rd unit, when u run it, directly detect all device down even though it is actually no current detected at the sensor.

so i will share my coding, my connection and my blynk for u to help me detect why it cannot run.

My suspect is, i have to purchase original Mega 2560 board instead buying 3rd party Board. Maybe 3rd party board faulty during purchase and cannot test it during purchase.

arduinoblynkesp01-full.ino (25.1 KB)

What current sensor are you using? link to datasheet?

Your code seems to indicate that these LEDs are being supplied with AC voltage? That seems odd... What is the signal that you are measuring? 24V AC or DC or ????

Also, you should look into arrays. You have TONS of duplicate code. There is no need to continuously cut&paste code since you have 8 sensors...

What current sensor are you using? - I'm using donut type current sensor, non-invasive type.

link to a datasheet? - I don't know cuz somebody else who makes the coding for me. Mind to teach me how to add coding to reset the downtime and total run time?

Your code seems to indicate that these LEDs are being supplied with AC voltage? - Yes, cuz 240V will supplied to the Pilot Lamp and my donut type current sensor will detect current passed through it and sent signal that the device is down.

You have TONS of duplicate code. - Mind to edit the coding for me and add reset time for each of the 8 sensor?

you can refer to my previous attachment for the diagram, blynk apps look like and the coding. I'm stuck at the phase where the apps detect device down eventho it is only connected for testing, not yet tapping at the pilot lamp control panel at site.

My findings is: Mega 2560 board may be faulty due to different result for each of 3 boards.