@1technophile
Hi, I’ve tested during weekend the ADC reading. The sketch didn’t compile for Arduino Mega (error below) however it compiled fine for NodeMCU v3. Probably I don’t have all the libraries but I haven’t investigated further.
It has worked quite reliably, there were differences in value readings compared to the other sketch that I’m using for ADC (Bruh code) however these are quite normal and acceptable as the ADC is not calibrated (also Bruh code updates the light level immediately if changed).
Initially I thought 30s between readings would be an issue however I realized that it simply doesn’t need a quicker update for light level as the sunset doesn’t occur in one second and I haven’t modified the sketch to decrease it. Anyway, also the MQTT broker is happier with publishing at this rate.
Although, for automations that need instant update reading from light sensor (such as to get feedback from the light bulbs after turning on or off) I think it should be modified to a 1/4 of a second or lower however it just need to modify the sketch. Also, a low response time is needed if using for stuff like open door sensors (in combination with a magnetic hall sensor).
I have an issue on the NodeMCU boards I have: on both v0.4 and 0.3 bluetooth module (non-genuine HM10) and (occasionally) RF receiver (superheterodyne type) the MQTT connection gets reset. This does not trigger full reboot of NodeMCU but only disconnects the MQTT connection and reconnects and it takes a few seconds (3 - 4 at max) to reconnect.
I wouldn’t have observed this if not for the board being connected to an IR blaster with an AC unit. When the NodeMCU gets reset, it loads the code for the MQTT switch (it has retain flag) and sends the IR code to the AC (and AC has a buzzer).
I think there was someone else with a similar problem with the bluetooth module.
This does not occur on the Arduino Mega (v.30) but only on the NodeMCU. It might be a defective board problem (I’m using generic boards and they also have wrong prints for D1 pin on both D1 and D2) however it’s not a sampling aspect. I have tested on 3 units out of the 10 units batch and they all get reset.
Arduino: 1.8.3 (Windows 7), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”
C:\Users\Documents\Arduino\libraries\NewRemoteSwitch\NewRemoteReceiver.cpp: In static member function ‘static void NewRemoteReceiver::interruptHandler()’:
C:\Users\Documents\Arduino\libraries\NewRemoteSwitch\NewRemoteReceiver.cpp:45:53: error: cannot convert ‘NewRemoteCode’ to ‘unsigned int’ in argument passing
#define CALLBACK_SIGNATURE (_callback)(receivedCode)
^
C:\Users\Documents\Arduino\libraries\NewRemoteSwitch\NewRemoteReceiver.cpp:194:7: note: in expansion of macro ‘CALLBACK_SIGNATURE’
CALLBACK_SIGNATURE;
^