Introduction to norelite npm package

On request I’ve put together a few slides that explains the concept and structure of norelite. It might help to get started.

Norelite is an npm package for Node-RED and the nodes within the package can be used to implement your home automation requirements based on rules.

Download: norelite overview 1.5.0.pdf

17a29bba-df0a-11e6-9e7b-fbfba8f499c8

Advertisements

Figure out the esp8266 ADC Maximum voltage

In my quest to replace my current setup of Arduinos to esp8266 to gather sensor data I’ve been struggling with getting a similar output when using an LDR (light dependant resistor). I’ve been struggling with it for quite some time and I’ve finally come to a solution.

The issue being that the output graph from the LDR with an Arduino differs quite a bit from an esp8266 with an LDR.

After browsing for more details regarding the analog pin (ADC) on the esp8266 I realized that it does not measure between 0-3.3v but from 0-1v. When you do an analogRead on the input it outputs a value between 0-1024. But after I had introduced a voltage divider to get to 1v input I was still not getting the expected results.

In order to troubleshoot I measured the output from the ADC (i.e. digitalWrite(A0,1) ) and I received 0.6v. I thought that maybe it will output the expected max input value (but actually it was half the value).

const byte LDRpin=A0;

void setup() {
 pinMode(LDRpin, OUTPUT);
 delay(250);
 digitalWrite(LDRpin,1); //or analogWrite(LDRpin,255);
}

void loop() {
}

As a second step I wrote a small code and instead of a voltage divider I used a potentiometer to trim the input voltage to the ADC pin and the code did output 1024 when I reached 1.2v.

const byte LDRpin=A0;
volatile unsigned int ldr;

void setup() {
 Serial.begin(115200);
 pinMode(LDRpin, INPUT);
}

void loop() {
 ldr = analogRead(LDRpin);
 Serial.println(ldr);
 delay(5000);
}

As a summary the maximum voltage for my esp8266 is 0-1.2v. I don’t know if this is a common value for the esp8266 or if it was unique only for my esp8266-12e but at least there is a fairly simple way to find out.

So instead of using a 100Ω (R2) and 220Ω (R1) resistors to get to 1.0v I used 100Ω (R2) and 180Ω (R1) in the voltage divider to bring down 3.3v to 1.2v as input to the LDR. R1 was calculated using this online tool http://www.raltron.com/cust/tools/voltage_divider.asp

voltage-divider